This is a very important question that i would like to complement.

You can use a single custom validator for any kind of parse you want to 
perform on any particular field, like this.

class process_field():
    def __init__(self, func):
        self.func = func
    def __call__(self, value):
        return (self.func(value), None)

db.define_table("people",
    Field("name", "string", length=50, 
requires=process_field(str.capitalize))
)

This passes a function to the validator (proccess_field) and outputs the 
result of the inserted value. This way you dont need to create many 
validators for each field.

I dont know what None is supposed to be, does anyone knows about it?

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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to