[Zope3-dev] Python scripts?

Paul Winkler pw_lists@slinkp.com
Mon, 12 May 2003 06:56:03 -0400


On Mon, May 12, 2003 at 10:24:54AM -0400, Jim Fulton wrote:
> - Port Zope 2 Python scripts
> 
>   * without the bindings tab
> 
>   * without context, script, namespace, and subpath variables.
>     (not sure about script)

why do we lose context and subpath?
are these no longer useful when implicit acquisition goes away?
 
>   Maybe these should be renamed "Python functions", since they aren't really
>   methods.

yeah i never liked the "script" name either, i find it hard to explain
to people new to Zope. 

> - Provide more of a module-like object. This would be a persistent
>   module that lived in content space. It would not be importable, but
>   would be accessable via traversal as in:
> 
>     tal:content="container/somemodule/somefunction"

this sounds nice.

> - Provide Python scripts
> 
>   These would be written as scripts.  They would not be able to
>   return anything. They would output via print.  They would get input
>   via import.  Frankly, I'm not crazy about this, but I mention it for
>   completeness.

blech :)

> - Provide the ability to define Python functions as part of ZPT, DTML,
>   and SQL Script definitions. This would appear as an extra tab on
>   these objects containing Python source.
> 
>   There are three things I don't like about this approach:
> 
>   * It complicates the UI for ZPT, DTML, and SQL scripts.
>     In particular, it complicated the file-system representation.
>
>   * It doesn't help in situations where code is to be reused among
>     multiple templates,

that alone is a critical problem with this approach IMHO.
Think of all the little "helper" Python Scripts in Zope 2 CMF skins.
They're often used by multiple templates.
would we be forced to implement these as part of filesystem products? Blah,
you lose the nice simple "customize" feature that CMF provides.

Also, how would you refer to these functions? Would there be a namespace
that clearly indicated where they live?  I hope so, let's not have any
more magic namespaces like zope 2 dtml.

>   * It closely ties ZPT, DTML, and SQL scripts to Python. I'd love,
>     someday, to be able to support other scripting languages
>     (e.g. perl)

eek! :)

-- 

Paul Winkler
home:  http://www.slinkp.com
"Muppet Labs, where the future is made - today!"