Glad to know this undocumented convention. Now I understand better why
Massimo is not eager to do validators' i18n in a class-attribute,
because it tends to mislead developers to further adjust them and then
possibly affect other apps. :-)

On Oct30, 11:31am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> There is a reason for UPPERCASE. All the web2py API that are defined
> outside the thread are uppercase. Those defined in the thread are
> lowercase. This means you should treat the uppercase ones as constants
> and not change class attributes or your app will affect other apps.
>
> Massimo
>
> On Oct 29, 9:42 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
>
>
> > I love web2py, but I hate the convention of all uppercase separated
> > with commas in validators.  It's like hitting a speed bump when you're
> > doing 80. I am experimenting with converting them to camelcase in my
> > model and it seems to work fine.
>
> > def camelcase_validators():
> >     from gluon.validators import __all__ as all_validators
> >     cmd = ";".join([ ''.join([a.lower().capitalize() for a in v.split
> > ("_")]) + "=" + v for v in all_validators])
> >     return cmd
>
> > exec(camelcase_validators())
>
> > My questions:
> > 1) Is there a better way?
> > 2) Is exec really that bad?
>
> > I know it's a silly venture, but indulge me :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to