good catch. Thanks for letting us know.
On Jul 22, 4:16 pm, marcelielapointe <[email protected]> wrote: > I finally find the problem!! > > I am doing some import in a models, in particular: > > from pylab import * > > if I comment this line everything works fine.... > > So It's look like it's not a good idea to import module in model or > only not doing: from module import * > > ....... > > On Jul 22, 5:03 pm, marcelielapointe <[email protected]> > wrote: > > > If I try something like: > > > print type(TH) > > > it prints: > > > <class 'dateutil.rrule.weekday'> > > > where it could have been defined??? > > > On Jul 22, 4:53 pm, marcelielapointe <[email protected]> > > wrote: > > > > I think I find something.. > > > > in dateutil/rrule.py "MO", "TU", "WE", "TH", "FR", "SA", "SU" are > > > define. If I replace TH with either of them, the same ticket is > > > issued. If I replace TH with another random string like TW or > > > something else I got: > > > > NameError: global name 'Tdsd' is not defined > > > > so it seems that rrule overwrite the definition of TH of web2py, I > > > don't know how this works and why this happen only in a particular > > > app.. > > > > If someone has a hint..? > > > > thanks > > > > On Jul 22, 2:22 pm, marcelielapointe <[email protected]> > > > wrote: > > > > > no, I don't use id, I use a string. > > > > > I create a new application and everything works fine. So the problem > > > > comes from my app, but where does it comes from? I create a test > > > > controller: > > > > > # coding: utf8 > > > > # try something like > > > > def index(): > > > > table = TABLE(TR(TH('1'),TH('2')),TR(TD('un'),TD('deux'))) > > > > return dict(table=table) > > > > > with his view: > > > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > > > <html xmlns="http://www.w3.org/1999/xhtml" > > > > xml:lang="{{=T.accepted_language or 'fr'}}"> > > > > <head> > > > > <meta http-equiv="Content-Type" content="text/html; > > > > charset=UTF-8" /> > > > > </head> > > > > <body> > > > > > {{=table}} > > > > > </body> > > > > <html> > > > > > and there is the ticket a a little bit different: > > > > > 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/meteocode2/views/testTable/ > > > > index.html", line 4, in <module> > > > > <meta http-equiv="Content-Type" content="text/html; > > > > charset=UTF-8" /> > > > > 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 "/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 > > > > > Could the problem comes from my models or modules, I repeat, I tried > > > > this controller/view in a fresh new app and it worked fine. The same > > > > controller/view in my app send this ticket... > > > > > ??? > > > > > On Jul 22, 11:40 am, mdipierro <[email protected]> wrote: > > > > > > 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

