[ckan-dev] __repr__ encoding

Dominik Moritz dominik.moritz at okfn.org
Sat Mar 16 18:28:13 UTC 2013


Hey,

We came across a unicode error in with the history pages in jinja[1]. As you can see in the traceback, the issue occurs in the debug code where we at some point in pprint.pformat repr is called on a PackageTag with unicode characters in it. The server doesn't like that and crashes. The right solution, imho, is to return a UTF-8 encoded string from __repr__. However, there are more places in CKAN, where we don't return an encoded string. How do you see this? Should we change all __repr__ methods in CKAN, is it just a problem in the case of PackageTag or am I holding it wrong[2]?

Cheers,
Dominik

[1] https://github.com/okfn/ckan/pull/567#issuecomment-14505913
[2] http://cdn.memegenerator.net/instances/400x/34146170.jpg



More information about the ckan-dev mailing list