On Aug 21, 2006, at 10:50 PM, Alberto Valverde wrote:

>
>
> On Aug 21, 2006, at 8:51 PM, Lee McFadden wrote:
>
>>
>> On 8/21/06, Jorge Godoy <[EMAIL PROTECTED]> wrote:
>>>
>>> You can change their templates today to anything written in other
>>> "presentation" system...
>
> No, unfortuantely this isn't possible yet.
>
>> I'd like to see how this works because everything that I've tried
>> causes 500 errors.  It's mainly due to the following code which will
>> prevent anything other than a kid template working with a widget.
>>
>> http://trac.turbogears.org/turbogears/browser/trunk/turbogears/
>> widgets/base.py#L226
>>
>>> You should be able to use them.  People usually use "widget.render
>>> ()" in other
>>> templating systems.
>>
>> widget.render() also uses the .display() function above.  If I  
>> want to
>> use a widget with a template in Markup it just won't work because  
>> it's
>> template is being parsed by Kid.
>>
>>> I believe that it would be the responsability of the template
>>> system to
>>> provide alternate templates to widgets...  We can't put that in
>>> the core.
>>
>> *I* believe that it's the responsibility of TurboGears to allow  
>> people
>> to choose which template language to use with their widgets ;)
>
> Yes, you're right. I'm +1 on allowing any template engine supported
> by Buffet for widgets.
>
> I guess it wouldn't be too hard to implement either. Maybe it's as
> easy as changing
> http://trac.turbogears.org/turbogears/browser/trunk/turbogears/
> widgets/base.py#L226
> to pick up the template engine's name from the widget's instance
> attribute (defaulting to 'kid') or from the template's path (like
> cheetah:templates.myform) if the template is in a separate file.
>
> I might have some time tomorrow to give it a try if you don't do it
> first... ;)

Just been playing around and noticed that we might need to resort to  
a common protocol for rendering widget output to implement this.

The problem is that display() returns an Element instance but other  
engines normally return a string. I guess that it would be a good  
idea to resort to a common protocol which should be a plain unicode  
string because all engines seem to support it (even though it's less  
efficicient at least in the kid case).

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.

Opinions?

Alberto

P.S:
Sorry if I haven't explained all this too well but I'm minutes from  
my bed and quite numb ATM ;) More tomorrow...


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