Remember "requires" property is not used when you just insert(),
update() or update_record().
So, in Web2py you don't have anything like a db trigger. You could do it
using a custom validator like CLEANUP() and using validate_and_insert()
or validate_and_update() in substitution of regular insert() or update().
On 07/02/2012 10:08 AM, Santiago wrote:
Hello,
I have a field defined as below :
Field('id_indra', length=5, label=T('ID Indra'), notnull=False,
requires=[REQUIRED, MAX_5, IS_MATCH(r'^[a-zA-Z0-9]{5}$')])
Is it is possible to intercept all inserts / updates over this field and
do a zfill() before the accion takes place? So, if the field is '5',
they it would be completed with zeroes with a result of '00005' before
insert / update.
Thanks in advance
Regards,
Santiago