[Zope3-dev] PythonScript in Zope3?
Barry Pederson
bp@barryp.org
Tue, 18 Feb 2003 13:15:36 -0600
Godefroid Chapelle wrote:
> Zope 3 won't have Python Scripts...
>
> but will have something better : persistent Python Modules...
>
> with full fledged classes for example.
>
> They have to be instantiated in what is currently called the Service
> Manager (which will be renamed Site Manager - or Site Manangement). This
> is the place where software (ie logic) is supposed to be, opposed to
> content space which is represented by the navigation tree in the current
> GUI.
OK, let me ask a bit more...to help figure out how this is used...
In Zope2, I can do something like create a folder named "/foo", and inside
that folder place a PythonScript named "index_html". When a browser
requests "/foo", it gets back the output of the script.
(That's kind of a contrived example, I would envision also having some ZPTs
in "/foo" that the script can use to format data, but I'll keep it simple
to begin with)
How would you achieve a similar result in Zope3?
* Do you still create a folder named "/foo"?
* Do you turn on the "local service manager" for "/foo", navigate
down to "packages/default", and add a "Module" - which I see has
a creation form asking for "absolute module name and source code"?
* What would be an appropriate absolute module name? Just a single
word like "mymod"? or something dot-separated like "mystuff.mymod"
* Can the sourcecode be as simple as: "print 'hello world'", or does
there need to be a function defined.
* What URL would you use to see the output of the script? I tried
some of the obvious guesses like:
/foo/++etc++Services/Packages/default/mymod
but I get a NotFound error
* How do you arrange it so the output from this script is
what's displayed when "/foo" is requested? Is it some
combination of a "view service" in the package, or a "view"
in the package configuration?
Recipes for how to do simple (in Zope2, but totally non-intuitive in Zope3)
things like this would be a great thing to see in the wiki documentation
(such as it is).
Barry