[Zope3-dev] Some ZPT insights needed
Andreas Jung
lists at zopyx.com
Sat Jan 6 12:03:09 EST 2007
--On 6. Januar 2007 10:08:11 -0500 Stephan Richter
<srichter at cosmos.phy.tufts.edu> wrote:
>
> Yeah, there is. The "engine" does all the expression evaluation work. It
> already handles the I18n stuff, so you should be able to do your unicode
> conversions there too.
>
> The engine uses an expression context. This expression context has all
> sorts of ``evaluate*()`` methods. Most interesting to you will be the
> ``evaluateText()`` one.
>
Thanks. evaluateText() is exactly what I am looking for.
I wonder why the method
def evaluateText(self, expr):
text = self.evaluate(expr)
if text is self.getDefault() or text is None:
return text
if isinstance(text, basestring):
# text could already be something text-ish, e.g. a Message
object
return text
return unicode(text)
returns always unicode for non-strings but keeps standard Python
strings as they are. I have some ideas how make resolving UnicodeDecode
error configurable but I am not sure if this code should go into the Zope 3
or should remain in the Zope 2 core. Does Zope 3 has to deal with such
kind UnicodeDecode errors?
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20070106/e086b6c5/attachment.bin
More information about the Zope3-dev
mailing list