[Grok-dev] Form data validation
    Lumir Jasiok 
    lumir.jasiok at vsb.cz
       
    Tue Mar  8 10:37:42 EST 2011
    
    
  
Hi,
I am trying to figure out how to validate form data against ZODB's data. 
I have Employees model, data saved into the ZODB.
Inside IEmployee interface is field uid. I need to be sure, that uid is 
unique, so I add "constraint=unique_uid" parameter.
How can I from function unique_uid check if Employee's uid is unique or 
not? Or there is another, better way to doit?
class IEmployee(interface.Interface):
     first_name = schema.TextLine(title=u'First name', required=True)
     last_name = schema.TextLine(title=u'Last name', required=True)
     uid = schema.TextLine(title=u'Personal Number', required=True, 
constraint=unique_uid)
def unique_uid(uid):
     ...?
Thanks for help
Lumir
-- 
  Lumír Jasiok
  VSB-TU Ostrava - Computer centre
  Tel: +420 59 732 3189
  E-mail: lumir.jasiok at vsb.cz
  http://www.vsb.cz
    
    
More information about the Grok-dev
mailing list