Changeset 12261 for main/waeup.ikoba


Ignore:
Timestamp:
19 Dec 2014, 08:14:25 (10 years ago)
Author:
Henrik Bettermann
Message:

Modify getWidgetsData so that we always get the same error format. Should also be changed in Kofa.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py

    r12260 r12261  
    268268            content,
    269269            'reg_number,password,firstname,lastname,sex,phone,state,date_of_birth,customer_id,email,--ERRORS--\r\n'
    270             '1,,Frank,Meyer,m,1234,,1990-01-06,F123456,aa@aa.ng,reg_number: reg_number\r\n'
     270            '1,,Frank,Meyer,m,1234,,1990-01-06,F123456,aa@aa.ng,reg_number: Invalid input\r\n'
    271271            '3,,Uli,Schulz,m,1234,,1990-01-07,A123456,aa@aa.ng,This object already exists. Skipping.\r\n'
    272272
  • main/waeup.ikoba/trunk/src/waeup/ikoba/utils/converters.py

    r11949 r12261  
    2323from zope.formlib.boolwidgets import CheckBoxWidget
    2424from zope.formlib.form import (
    25     _widgetKey, WidgetInputError, ValidationError, InputErrors, expandPrefix)
    26 from zope.formlib.interfaces import IInputWidget
     25    _widgetKey, WidgetInputError, ValidationError, InputErrors,
     26    expandPrefix)
     27from zope.formlib.interfaces import IInputWidget, ConversionError
    2728from zope.interface import Interface
    2829from zope.publisher.browser import TestRequest
     
    8788
    8889    This is merely a copy from the same-named function in
    89     :mod:`zope.formlib.form`. The only difference is that we also
     90    :mod:`zope.formlib.form`. The first difference is that we also
    9091    store the fieldname for which a validation error happened in the
    9192    returned error list (what the original does not do).
     93    The second difference is that we return only ConversionError objects.
    9294    """
    9395    errors = []
     
    104106                data[name] = widget.getInputValue()
    105107            except ValidationError, error:
    106                 # convert field ValidationError to WidgetInputError
    107                 error = WidgetInputError(widget.name, widget.label, error)
     108                error = ConversionError(u'Validation failed')
    108109                errors.append((name, error))
    109             except InputErrors, error:
     110            except WidgetInputError, error:
     111                error = ConversionError(u'Invalid input')
     112                errors.append((name, error))
     113            except ConversionError, error:
    110114                errors.append((name, error))
    111115
Note: See TracChangeset for help on using the changeset viewer.