On Oct5, 11:31pm, mdipierro <[email protected]> wrote:
>
> On Oct 5, 10:14 am, devnull <[email protected]> wrote:
> > 2. I wanted a more specific error message for each field which uses an
> > is-float-in-range validator ... But is there a way to refer to the
> > actual max and min without repeating it in the string? Something like
> > $max and $min?
>
> No, there is not. We could add it. If we do it would be %{minimum}s %
> (maximum)s. Pros/Cons?
>
It seems a good idea without cons.
Besides, this time please make the default error_message of EACH
validator easier to customize. For example,
class IS_FLOAT_IN_RANGE(Validator):
error_message = 'input between %(minimum)s and %(maximum)s'
def __init__(self, ..., error_message=None):
if error_message is None:
error_message = self.error_message
So that later we could customize the express style for all the SAME
kinds of validator, by:
IS_FLOAT_IN_RANGE.error_messsage = '''
OH NO~~, YOU MUST INPUT BETWEEN %(minimum)s AND %(maximum)s'''
db.mytable.myfield1.requires = IS_FLOAT_IN_RANGE(0,100)
db.mytable.myfield2.requires = IS_FLOAT_IN_RANGE(3,50)
...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---