Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to translate errorr messages originating from colander schemas #200

Closed
sq9mev opened this issue Nov 8, 2013 · 3 comments · Fixed by #206
Closed

Allow to translate errorr messages originating from colander schemas #200

sq9mev opened this issue Nov 8, 2013 · 3 comments · Fixed by #206

Comments

@sq9mev
Copy link

sq9mev commented Nov 8, 2013

As for now, colander's (1.0b1) Invalid.asdict method which is used in schema._validate_fields Return a dictionary containing a basic (non-language-translated) error report for this exception, additionaly there's fixed string ""%s is missing"" in this function.

If colander itself provides translations, it'd be great to have this feature in cornice as well.

What i've found is:
https://groups.google.com/forum/#!topic/pylons-discuss/f10m24zyVeo
This solution involves probably monkey patching of colander's Invalid.asdict itself, so seems to be pretty ugly.

Any hint how to achive translated colander errorr strings in cornice?

@ghost
Copy link

ghost commented Nov 8, 2013

I have this problem too. Colander documentation doesn't say much about this but my initial thought was that it was a Colander issue rather than a Cornice issue.

@sq9mev
Copy link
Author

sq9mev commented Nov 8, 2013

@amarandon not exactly, this is just how colander works: https://github.com/Pylons/colander/blob/master/colander/__init__.py#L168 , however error translatable error messages are available another way, so cornice should use them instead Invalid.asdict() method probably.

@almet
Copy link
Contributor

almet commented Nov 12, 2013

Having translated error messages would indeed be useful,

As @amarandon pointed out, I think this is a colander issue, not a cornice issue, since cornice doesn't deal with translations. If the translation is done upstream, in the asdict() method, then cornice would just pick it up.

@almet almet closed this as completed Nov 12, 2013
ghost pushed a commit to makinacorpus/cornice that referenced this issue Dec 13, 2013
ghost pushed a commit to makinacorpus/cornice that referenced this issue Dec 13, 2013
ghost pushed a commit to makinacorpus/cornice that referenced this issue Dec 13, 2013
ghost pushed a commit to makinacorpus/cornice that referenced this issue Jul 2, 2015
ghost pushed a commit to makinacorpus/cornice that referenced this issue Jan 16, 2016
ghost pushed a commit to makinacorpus/cornice that referenced this issue Jan 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants