diff --git a/CHANGES.txt b/CHANGES.txt index 63f1b89..abdecff 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -7,6 +7,12 @@ Bug Fixes - Un-break wrapping of callable instances as ``colander.deferred``. See https://github.com/Pylons/colander/issues/141. +Features +~~~~~~~~ + +- Allow localization of error messages returned by ``colander.Invalid.asdict`` + by adding an optional ``translate`` callable argument. + 1.0b1 (2013-09-01) ------------------ diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index a1cf78f..065840e 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -114,3 +114,4 @@ Contributors - Brian Sutherland, 2013/08/16 - Peter Lamut, 2013/08/16 - Veeti Paananen, 2013/08/20 +- Alex Marandon, 2013/12/21 diff --git a/colander/__init__.py b/colander/__init__.py index f1d2f00..a68913b 100644 --- a/colander/__init__.py +++ b/colander/__init__.py @@ -167,7 +167,12 @@ class Invalid(Exception): def asdict(self, translate=None): """ Return a dictionary containing a basic - (non-language-translated) error report for this exception""" + (non-language-translated) error report for this exception. + + If ``translate`` is supplied, it must be a callable taking a + translation string as its sole argument and returning a localized, + interpolated string. + """ paths = self.paths() errors = {} for path in paths: