On May 30, 11:13 am, annet <annet.verm...@gmail.com> wrote:
> Just to make sure I do not overlook anything ...
>
> I have a table definition:
>
> db.define_table('postcoderegio',
>     db.Field('regio',label='Regio *
> ',length=2,default='',notnull=True,unique=True),
>     ...
>     migrate=False)
>
> db.postcoderegio.regio.requires=[IS_MATCH('[0-9]{2}',error_message=T
> ('no match 2 digits')),IS_NOT_IN_DB
> (db,'postcoderegio.regio',error_message=T('regio already in
> database'))]
>
> ...and wonder whether the IS_MATCH(..) validator implies an
> IS_NOT_EMPTY() validator as well.

Yes, because an empty string will not match the given regex.

>
> The same here:
>
> define_table('plaats',
>     db.Field(...),
>     db.Field('gemeente',db.gemeente,label='Gemeente *
> ',default='',notnull=True,ondelete='RESTRICT'),
>     migrate=False)
>
> ...
> db.plaats.gemeente.requires=IS_IN_DB(db, db.gemeente.id,'%(gemeente)
> s')
>
> ... does the IS_IN_DB(..) suffice to prevent and empty field?

Yes, because the only way it would be validated is if it had en empty
entry in a record but that is not possible by the notnull=True
restriction.

>
> Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to