On 30 sep, 21:28, mdipierro <[email protected]> wrote:
> db.table.myField.requires=IS_LENGTH(20)
> to have it validated.
>

if I have the following:

db.define_table('mytable',
    Field('myfield', length=10),
)

and I introduce a string of length greater than 10 the validator is
enabled.

But on the following:

db.define_table('mytable',
    Field('myfield', length=10),
)
db.mytable.myfield.requires = IS_NOT_EMPTY()

length validator is lost. In postgres fails. In sqlite no warning.

The solution is:
db.mytable.myfield.requires = [IS_NOT_EMPTY(), IS_LENGTH(maxsize=10)]

What disadvantages are there in truncate the string in this situation?

Jose

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to