Sorry, to finish up some considerations...

Ive been investigating how web2py assigns default validators to field 
types. 

If im not wrong this is done by SQLFORM which imports a function from 
gluon.dal called _default_validators.

In this function the relationship between web2py field types and validators 
is hardcoded.

Its a shame that these relationships cannot be extended since it looks like 
creating a new field type, is as easy as something like:
db._adapter.types['booleantri']='TINYINT(1)'

I have tried it and  
Field("with_kids", "booleantri", requires=IS_NULL_OR(IS_INT_IN_RANGE(0,2)))
works as expected so far. 

Of course it might not be this obvious to create a field type (or maybe it 
is) but the point is that it would be great if we could declare a default 
validator for this sort of custom field types.

I guess that with some python surgery it can be done by overloading this 
_default_validators function but yes, it would be great if there were a way 
without hacking.

Thanks




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to