On Mar 22, 2007, at 12:34 AM, iain duncan wrote:
>
>
>>>
>>> Given that kid demands valid xhtml, is there any reason not to have
>>> the
>>> widgets default to format xhtml?
>>
>> TG widgets use the same view engine as normal page templates in TG
>> use so any options you pass it via the config file will affect both
>> widgets and page templates (this is not the same in TW which uses
>> it's own engines wich can be configured independently)
>>
>> Anyway, using render in kid templates is not a good idea.
>> Widget.display returns an Element tree that can be embedded directly
>> in a kid template. When you render a widget you're serializing that
>> element tree and then, by passing it through XML, parsing it into
>> another element tree.
>>
>> The render method is only really needed when you want to place a
>> widget in a "string" template (cheetah, mako, etc...) or to view the
>> markup in an interactive interpreter for debugging.
>
> What about returning a rendered widget for an ajax call? Is that a bad
> idea too?
Not at all, I do it all the time :)
> It seemed silly to make a widget template, and a normal
> template, just to send the widget to a dom element.
You don't need a "normal" template then, just return what "render"
spits instead of a dict from your controller:
@expose()
def mymethod(self, ...):
return a_widget.render(...)
Alberto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---