Yes but.

This is my I normally do:

not_empty=IS_NOT_EMPTY(error_message=T('doh!'))

db.table.field1.requires=not_empty
db.table.field2.requires=not_empty

so no problem with DRY.

My objection in the thread was not on your idea in principle but on
the fact that T does not exist until the app is called. I would not
know how to pass T to the validators without a mechanism of hidden
hooks and I would rather avoid that.
Perhaps you can propose a specific possible implementation that I have
not thought of.

We should also consider that IF T had been hard coded in validators
now the proposed change in error messages would not be backward
compatible since it would break translations.


Massimo

On Oct 21, 12:03 pm, Iceberg <iceb...@21cn.com> wrote:
> It is a little bit surprising and happy to see these error_message
> draw enough attention. :-)  So is it time to also consider my proposal
> more than one month before?  
> http://groups.google.com/group/web2py/browse_frm/thread/8cbe658406be595f
>
> That way, we don't even have to adjust the default error_message to
> please everyone. Instead we provide a good way to customize the
> error_message whenever wanted.
>
> What do you think?
>
> On Oct21, 5:17am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > OK. I will take the patch.
>
> > On Oct 20, 3:38 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
>
> > > On Oct 20, 2009, at 12:04 PM, Yarko Tymciurak wrote:
>
> > > > "integer" is fine and appropriate, and not at all "techie" - if you  
> > > > went to grade school in the US, you would understand "integer"  
> > > > perfectly.  I expect the same would be true of any translation of  
> > > > the same.
>
> > > I don't have a strong feeling on the question, though I'm not sure  
> > > that my mother could define 'integer', and she graduated from high  
> > > school (quite some time ago). FWIW, 'whole number' is perfectly good  
> > > English (and lower grade level than 'integer'; notice that it's the  
> > > dictionary definition of 'integer').
>
> > > More generally, I was looking at the validation error messages, and  
> > > have some suggestions. I'll generate a patch if you like. Here's the  
> > > (sorted) list:
>
> > > cannot be empty!
> > > input a number between %(min)s and %(max)s
> > > input an integer between %(min)s and %(max)s
> > > invalid email!
> > > invalid expression!
> > > invalid expression!
> > > invalid filename or extension!
> > > invalid image!
> > > invalid IPv4 address!
> > > invalid length!
> > > invalid url!
> > > invalid url!
> > > invalid url!
> > > must be alphanumeric!
> > > must be HH:MM:SS!
> > > must be YYYY-MM-DD HH:MM:SS!
> > > must be YYYY-MM-DD!
> > > value already in database!
> > > value not allowed!
> > > value not in database!
>
> > > Comments:
>
> > > 1. If it were up to me, I'd remove all the exclamation marks; there's  
> > > no need to be excited about a mis-entry; we're just providing  
> > > information.
>
> > > 2. IS_LENGTH should perhaps give the use the same range info that the  
> > > number-range messages do.
>
> > > 3. 'enter a number' rather than 'input a number'.
>
> > > 4. In general, 'enter <something>' is more helpful and friendly than  
> > > 'invalid <whatever>'. It's not possible in every case, but in many  
> > > cases we could do it. Example: 'enter a valid email address'.
>
> > > > On Tue, Oct 20, 2009 at 12:59 PM, mdipierro  
> > > > <mdipie...@cs.depaul.edu> wrote:
>
> > > > You may be right but to me "whole number" does not sound good. Anyway,
> > > > one can use internationalization to fix this.
>
> > > > I wish like there are "en-en", "en-us", there were "en-us-tech" and
> > > > "en-us-non-tech". (Perhaps I should patent this!)
>
> > > > Massimo
>
> > > > On Oct 20, 12:38 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> > > > > On Oct 20, 2009, at 10:34 AM, mdipierro wrote:
>
> > > > > > ok.
>
> > > > > My intuitive sense is that more users are likely to understand  
> > > > "whole
> > > > > number" than "integer". We all take the meaning of integer for
> > > > > granted, but I wonder whether it isn't a little on the technical  
> > > > side
> > > > > for my Aunt Polly.
>
> > > > > > On Oct 20, 12:19 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> > > > > >> On Oct 20, 2009, at 10:16 AM, mdipierro wrote:
>
> > > > > >>> I think "integer number" is the proper way but I am not a native
> > > > > >>> english speaker. Any english speaker can help us on this?
>
> > > > > >> Here's the (Oxford American) dictionary entry:
>
> > > > > >> integer |ˈɪntədʒər|
> > > > > >> noun
> > > > > >> 1 a whole number; a number that is not a fraction.
--~--~---------~--~----~------------~-------~--~----~
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