thanks very much guys, but probably you missed the solution I posted about an hour ago:
strings are of type <class 'BeautifulSoup.NavigableString'> cheers Stef On 29-12-2010 22:51, Jonathan Lundell wrote: > On Dec 29, 2010, at 1:35 PM, mdipierro wrote: >> Probably it is counting >> >> data.encode('utf8', 'xmlcharrefreplace') >> >> data as self and 'utf8' as second argument. yet it is strange because >> this is valid syntax. > That occurred to me, too, but that's not what's happening. See my test > sequence: > > >>> data = u'abcd' > >>> data.encode('utf8', 'xmlcharrefreplace') > 'abcd' > >>> data.encode('utf8', 'xmlcharrefreplace', 1) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: encode() takes at most 2 arguments (3 given) > >>> isinstance(data, unicode) > True > > >> >> On Dec 29, 3:08 pm, Jonathan Lundell <jlund...@pobox.com> wrote: >>> On Dec 29, 2010, at 12:37 PM, Arun K.Rajeevan wrote: >>> >>> >>> >>>> great as far as 25 page pdf is in consideration. next time a simple text >>>> file is good enough. >>>> how the page get rendered? using generic.html or is it have a custom view >>>> file? >>>> And what's the controller returns? >>>> btw which version of web2py you are using? >>>> --------------------------------------------------------------------------------------------------------------------------------------- >>>> for others: >>>> there's these lines in trace back >>>> File "P:\Web2PY\web2py_src\web2py\gluon\html.py", line 118, in xmlescape >>>> data = data.encode('utf8', 'xmlcharrefreplace') >>>> TypeError: encode() takes at most 2 arguments (3 given) >>>> Detailed traceback description >>>> Exception: <type 'exceptions.TypeError'>(encode() takes at most 2 >>>> arguments (3 given)) >>>> Python 2.6.4: P:\Python26\python.exe >>> I looked at this briefly. It's a rather strange error message, given that >>> in fact only two arguments are given. >>> >>> I ran a little test sequence to verify: >>> >>>>>> data = u'abcd' >>>>>> data.encode('utf8', 'xmlcharrefreplace') >>> 'abcd' >>>>>> data.encode('utf8', 'xmlcharrefreplace', 1) >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> TypeError: encode() takes at most 2 arguments (3 given)>>> isinstance(data, >>> unicode) >>> >>> True >