Changeset 57 for waeup_product/trunk/Widgets.py
- Timestamp:
- 19 Oct 2005, 09:42:03 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup_product/trunk/Widgets.py
r47 r57 15 15 """ StudentId Widget""" 16 16 meta_type = "StudentId Widget" 17 digits = 8 18 digits_str = "N"*digits 19 letters = 2 20 letters_str = "L"*letters 17 21 18 22 def validate(self, datastructure, **kw): … … 20 24 21 25 valid = CPSStringWidget.validate(self, datastructure, **kw) 22 print "studentw",valid23 26 if not valid: 24 27 return 0 … … 27 30 value = datastructure[widget_id] 28 31 err = 0 29 if not (len(value) == 8 and value[:6].isdigit() and value[6:].isalpha()): 30 err = 'invalid Student Id' 31 32 if not (len(value) == self.digits + self.letters and value[:self.digits].isdigit() and value[self.digits:].isalpha()): 33 err = 'invalid Student Id in the format: %s%s with N = Number, L = Letter' % (self.digits_str,self.letters_str) 32 34 if err: 33 35 datastructure.setError(widget_id, err) … … 60 62 61 63 valid = CPSStringWidget.validate(self, datastructure, **kw) 62 print "sc_pinw",valid63 64 if not valid: 64 65 return 0 … … 67 68 value = datastructure[widget_id] 68 69 err = 0 69 print value 70 if not value in valid_pins: 70 if not value in self.valid_pins: 71 71 err = 'invalid Pin' 72 72 if err:
Note: See TracChangeset for help on using the changeset viewer.