Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#7620 closed defect (fixed)

TemplateSyntaxError in /usr/lib/python2.3/site-packages/trac/templates/diff_div.html

Reported by: robin-trac@… Owned by: Remy Blank
Priority: high Milestone: 0.11.2
Component: general Version: 0.11.1
Severity: normal Keywords: python23
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

I get this error with Trac-0.11stable_r7524-1.noarch.rpm (built from svn checkout on RHEL4)

TemplateSyntaxError: invalid syntax in expression "any(item.diffs or item.props for item in changes)" of "if" directive (/usr/lib/python2.3/site-packages/trac/templates/diff_div.html, line -1)

Attachments (0)

Change History (6)

comment:1 by anonymous, 16 years ago

OK, the following patch seems to fix the issues I've run into (this is the output from svn diff)

Index: trac/templates/diff_div.html
===================================================================
--- trac/templates/diff_div.html	(revision 7525)
+++ trac/templates/diff_div.html	(working copy)
@@ -35,7 +35,7 @@
       xmlns:xi="http://www.w3.org/2001/XInclude"
       class="diff">
 
-  <ul py:if="any(item.diffs or item.props for item in changes)" class="entries">
+  <ul py:if="any([item.diffs or item.props for item in changes])" class="entries">
     <py:for each="idx, item in enumerate(changes)">
       <li py:if="item.diffs or item.props" class="entry" py:with="comments = item.get('comments')">
         <h2 id="${not no_id and 'file%s' % idx or None}" py:choose="">
Index: trac/tests/functional/better_twill.py
===================================================================
--- trac/tests/functional/better_twill.py	(revision 7525)
+++ trac/tests/functional/better_twill.py	(working copy)
@@ -82,7 +82,7 @@
                 msg.append("\n# %s\n# URL: %s\n# Line %d, column %d\n\n%s\n"
                     % (entry.message, entry.filename, 
                        entry.line, entry.column,
-                       "\n".join(each.decode('utf-8') for each in context)))
+                       "\n".join([each.decode('utf-8') for each in context])))
             return "\n".join(msg).encode('ascii', 'xmlcharrefreplace')
 
         def _validate_xhtml(func_name, *args, **kwargs):

comment:2 by robin-trac@…, 16 years ago

Just to add to my previous comment + patch, there may be additional occurrences of this syntax which will break trac on python v2.3 - I have not exhaustively searched the whole source tree, just fixed the things that I noticed broke for me.

R.

comment:3 by Christian Boos, 16 years ago

Description: modified (diff)
Keywords: python23 added
Milestone: 0.11.2
Priority: normalhigh

Just wondered where the issue in diff_div.html came from and it's r7458, so right after 0.11.1.

comment:4 by Remy Blank, 16 years ago

Owner: set to Remy Blank

Yep, that was my patch. I'm already too used to generator expressions, which have appeared in Python 2.4.

I'll fix that tonight.

comment:5 by robin-trac@…, 16 years ago

Cool, thanks.

And thanks to coderanger for pointing out the fix to me (I actually couldn't python program my way out of a wet paper bag!)

R.

comment:6 by Remy Blank, 16 years ago

Resolution: fixed
Status: newclosed

Fixed in [7526]. Thanks for the bug report.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.