Ignore:
Timestamp:
19 Oct 2005, 09:42:03 (19 years ago)
Author:
joachim
Message:

=more

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup_product/trunk/Widgets.py

    r47 r57  
    1515    """ StudentId Widget"""
    1616    meta_type = "StudentId Widget"
     17    digits = 8
     18    digits_str = "N"*digits
     19    letters = 2
     20    letters_str = "L"*letters
    1721   
    1822    def validate(self, datastructure, **kw):
     
    2024       
    2125        valid = CPSStringWidget.validate(self, datastructure, **kw)
    22         print "studentw",valid
    2326        if not valid:
    2427            return 0
     
    2730            value = datastructure[widget_id]
    2831            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)
    3234            if err:
    3335                datastructure.setError(widget_id, err)
     
    6062       
    6163        valid = CPSStringWidget.validate(self, datastructure, **kw)
    62         print "sc_pinw",valid
    6364        if not valid:
    6465            return 0
     
    6768            value = datastructure[widget_id]
    6869            err = 0
    69             print value
    70             if not value in valid_pins:
     70            if not value in self.valid_pins:
    7171                err = 'invalid Pin'
    7272            if err:
Note: See TracChangeset for help on using the changeset viewer.