I cannot reproduce the problem with this:
TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
It is possible that instead of a constant number you have the problem
when you pass a record id? Mind that a record id is not an int, it
only looks like an int. You have to do TH(str(id))
On Jul 22, 9:58 am, marcelielapointe <[email protected]>
wrote:
> Hi,
>
> I'm having problem producing a table with HTML helpers.. here is the
> code:
>
> table = TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
> return dict(table=table)
>
> The problem is with TH('1'), if I put a number in TH there is no
> problem but I want to put a string. Here is the ticket:
>
> Traceback (most recent call last):
> File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> restricted
> exec ccode in environment
> File "/home/lapomarc/web2py/applications/meteocode/views/list_table/
> main.html", line 60, in <module>
> File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
> self.body.write(xmlescape(data))
> File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> data = str(data)
> File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> return self.xml()
> File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> (fa, co) = self._xml()
> File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> self.components])
> File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> data = str(data)
> File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> return self.xml()
> File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> (fa, co) = self._xml()
> File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> self.components])
> File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> data = str(data)
> File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> return self.xml()
> File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> (fa, co) = self._xml()
> File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> self.components])
> File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> data = str(data)
> File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> return self.xml()
> File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> (fa, co) = self._xml()
> File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> self.components])
> File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> data = str(data)
> File "/usr/lib/pymodules/python2.6/dateutil/rrule.py", line 78, in
> __repr__
> return "%s(%+d)" % (s, self.n)
> TypeError: %d format: a number is required, not str
>
> That error doesn't show if I replace '1' by a number. It is very
> strange that str(data) is making a call to rrule.py of dateutil. It is
> like if my data was a date???
>
> If I put only numbers in TH it replace TH(1) by <td>+1</td>
>
> Also this problem does not appear with TD.
>
> I'm lost!??
>
> Marc-Élie