[Zope] Adding a PyScript file from Python
Alec Mitchell
apm13 at columbia.edu
Fri Mar 26 11:26:11 EST 2004
On Friday 26 March 2004 04:29 am, AP Meyer wrote:
> Dear Zopers
>
> Is it possible to add a PythonScript from a file-system-based Python
> program? Some things are too complicated for ZPT, but related to the
> presentation (e.g., writing a cookie with preferences). Therefore, they
> do not belong in the Python objects, either. A Python Script seems to be
> the ideal place, but I want to write the script off-line and add it
> programmatically (not via the ZMI). How is this done?
Add something like this to a product method:
self.manage_addProduct['PythonScripts'].manage_addPythonScript('script_id')
body ="""## Script (Python) "script_name"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=info
##title=
##
return something
"""
self.script_id.write(body)
Alec Mitchell
More information about the Zope
mailing list