Wait... but what If I want to allow anything but periods? " " is actually a valid string, could the regex just use that?
If i were to remove periods, I would get really confused as to why its not working with "." But thats just me :) -Thadeus On Mon, Oct 12, 2009 at 3:33 PM, mdipierro <[email protected]> wrote: > > On Oct 12, 3:10 pm, Thadeus Burgess <[email protected]> wrote: > > Do validators get called in the order you provide them in the list? > > yes they are called in order. > > > so > > > > requires=[CLEANUP(), IS_IN_DB()] cleanup would get called before? So the > > IS_IN_DB validator will pass instead of fail on whitespace? > > My guess is that you want: > > requires=[CLEANUP(regex='.'), IS_IN_DB()] > > '.' means allows everything BUT leading and training spaces. > > > -Thadeus > > > > On Mon, Oct 12, 2009 at 2:48 PM, Guido Kollerie <[email protected]> > wrote: > > > > > On Mon, Oct 12, 2009 at 9:59 AM, Joe Barnhart <[email protected]> > > > wrote: > > > > > > +1 on the idea, but the name "dust" seems a little idiomatic, doesn't > it? > > > > > > As an aside, I discovered the absolutely fastest way to remove a set > of > > > > > Haven't worked with web2py for a many months now (this will be > > > remedied soon), but > > > something that I used to use was the following validator: > > > > > class STRIP(object): > > > """ > > > example: > > > > > INPUT(_type='text',_name='name',requires=STRIP()) > > > > > removes leading and trailing whitespace on validation > > > """ > > > > > def __init__(self): > > > pass > > > > > def __call__(self, value): > > > return (str(value).strip(), None) > > > > > Worked well and being a validator is entirely optional. > > > > > -- > > > Guido Kollerie > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

