error_log template on Zope2 causes chameleon.exc.ExpressionError: invalid syntax

Bug #853731 reported by LeoRochael
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Chamelon ZPT
Fix Committed
Undecided
Unassigned

Bug Description

Trying to view the 'error_log' object on Zope2 (tested on Zope 2.12) results in the error (full traceback at the end):

   - Warning: Compilation failed
   - Warning: chameleon.exc.ExpressionError: invalid syntax

 - String: "len(value) < 70 and value or value[:70] + '...'"
 - Filename: manage_main
 - Location: (88:27)

It's not obvious why the template in question is broken. The lines concerned by the error have this text

    <span tal:define="value entry/value"
      tal:content="python: len(value) &lt; 70 and value or value[:70] + '...'">

Which seem properly escaped.

A test for this error has been committed to the five.pt SVN repo.

The full traceback is:

Traceback (most recent call last):
  [...]
  File "Zope2-2.12.19-py2.6-linux-x86_64.egg/Shared/DC/Scripts/Bindings.py", line 324, in __call__
    return self._bindAndExec(args, kw, None)
  File "Zope2-2.12.19-py2.6-linux-x86_64.egg/Shared/DC/Scripts/Bindings.py", line 361, in _bindAndExec
    return self._exec(bound_data, args, kw)
  File "Zope2-2.12.19-py2.6-linux-x86_64.egg/Products/PageTemplates/PageTemplateFile.py", line 130, in _exec
    return self.pt_render(extra_context=bound_names)
  File "Zope2-2.12.19-py2.6-linux-x86_64.egg/Products/PageTemplates/PageTemplate.py", line 80, in pt_render
    showtal=showtal)
  File "zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 107, in pt_render
    raise PTRuntimeError(str(self._v_errors))
   - Warning: Compilation failed
   - Warning: chameleon.exc.ExpressionError: invalid syntax

 - String: "len(value) < 70 and value or value[:70] + '...'"
 - Filename: manage_main
 - Location: (88:27)
PTRuntimeError: ['Compilation failed', u'chameleon.exc.ExpressionError: invalid syntax\n\n - String: "len(value) < 70 and value or value[:70] + \'...\'"\n - Filename: manage_main\n - Location: (88:27)']

Tags: five.pt
Revision history for this message
LeoRochael (leorochael) wrote :

sourcecodegen pinned to at least 0.6.14. This fixes the issue

Changed in chameleon.zpt:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.