Ignore:
Timestamp:
8 Jan 2015, 07:09:09 (10 years ago)
Author:
Henrik Bettermann
Message:

Modify getWidgetsData so that we always get the same error format.

Fix tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/converters.py

    r9932 r12415  
    2424from zope.formlib.form import (
    2525    _widgetKey, WidgetInputError, ValidationError, InputErrors, expandPrefix)
    26 from zope.formlib.interfaces import IInputWidget
     26from zope.formlib.interfaces import IInputWidget, ConversionError
    2727from zope.interface import Interface
    2828from zope.publisher.browser import TestRequest
     
    100100            if not widget.hasInput():
    101101                continue
    102 
    103102            try:
    104103                data[name] = widget.getInputValue()
    105104            except ValidationError, error:
    106                 # convert field ValidationError to WidgetInputError
    107                 error = WidgetInputError(widget.name, widget.label, error)
     105                error = ConversionError(u'Validation failed')
    108106                errors.append((name, error))
    109             except InputErrors, error:
     107            except WidgetInputError, error:
     108                error = ConversionError(u'Invalid input')
    110109                errors.append((name, error))
    111 
     110            except ConversionError, error:
     111                errors.append((name, error))
    112112    return errors
    113113
Note: See TracChangeset for help on using the changeset viewer.