[Zope3-dev] Re: Python scripts?

Jim Fulton jim@zope.com
Mon, 12 May 2003 11:18:27 -0400


Chris Withers wrote:
> Jim Fulton wrote:
> 
>> I see a number of alternatives:
>>
>> - Port Zope 2 Python scripts
>>
>>   * without the bindings tab
>>
>>   * without context, script, namespace, and subpath variables.
>>     (not sure about script)
>>
>>   Maybe these should be renamed "Python functions", since they aren't 
>> really
>>   methods.
> 
> 
> This is probably me favourite right now, especially the rename...
> 
>> - 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"
> 
> 
> ....unless; This would be great if it had python semantics.
> ie: on import, the code in the module is executed.

Note that these would not be importable from elsewhere.  When they
are updated, they would get executed. The execution semantics would
be the same as with normal Python modules.  The only difference is
that there is a fix-up step to turn objects like functions and
classes into persistent functions and classes.


> However, what would happen to output from that execution?

Not sure what you mean. The output of the execution would be a
persistent module.

If you are refering to print, that goes to standard output, which is
not so good.

Zope should probably do something special with standard error and standard
output. What it does should probably configurable.

Jim