[Zope] Re: external methods
Mitchell L Model
mlm@acm.org
Wed, 17 Oct 2001 16:48:47 -0400
--- "Arenz, Ralph" <Ralph.Arenz@f...> wrote:
> Hi,
>
> i' am using external methods to do something on the filesystem.So i
> make an external method for the entry-function. This works fine,so far.
> The module which is containing the function imports
> several other modules which i placed in <zope>/lib/python>
> directory.
>
> My problem is that changes to imported modules takes no effect.
> What have i to do to tell Zope that the imported modules has changed ?
>
> A simple buttonclick in the Zope manage screen won't do.
> Equally, compiling the imported method to bytecode takes no effect.
>
> Changes in the function or module which is connected
> via "external method" to zope are approved after a buttonclick
> on "edit" in zope.
>
Are you developing a Product? (That is, do you put code in a
subdirectory of <zope>/lib/python/Product? If yes, just put your
Python modules in the Extensions subdirectory of your Product
directory, along with files defining your external methods. (Note
that you can have more than one external method in a file.) Then,
create an __init__.py file in the Extensions subdirectory of your
Product. (I think you have to include __doc__ and __version__
strings in the __init__.py, but I'm not sure.) Finally, in
__init__.py import all the files in the directory. (I think that
makes Zope aware of them for purposes of updating.)
I've found that with a setup like that, updating my product from the
Control Panel updates all the Python modules and external methods in
my product's Extensions directory. It even works with the automatic
update feature you can turn on for your product in the Control
Panel's item for your product.