[Checkins] SVN: Zope/trunk/ Workaround for Python expressions
encoded as unicode string.
Andreas Jung
andreas at andreas-jung.com
Wed Feb 21 05:52:28 EST 2007
Log message for revision 72741:
Workaround for Python expressions encoded as unicode string.
See http://mail.zope.org/pipermail/zope/2007-February/170537.html
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/Products/PageTemplates/ZRPythonExpr.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2007-02-21 09:05:07 UTC (rev 72740)
+++ Zope/trunk/doc/CHANGES.txt 2007-02-21 10:52:26 UTC (rev 72741)
@@ -76,13 +76,17 @@
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
Modified: Zope/trunk/lib/python/Products/PageTemplates/ZRPythonExpr.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/ZRPythonExpr.py 2007-02-21 09:05:07 UTC (rev 72740)
+++ Zope/trunk/lib/python/Products/PageTemplates/ZRPythonExpr.py 2007-02-21 10:52:26 UTC (rev 72741)
@@ -29,7 +29,13 @@
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))
More information about the Checkins
mailing list