Changeset 6343 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 11 Jun 2011, 05:17:28 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r6341 r6343 23 23 """ 24 24 import os 25 import re 25 26 import waeup.sirp.browser 26 27 … … 52 53 os.path.join(IMAGE_PATH, 'placeholder_f.jpg')).read() 53 54 55 # Define a valiation method for email addresses 56 class NotAnEmailAddress(schema.ValidationError): 57 __doc__ = u"Invalid email address" 58 59 check_email = re.compile(r"[a-zA-Z0-9._%-]+@([a-zA-Z0-9-]+.)*[a-zA-Z]{2,4}").match 60 def validate_email(value): 61 if not check_email(value): 62 raise NotAnEmailAddress(value) 63 return True 64 54 65 @provider(schema.interfaces.IContextAwareDefaultFactory) 55 66 def default_passport_image(context): … … 336 347 title = u'Email', 337 348 required = False, 349 constraint=validate_email, 338 350 ) 339 351 phone = schema.Int(
Note: See TracChangeset for help on using the changeset viewer.