>
> jodb.define_table('category', 
>     Field('name', 'string', length=100, unique = True, requires = 
> IS_NOT_EMPTY()),
>

Here, by explicitly specifying "requires", you are preventing web2py from 
automatically adding the IS_NOT_IN_DB validator, so you have to add that 
one explicitly as well.
 

> jodb.category.name.requires = IS_NOT_IN_DB(jodb,jodb.category.name) 
>

Here, by specifying the IS_NOT_IN_DB validator, you have overwritten the 
previously specified IS_NOT_EMPTY() validator. Instead, try:

requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(jodb, jodb.category.name)]

Or you can simply specify unique=True and notnull=True (without specifying 
any "requires"), and you will automatically get both of those validators.

Anthony

Reply via email to