Changeset 12414 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 8 Jan 2015, 07:01:26 (10 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py
r11804 r12414 166 166 return True 167 167 168 # Define a validation method for ids 169 class NotIdValue(schema.ValidationError): 170 __doc__ = u"Invalid id" 171 172 #: Regular expressions to check id formats. 173 check_id = re.compile(r"^[a-zA-Z0-9_-]{2,6}$").match 174 175 def validate_id(value): 176 if not check_id(value): 177 raise NotIdValue(value) 178 return True 179 168 180 # Define a validation method for international phone numbers 169 181 class InvalidPhoneNumber(schema.ValidationError): -
main/waeup.kofa/trunk/src/waeup/kofa/university/interfaces.py
r11838 r12414 21 21 from zope import schema 22 22 from zope.interface import Attribute, invariant, Invalid 23 from waeup.kofa.interfaces import (IKofaObject, IKofaContainer)23 from waeup.kofa.interfaces import IKofaObject, IKofaContainer, validate_id 24 24 from waeup.kofa.interfaces import MessageFactory as _ 25 25 from waeup.kofa.university.vocabularies import ( … … 39 39 default = u'NA', 40 40 required = True, 41 constraint=validate_id, 41 42 ) 42 43 … … 69 70 default = u'NA', 70 71 required = True, 72 constraint=validate_id, 71 73 ) 72 74 … … 112 114 default = u'NA', 113 115 required = True, 116 constraint=validate_id, 114 117 ) 115 118 … … 156 159 default = u'NA', 157 160 required = True, 161 constraint=validate_id, 158 162 ) 159 163 -
main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py
r12191 r12414 271 271 errs, inv_errs, conv_dict = converter.fromStringDict( 272 272 row, self.factory_name, mode=mode) 273 if 'code' in row and ' ' in row['code']:274 errs.append(('code','must not contain spaces'))275 273 return errs, inv_errs, conv_dict 276 274
Note: See TracChangeset for help on using the changeset viewer.