Modify ↓
Opened 12 years ago
Closed 12 years ago
#10814 closed defect (fixed)
TypeError: 'int' object is not iterable
Reported by: | Owned by: | Ryan J Ollos | |
---|---|---|---|
Priority: | normal | Component: | WikiTableMacro |
Severity: | blocker | Keywords: | |
Cc: | Trac Release: | 0.10 |
Description
TypeError: 'int' object is not iterable
Sample Wiki markup:
{{{ #!SQLTable SELECT count(id) as 'Number of Tickets' FROM ticket }}}
Error produced when count of Tickets > 0
Trac 1.0, Windows 7 (x64), Python 2.7.x (x86)
Attachments (0)
Change History (6)
comment:1 Changed 12 years ago by
comment:3 Changed 12 years ago by
I have the exact same error on Trac v1.0 running on Gentoo Linux and python 2.7
comment:4 Changed 12 years ago by
Reproduced. The stacktrace is here.
... File "/home/jun66j5/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 343, in _macro_processor text) File "/home/jun66j5/src/trac/trac-hacks/wikitablemacro/trunk/wikitable/table.py", line 68, in expand_macro format_to_html(self.env, formatter.context, col) File "/home/jun66j5/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1546, in format_to_html return HtmlFormatter(env, context, wikidom).generate(escape_newlines) File "/home/jun66j5/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1501, in generate escape_newlines) File "/home/jun66j5/venv/trac/1.0.1/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1237, in format for line in text: TypeError: 'int' object is not iterable
The 3rd argument, wikidom
, of format_to_html
expects a instance of str
, unicode
or iterable.
-
wikitable/table.py
16 16 from trac.wiki.formatter import system_message, format_to_html 17 17 from trac.wiki.macros import WikiMacroBase 18 18 from trac.util.html import Markup 19 from trac.util.text import exception_to_unicode19 from trac.util.text import to_unicode, exception_to_unicode 20 20 from trac.util.translation import _ 21 21 22 22 class SQLTable(WikiMacroBase): … … 64 64 css_class = (idx % 2 == 0) and 'odd' or 'even' 65 65 print >> out, " <tr class='%s'>" % css_class 66 66 for col in row: 67 if col is None: 68 col = "''(NULL)''" 69 elif col is True: 70 col = 'TRUE' 71 elif col is False: 72 col = 'FALSE' 73 elif not isinstance(col, basestring): 74 col = to_unicode(col) 67 75 print >> out, "<td>%s</td>" % \ 68 76 format_to_html(self.env, formatter.context, col) 69 77 print >> out, " </tr>"
comment:5 Changed 12 years ago by
Thank you for the patch Jun. I'll test and apply it.
I don't have a lot of interest in this macro, so if someone else wants to take over maintenance I'm more than willing to hand it over.
Note: See
TracTickets for help on using
tickets.
I'm not sure if it will be relevant, but what DB are you using?