[ZPT] Making ZPT usuable outside Zope

Chris Withers chris at simplistix.co.uk
Sat Aug 21 02:54:30 EDT 2004


Hi All,

As most of you probably know, Richard uses ZPT for Roundup outside Zope.
He had to make some changes to make this possible.
I think that's a shame, since I know one of the design goals for ZPT was 
to make them usuable outside Zope.

I'm proposing to merge as many of Richard's changes as possible, so I 
guess it's time to strike up a discussion on the ZPT list.

I'll leave it to Richard to decide if this discussion should also be 
CC'ed to the Roundup list...

Firstly, here are the changes Richard made:

Richard Jones wrote:
>>>Unfortunately, there's parts of if which use acquisition. Those bits
>>>needed to be rewritten (trivially, sigh). I also had to rip out the
>>>Zope-specific stuff like the content meta_type implementations.

> I have comments at the top of the four modified files:
> 
> TALES.py
>   1. changed imports to import from roundup.cgi
>   2. implemented ustr as str (removes import from DocumentTemplate)
>   3. removed import and use of Unauthorized from zExceptions
> 
> PageTemplate.py
>   1. changed imports to import from roundup.cgi
>   2. removed use of ExtensionClass
>   3. removed use of ComputedAttribute
> 
> Expressions.py
>   1. removed all Zope-specific code (doesn't even try to import that
>      stuff now)
>   2. removed all Acquisition
>   3. removed blocking of leading-underscore URL components
> 
> PythonExpr.py
>   1. more informative traceback info
> 
> Some of these changes are necessary (PageTemplate.py changing the macros to 
> not use ComputedAttribute, explicitly importing from roundup.cgi, imports 
> from Acquisition) and some are not as necessary (some of the code removed 
> from Expressions.py) but make things cleaner.

Can anyone see any problems with any of these changes?

> Also, as I mentioned, some files were removed too, as it didn't make sense to 
> distribute them with Roundup (ZopePageTemplate.py, www/, help/, etc).

Would you have a problem leaving them in if a "StandaloneZPT" emerged?

Finally, what changes have been made for Zope 3?

My goal here is a ZPT implementation that works in Zope 2, Zope 3 and 
outside of Zope. I think that would benefit everyone :-)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the ZPT mailing list