Changeset 7850 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 12 Mar 2012, 16:36:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py
r7843 r7850 101 101 return grades_dict[value][1] 102 102 103 # Define a vali ation method for email addresses103 # Define a validation method for email addresses 104 104 class NotAnEmailAddress(schema.ValidationError): 105 105 __doc__ = u"Invalid email address" … … 111 111 if not check_email(value): 112 112 raise NotAnEmailAddress(value) 113 return True 114 115 # Define a validation method for international phone numbers 116 class InvalidPhoneNumber(schema.ValidationError): 117 __doc__ = u"Invalid phone number" 118 119 # represent format +NNN-NNNN-NNNN 120 RE_INT_PHONE = re.compile(r"^\+?\d+\-\d+\-[\d\-]+$") 121 122 def validate_phone(value): 123 if RE_INT_PHONE.match(value): 124 raise InvalidPhoneNumber(value) 113 125 return True 114 126
Note: See TracChangeset for help on using the changeset viewer.