[Zope] Newbie: Location of External method files

Passin, Tom tpassin@mitretek.org
Thu, 29 May 2003 11:59:15 -0400


[Vern T Takebayashi]

> A related question I have is about how Zope looks for=20
> external methods.
> It seems that Zope looks along a certain path, in a way that=20
> is different
> from normal acquisition traversal.  i.e. you cannot simply locate the
> external method in a parent folder and expect Zope to find=20
> it.  If someone
> could explain how Zope searches for the external methods, I would
> appreciate this greatly.
>=20

Zope looks for External Methods in the Extensions directory.  Different
developers could create enternal methods with the same names as long as
they were in different __Zope__ folders (I mean the Zope objects, not
the code for them in the Extensions directory in the file system), and
if their Python code were in different python files in the Extensions
directory.

It is good practice, IMHO, to use the code in the Extensions directory
only to invoke the actual Python code that does the real work.  That
code should live, I think, outside the Zope directory tree.  That way
you do not have to remember to copy it to any new Zope installation.

For the function in the Extensions directory to find the real code, the
real code needs to be on the Python path, preferably in its own package.
There are many ways to get your code on the Python path.  I personally
like to use *.pth files, but there are several other methods.  The main
point to remember is that you need it to be on the Python path used by
your Zope installation, not the Python path used by any other Python
interpreters you may have on your system.  This has bitten people from
time to time.

Cheers,

Tom P