Daniel Nouri
unread,Jul 30, 2010, 10:09:28 AM7/30/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ish.io
Rendering the description in ``formish/templates/mako/formish/field/
description.html`` uses this Python code:
filters.html_escape(unicode(field.description))
At this point, ``field.description`` is not of type unicode, but of
type ``RenderableObjectWrapper``. Due to the lack of a
``__unicode__`` method on that class that delegates to
self.__subject__, calling ``unicode(field.description)`` will result
in the equivalent of ``str(field.description.__subject__)``, which
raises ``UnicodeEncodeError`` for any fields that have non-ascii
characters.
To reproduce this error, use a unicode description with non-ascii
characters in any of your form fields' descriptions. A possible
solution would be to include a ``__unicode__`` method on
``RenderableObjectWrapper`` that looks like this:
def __unicode__(self):
return unicode(self.__subject__)
--
Daniel Nouri