--On 6. Januar 2007 10:08:11 -0500 Stephan Richter <[EMAIL PROTECTED]> 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?


Attachment: pgpVB5RJdUkWj.pgp
Description: PGP signature

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to