-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Matthew,
I got the same problem and resolved it by changing one line (167) in ToscaWidgets-0.9.12-py2.7.egg/tw/core/view.y, in function adapt_output: < output = HTML(output) > output = HTML(output, 'utf-8') I had another Unicode problem with ToscaWidgets-0.9.12-py2.7.egg/tw/core/resources.py; had to change line 257 in construction of TRANSLATION_TABLE: < c = chr(i) > c = unicode(chr(i), 'iso-8859-1') Hope that helps. Thanks, - -- Jean-Denis Girard SysNux Systèmes Linux en Polynésie française http://www.sysnux.pf/ Tél: +689 40.50.10.40 / GSM: +689 87.79.75.27 Le 19/03/2013 08:23, Matthew Cahn a écrit : > Alessandro, > > Thanks for the reply. I modified Genshi 0.7 slightly to output what > data it's complaining about. It's actually the HTML of the FlexiGrid > itself, and not the data I'm trying to put in the grid: > > File > '/var/local/mol/pythonenv/flynerves/lib/python2.6/site-packages/Genshi-0.7-py2.6-linux-x86_64.egg/genshi/input.py', > line 337 in _generate > raise UnicodeError("source returned bytes, but no encoding specified: > %s" % data) > UnicodeError: source returned bytes, but no encoding specified: > <table id="sample-grid" style="display:none"></table> > > In a Python interpreter FlexiGrid.__str__ seems to return unicode so I'm > not sure why this error is happening. It also seems as though, if the > Genshi encoding were set, this error wouldn't happen, but it's not clear > to me where to set it. Setting the encoding in the grid's template > doesn't help, nor does setting genshi.default_encoding. And that may > not be the best approach to fixing this -- I'm not sure what the right > way is. For now it's back to Genshi 0.6. > > Matthew > > > > On Tue, Mar 19, 2013 at 11:25 AM, Alessandro Molina > <[email protected] <mailto:[email protected]>> wrote: > > Quick answer, I'll double check the issue later. > > Genshi 0.7 changed the way templates encoding is managed, now all > template are unicode by default. TurboGears already used genshi that > way, so controllers that directly render a genshi template will > continue to work without a change. > > The issue is that ToscaWidgets has its own rendering engine, so it > might be that it is not using the genshi template as expected by > genshi itself, I have to check this, but you probably want to make > sure that all the variables you pass to the widget to display are > unicode strings and not str/bytes. > > > On Mon, Mar 18, 2013 at 9:59 PM, MHCPU <[email protected] > <mailto:[email protected]>> wrote: > > With Genshi 0.7, one of my controller methods, which displays a > FlexiGrid, gives this error: > > UnicodeError: source returned bytes, but no encoding specified. > > but with Genshi 0.6, it works. Genshi 0.7 appears to give this > error for any non-unicode data passing through it. (See Genshi's > input.py, line 337). I'm not sure why my other controller > methods work. > > Matthew > > -- > You received this message because you are subscribed to the > Google Groups "TurboGears" group. > To unsubscribe from this group and stop receiving emails from > it, send an email to [email protected] > <mailto:turbogears%[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/turbogears?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to the Google > Groups "TurboGears" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to [email protected] > <mailto:turbogears%[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/turbogears?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to the Google > Groups "TurboGears" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/turbogears?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAlRVdhwACgkQuu7Rv+oOo/gmbQCfRNaIClN+qCbD8JD3DhZM2DrS aHoAoJmfwi3G+ecePoOLl/vHJfCVafW8 =o+TE -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/turbogears. For more options, visit https://groups.google.com/d/optout.

