Changeset 12415


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.

Location:
main/waeup.kofa/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r12395 r12415  
    55===================
    66
     7* Modify getWidgetsData so that we always get the same error format.
     8
     9* Validate all codes in university.
     10
    711* Catch traceback when creating an application slip with a corrupted
    812  image file.
    913
    1014* Remove deprecated HTML and REST widgets and use html2dict instead.
    11 
    12 * Do not import codes with spaces.
    1315
    1416* UserProcessor: Check if imported roles do exist in the portal.
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/batchprocessing.txt

    r12191 r12415  
    567567    title_prefix,code,title,--ERRORS--
    568568    faculty,FAC1,Faculty 1,This object already exists. Skipping.
    569     faculty,FAC 5,Faculty 5,code: must not contain spaces
     569    faculty,FAC 5,Faculty 5,code: Invalid input
    570570
    571571    >>> finished_file = dc_path + '/finished/newfaculties_zope.mgr.create.finished.csv'
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r12414 r12415  
    171171
    172172#: Regular expressions to check id formats.
    173 check_id = re.compile(r"^[a-zA-Z0-9_-]{2,6}$").match
     173check_id = re.compile(r"^[a-zA-Z0-9_-]{2,9}$").match
    174174
    175175def validate_id(value):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r12009 r12415  
    541541            content,
    542542            'reg_number,firstname,student_id,sex,email,phone,state,date_of_birth,lastname,password,matric_number,--ERRORS--\r\n'
    543             '1,Aaren,B123456,m,aa@aa.ng,1234,cleared,1990-01-03,Finau,mypw1,100001,reg_number: reg_number\r\n'
    544             '2,Aaren,C123456,m,aa@aa.ng,1234,admitted,1990-01-04,Berson,mypw1,100000,matric_number: matric_number\r\n'
    545             '1,Frank,F123456,m,aa@aa.ng,1234,,1990-01-06,Meyer,,100000,reg_number: reg_number; matric_number: matric_number\r\n'
     543            '1,Aaren,B123456,m,aa@aa.ng,1234,cleared,1990-01-03,Finau,mypw1,100001,reg_number: Invalid input\r\n'
     544            '2,Aaren,C123456,m,aa@aa.ng,1234,admitted,1990-01-04,Berson,mypw1,100000,matric_number: Invalid input\r\n'
     545            '1,Frank,F123456,m,aa@aa.ng,1234,,1990-01-06,Meyer,,100000,reg_number: Invalid input; matric_number: Invalid input\r\n'
    546546            '3,Uli,A123456,m,aa@aa.ng,1234,,1990-01-07,Schulz,,100002,This object already exists. Skipping.\r\n'
    547547            )
  • 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.