[Zope-dev] RE: Curious Problem

Sean Duffy swduffy@unmc.edu
Tue, 29 Apr 2003 11:34:21 -0500


Thanks to Chris & Guido I have something that works.

A quick recap:

Learned that:

1. Pickling a class involves a 'locatable' class definition on both the
pickling and unpickling operations.

2. Where to move it?  Ended up in site-packages, named the package folder
and module the same thing and discovered the true meaning of from {package}
import {module}.

3. Zope external modules only see the code involved in the specified call,
so calling a module with an internal class definition ( that works in
python ) will fail as an external method because zope ignores it.  Resolved
the problem by importing the package/module/class from site-packages, which
enables zope's external methods to locate the class.

Next question:

At Chris's suggestion I'd like to move the code from the external method to
the site-package, leaving just a stub for the external methods.

Same problem all over again.  Zope sees the functions in the modules, but
not the class defined in the module.  Tried a quick experiment, created a
separate file for the code in the site-package, and imported the class from
the adjacent file.  Zope
still can't see it.

So before I start flailing about I thought I'd see if anyone else has
experienced a similar situation, and how they resolved it.  I can see a
possible solution in creating two 'site-packages', one for the code and one
for the class. But that's just a guess, and it lacks a certain elegance!

Je ne sais quoi,

Sean