From 9494356134023e9dfaceb55cc539d0caaec95311 Mon Sep 17 00:00:00 2001 From: Richard Murri Date: Wed, 21 Sep 2011 14:47:18 -0600 Subject: [PATCH] Fix Invalid.asdict for multiple error messages. Using All returns a list of error messages. It is not safe to assume then that exc.msg returns a single string. --- colander/__init__.py | 2 +- colander/tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/colander/__init__.py b/colander/__init__.py index a900afff..34bf7ae7 100644 --- a/colander/__init__.py +++ b/colander/__init__.py @@ -147,7 +147,7 @@ def asdict(self): keyparts = [] msgs = [] for exc in path: - exc.msg and msgs.append(exc.msg) + exc.msg and msgs.extend(exc.messages()) keyname = exc._keyname() keyname and keyparts.append(keyname) errors['.'.join(keyparts)] = '; '.join(interpolate(msgs)) diff --git a/colander/tests.py b/colander/tests.py index daf2e6e1..847993bf 100644 --- a/colander/tests.py +++ b/colander/tests.py @@ -81,7 +81,7 @@ def test_asdict(self): exc1.pos = 1 exc2 = self._makeOne(node2, 'exc2') exc3 = self._makeOne(node3, 'exc3') - exc4 = self._makeOne(node4, 'exc4') + exc4 = self._makeOne(node4, ['exc4']) exc1.add(exc2, 2) exc2.add(exc3, 3) exc1.add(exc4, 4)