On Aug 22, 2006, at 3:37 AM, Kevin Dangoor wrote:

>
> On Aug 21, 2006, at 5:50 PM, Alberto Valverde wrote:
>
>> This means either "display" or "render" should get deprecated (my
>> vote goes for display) and both methods return a string via the
>> engine's "render" method.
>
> Neither should be deprecated, really. display is an optimization for
> Kid, because it avoids a roundtrip between XML string and elements.
> (If someone demonstrates that there's no performance impact, I'd be
> happy to deprecate then).

You're right. I thought about this just after sending that nonsense  
after thinking how widgets with templates in different languages  
would interact when mixed together. If "display" always returned a  
string widgets would always need to be XML escaped in Kid templates  
which wouldn't be very API friendly... (note to myself: avoid posting  
crap just before going to bed ;) )

> We can make widgets a bit smarter, though. display() could confirm
> that the widget template is in Kid and, if not, call render() and
> convert to elements. Additionally, someone who *knows* they're not
> using Kid can just call render() directly from their template.

Hmmm... After giving it more thought I think we can get away by  
reimplementing "Widget.render" to use the engine's "render" (always  
returning a string), generalize the way the template gets loaded  
(using the engine's "load_template" instead of  
"meta.load_kid_template") and making the widget smarter like you just  
suggested so widgets with different types of engines can be mixed  
freely.

> (...)
>
> Experimentation with making other template tools work with widgets
> should stick to the trunk.

This shouldn't be too hard and seems fun... I'm definitely going to  
give this a try later today on trunk...  :)

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to