Since the two functions are subsets of IS_ALPHANUMERIC(), I'd suggest that the sub-functions be named:
IS_ALPHA() and IS_NUMERIC() On Aug 28, 2:56 pm, Jonathan Lundell <[email protected]> wrote: > On Aug 28, 2011, at 11:23 AM, Saurabh Sawant wrote: > > > They seem fine. Although, having ready to use validators would save > > some time for those learning the framework. I personally expected > > those validators to be already there while I was learning. > > Trouble is, there's an endless list of pattern expressions that can be > useful. IS_MATCH is pretty powerful, and should be in your bag of tricks (in > fact, IS_ALPHANUMERIC just calls IS_MATCH). > > At the very least, consider that you might want a language-dependent > IS_LETTERS, or at least one that accepts the common alphabetic variants. > > However, if you do that, do it this way: > > IS_MATCH('[0-9]+', strict=True) > IS_MATCH('[a-zA-Z]+', strict=True) > > strict=True forces a $ at the end of the regex. Or you can just include the > $. (IS_MATCH is already anchored at the beginning of the string.) > > > > > > > > > > > On Aug 28, 11:05 pm, Massimo Di Pierro <[email protected]> > > wrote: > >> what's wrong with? > > >> IS_MATCH('[0-9]+') > >> IS_MATCH('[a-zA-Z]+') > > >> On Aug 28, 12:59 pm, Saurabh Sawant <[email protected]> wrote: > > >>> But IS_ALPHANUMERIC by virtue of its name suggests both letters and > >>> numbers. Having separate validators for each of the cases would make > >>> the code more readable. > > >>> db.auth_user.first_name.requires=IS_LETTERS() > >>> db.auth_user.age.requires=IS_DIGITS()

