Opened 17 years ago
Closed 17 years ago
#7620 closed defect (fixed)
TemplateSyntaxError in /usr/lib/python2.3/site-packages/trac/templates/diff_div.html
| Reported by: | 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 )
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 , 17 years ago
comment:2 by , 17 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 , 17 years ago
| Description: | modified (diff) |
|---|---|
| Keywords: | python23 added |
| Milestone: | → 0.11.2 |
| Priority: | normal → high |
comment:4 by , 17 years ago
| Owner: | set to |
|---|
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 , 17 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 , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Fixed in [7526]. Thanks for the bug report.



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):