[Zope3-dev] Re: Python Tab for Page Templates

Jeffrey P Shell jeffrey@cuemedia.com
Wed, 23 Apr 2003 08:55:31 -0600


On Wednesday, April 23, 2003, at 02:10  AM, Chris Withers wrote:

>> 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?
>
> In an ideal world, you'd see a folder with the name of your template. 
> In that would be a 'zpt' file and a 'python' file... This would work 
> for the other file-like scenarios you mention.

That doesn't sound ideal to me.  Well, it might sound ideal to me, but 
it wouldn't sound nearly as ideal to our designer.  He just wants to 
upload 'specials.html', I want to add in the necessary TAL statements, 
and then he wants to be able to tweak and modify the layout.  He'd 
probably settle for dealing with 'specials.html/zpt.html', but I think 
it's a step back from the happy place we're in now where he can modify 
the site with little impact on the dynamic parts of pages in a manner 
that's comfortable to him.

This is why I don't want to see this built in as a default.

I don't think it's necessarily a bad idea - WebObjects has done this 
since time began.  A page like 'Main.wo' is a directory containing 
often three files:  'Main.html', the template; 'Main.wod', the 
bindings; and (in older versions anyways), 'Main.wos', associated 
scripting code.  (there's often a .woo file now too which declares the 
WebObjects version the page/component was made with).  Apple's 
developer tools, and versions of Adobe GoLive up until version 5, knew 
specifically how to deal with these files.  In GoLive, for example, you 
did get an extra tab up at the top of the page to switch to the WOD 
source.

ASP.NET pages no longer encourage in-page scripting, but they do allow 
you to write event handlers for the page (such as an 'OnLoad' event 
handler).  This is put in the source of the page, but tools like Web 
Matrix (a free ASP.NET editor from Microsoft) present the layout, HTML 
Source, and extra source, as all separate tabs.  But again - this puts 
the onus on having a good tool already written that can intelligently 
deal with this type of situation.

Since Page Templates were written so that (potentially) any semi 
intelligent HTML editing tool could deal with them without requiring 
knowledge of TAL and so that designers could work with a templated site 
more easily than the DTML solution (and we've had *great* success with 
this), the 'python tab' seems to fly in the face of that design 
decision somewhat.  That's why I'd like to see a proposal.  This is the 
first I've heard of this up until now.

Maybe I'm just getting too out of touch with how different things will 
be with Zope 3.  :\


>> FWIW, I do this when the situation warrants::
>>   <tal:setup define="global extended something/that/returns/a/dict" />
>
> Indeed, but where does your something come from? Unless you have 
> reasons like yours above, you'd probably want it to come from 
> somewhere near your page template. A tab seemed like a nice idea to us 
> at the UK sprint...

The Zope 2 solution would be to use a folder, use an 'index_html' (or 
default renderer, if you can figure out how to enable that sneaky 
little Zope 2.6 feature) to render the page template (or have it be the 
page template)