colander: TypeError in Exception when using multiple validators

136 views
Skip to first unread message

Dirk Makowski

unread,
Aug 15, 2011, 6:39:29 PM8/15/11
to pylons-...@googlegroups.com
Hi all,

in a colander schema I have a field with two validators:

    , 'email': {
        'type': String()
        , 'title': 'Email'
        , 'validator': All(
              Length(min=1, max=128)
              , Email()
          )
    }

As a test, I supply deserialize() with an invalid email address and wanted to get the error messages:
    try:
        d_out = sch.deserialize(d_in)
        print d_out
    except Invalid as exc:
        print exc

Then this error occurs:

Traceback (most recent call last):
  File "pym/dd/usrmgr.py", line 212, in <module>
    print exc
  File "/home/dm/myprojects/Pyramid-1.1/lib/python2.7/site-packages/colander/__init__.py", line 159, in __str__
    return pprint.pformat(self.asdict())
  File "/home/dm/myprojects/Pyramid-1.1/lib/python2.7/site-packages/colander/__init__.py", line 153, in asdict
    errors['.'.join(keyparts)] = '; '.join(interpolate(msgs))
TypeError: sequence item 0: expected string, list found

It's colander 0.9.3.

Is that a mistake in colander's code or did I misuse the All() validator?

Kind regards, Dirk
Reply all
Reply to author
Forward
0 new messages