#2390: Displaying nested TG widgets from Genshi templates may give Internal
Error
------------------------+---------------------------------------------------
Reporter: chrisz | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 1.1.x bugfix
Component: TurboGears | Version: 1.1
Severity: normal | Keywords: genshi kid widgets
------------------------+---------------------------------------------------
The problem can be reproduced with the following widgets:
{{{
from turbogears import widgets
class MyForm(widgets.TableForm):
fields = [widgets.TextField(name='text')]
class MySuperForm(widgets.Widget):
template = """<div>${subform()} and more</div>"""
params = ['subform']
def subform(self):
return MyForm()
}}}
If you display `MySuperForm()` from a Kid template, everything works fine.
But if you display it from a Genshi template, the following error appears:
{{{
File "<string>", line 32, in _pull
File ".../kid/parser.py", line 180, in _track
ev, item = p
ValueError: too many values to unpack
}}}
The cause for this error seems to be a hack that was introduced with
ticket #1355 for automatically wrapping transformed Kid widgets in an
`ET()` call so that they can be displayed in Genshi templates - otherwise
the `ET()` call must be coded into the Genshi template. This hack (in
`turbogears.widgets.base.Widget.display`) checks the nesting level of the
widget and applies the `ET()` call only at the top level for the Genshi
engine. However, in cases like the one above the determination of the
nesting level fails; it works only for compound input widgets.
--
Ticket URL: <http://trac.turbogears.org/ticket/2390>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---