Message argument to validators #64

Closed
domenkozar opened this Issue Sep 23, 2012 · 3 comments

Projects

None yet

4 participants

Member

See http://docs.pylonsproject.org/projects/colander/en/latest/api.html#validators

Currently some require msg and some message. Would be nice to go for one and deprecate the other.

Member
kiorky commented Sep 24, 2012

Yep; i agree.

Problem is that it will break existing schemas.

@Pylons/deform-colander-developers @mcdonc your word ?

Owner
mcdonc commented Sep 24, 2012

To the extent this bothers somebody, I'd make Function accept both "message" and "msg" and prefer "msg" but fall back to "message" in its constructor, I guess. If "message" is passed, issue a deprecation warning. e.g.:

class Function(object):
    def __init__(function, msg=None, message=None):
        self.function = function
        if msg is None and message is None:
            msg = _('Invalid value')
        elif message is not None:
             # print deprecation warning
             msg = message
        self.message = msg

Or whatever.

Contributor

This was fixed in #31, but did not provide the fallback or deprecation notice.

@claytron claytron added a commit to claytron/colander that referenced this issue Aug 16, 2013
@claytron claytron add `message` back to `Function` and emit warning
fixes #64
6bade28
@mcdonc mcdonc closed this in #127 Aug 16, 2013
@claytron claytron added a commit to claytron/colander that referenced this issue Aug 17, 2013
@claytron claytron Raise an error if both msg and message are passed in. refs #64 63616a9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment