That is why we need "Stop pollution, protect the environment!"  :-)

On Jul 23, 5:16am, 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, 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

Reply via email to