[Zope] - newbie module management question

Paul Everitt Paul@digicool.com
Thu, 21 Jan 1999 15:33:14 -0500


Bruce wrote:
> Thanks for working on Open Source products, folks. Zope is impressive.

Thanks.  Wait till you see tomorrow's release for accessing objects via
ftp :^)
 
> I find myself in clueless newbie mode dispite having read 
> various documents.
> 
> I am confused regarding how to install a Python module via 
> the manager.
> I'm able to set properties of folders and I see how to 
> install an external
> method. What I'd like to do is _upload_ an entire Python 
> module, so that
> this module will be an object within my folder and will have 
> its methods
> available for use by other objects in the folder.

Zope has had a policy (which Jim Fulton and I re-discussed over lunch at
the chinese buffet yesterday) that Python code doesn't get stuffed in
the object database.

I'll leave it to him to detail the reasons.
 
> What little I have been able to acquire by looking at example 
> products is
> that the module should be put in Zope/lib/python/, working in 
> the shell and
> not the manager - it seems odd that I would not be uploading 
> the module as
> I upload documents, using your nice multi-tiered security 
> set-up. Once that
> is done, it's not clear to me how to associate that file with 
> a folder - am
> I using the installer of external methods to install one 
> "factory" method
> that brings in the rest of the module?

The quickest way to integrate Python code is External Methods:

1) Create an Extensions directory in your Zope directory.

2) Add your module there with a function that *has a docstring* !!

3) In a Zope Folder, choose External Method from the add list.

This will create a Zope object that binds your function as a method of
the folder.  Arguments are passed in and type-casted.  The object also
has all of Zope's security machinery.

To do full-fledged Products, check out Amos' fantastic tutorial:

  http://www.zope.org/Documentation/Reference/Tutorial

--Paul

Paul Everitt       Digital Creations
paul@digicool.com  540.371.6909