[Zope3-dev] Inline code

Paul Winkler pw_lists at slinkp.com
Tue Feb 10 16:25:09 EST 2004


On Tue, Feb 10, 2004 at 02:04:05PM -0500, Shane Hathaway wrote:
> On Tue, 10 Feb 2004, Gary Poster wrote:
> 
> > Do I understand correctly that in this scheme effectively each template 
> > page would have its own local module?
> 
> Yes.
> 
> However, I just came up with another issue.  Imagine if someone wrote the 
> following:
> 
> <script type="text/server-python">
> def getstuff():
>     return '%s' % context.stuff
> </script>
> 
> That script discreetly references the name "context".  If the name
> "context" is available, the script can't be moved painlessly to another
> module.

Erk. That's exactly the kind of impedance mismatch I was thinking of.

>  OTOH, if the name "context" is not available, the template has
> two global namespaces: one for ZPT and one for Python code.  That's not
> good.

Double-erk. I'd argue it's worse than the above mismatch.
 
> Given the choices presented, here are my votes.
> 
> 1. No inline code; rely on code in modules.  Also make it easy to write
> modules TTW.
> 
>   +1

 +1

Your #2 seems like several different things to me:

2a. Allow inline code with unified TALES & python namespaces,
and no print statements.

 -1.

 
> 2. Allow inline code with print statements.  Also unify the TALES and
> Python namespaces, making names like "context" available to inline code.  
> (The status quo.)
> 
>   -1

 -1

> 3. Allow inline code, but no print statements.  Disassociate the TALES and
> Python namespaces.  (Shane's suggestion.)
> 
>   +0

 -1

3b. Allow inline code, but no print statements, and unify the TALES
and Python namespaces ("context" et al).
(Paul's suggestion)

  +0 ... unless it could make sense for "context" to be portable
     to other TTW python code, which AFAICT would not make any
     sense for Python Libraries or persistent modules.

 
> 4. Drop ZPT and use scripts to do simple document transformation.  
> (Casey's suggestion.  Similar to XMLC.)
>   -0
> 

 -1. ZPT is not the template language for zope that should be first 
in line for being dropped ;-)
I doubt that anyone wants to rewrite all the existing ZPT
for z3 in this new paradigm.
 
For people that want to work this way, it would make a nice
add-on product.

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's PARA-WINO!
(random hero from isometric.spaceninja.com)



More information about the Zope3-dev mailing list