[Zope3-dev] Python Tab for Page Templates

Jeffrey P Shell jeffrey@cuemedia.com
Tue, 22 Apr 2003 12:38:41 -0600


On Tuesday, April 22, 2003, at 09:53  AM, Chris Withers wrote:

> Steve Alexander wrote:
>>>>> What templates do you have that use nothing but plain path 
>>>>> expressions or string expressions?
>>>>
>>>>
>>>> Almost all of them.
>>>> Adding code into templates makes for less maintainable templates.
>>>
>>>
>>> How do you build your presentation logic then?
>> Where necessary, I use a Python class that supports the page template.
>
> I'd love to see the 'python tab' for Page Templates like we discussed 
> at the Bristol sprint...
>
> What's the best way I can help to make that happen given that I 
> don'tlike writing proposals?

Write a proposal :P

Seriously - I'd like to see the need for this proposed and defended.  I 
have some Page Templates in an existing site that do use a rather 
intense "preloader" Python Script that builds all the data structures 
necessary for the page, but the page in question and the Python Code 
are kept rather separate (not in the same folder - barely even in the 
same branch of the site).  One reason that we did this is because our 
customer has access to the page templates for the main site, but we 
don't want to give him access to any application-level Python Code.

There's also this to think about (hence the need for a proposal).  If 
you put a "Python Tab" on a Page Template, what do you see when you 
edit via FTP?  When you put it on the file system (via Ape, 
synchronization, etc)?  Which code is seen where and when and why?   I 
don't want it on a tab - I seldom edit templates or code through the 
web when doing anything substantial, so it would just get in the way of 
doing FTP editing and such.

FWIW, I do this when the situation warrants::

   <tal:setup define="global extended something/that/returns/a/dict" />