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]> 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]> 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].
>> 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.
>>
>>
>>
>
> --
> 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.
>
>
>
--
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.