Commit 39b5abc8 authored by Andreas Jung's avatar Andreas Jung

Workaround for Python expressions encoded as unicode string.

See http://mail.zope.org/pipermail/zope/2007-February/170537.html
parent f558702e
......@@ -76,13 +76,17 @@ Zope Changes
Products/PageTemplates/(configure.zcml, unicodeconflictresolver.py,
interfaces.py)
- AccessControl.Role: added new method manage_getUserRolesAndPermissions().
- AccessControl.Role: added new method
manage_getUserRolesAndPermissions().
- AccessControl: the form behind the "Security" tab has a new form
for user-related reporting of permissions and roles
Bugs Fixed
- PageTemplate/ZRPythonExpr.py: expressions represented as unicode string
caused UnicodeDecodeErrors.
- PluginIndexes: Fixed 'parseIndexRequest' for false values.
- Collector #2269: fixed broken ZPT FTP support
......
......@@ -29,7 +29,13 @@ class PythonExpr(PythonExpr):
def __init__(self, name, expr, engine):
self.text = text = expr.strip().replace('\n', ' ')
code, err, warn, use = compile_restricted_eval(text, str(self))
# Unicode expression are not handled properly by RestrictedPython
# We convert the expression to UTF-8 (ajung)
if isinstance(text, unicode):
text = text.encode('utf-8')
code, err, warn, use = compile_restricted_eval(text,
self.__class__.__name__)
if err:
raise engine.getCompilerError()('Python expression error:\n%s' %
'\n'.join(err))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment