[Zope-dev] product import question

Eric Roby vekn@bellsouth.net
Mon, 10 Mar 2003 19:39:12 -0600


We have developed a zope product that works (as expected) as a standalone -
call it prodA.  We have another product that simply exposes a number of
utility container objects that when created,  provide certain functions at
different levels.  They also  restrict meta_types at each level.  Call this
prodB.  A fully developing prodB might look something like this:

resourceStore
----resourceFolder
--------datasourceFolder
------------dbFolder

I attempted to restrict the meta_types in the class that is represented by
dbFolder to just prodA.  In order to gain access to the prodA add form, I
had to import the prodA module into the prodB module and make the assignment
in the class that is represented by dbFolder.  At this point the single
factory method was exposed in the dbFolder as expected.  Unfortuantely, the
constructor for prodA (action of the prodA add form) could not be found.
With numerous tweakings and source searching I settled on duplicating the
constructor function for prodA in the class that is represented by dbFolder.
Now it works.

The question I have... is this the right way to do this??  I attempted to do
a 'from prodA-module import prodA-constructor-function' and that didn't
help.  I tried a number of other incantations to no avail.  The interesting
thing (for me) was that if I did not restrict meta_types in dbFolder and
just used the default factory-method list (of which prodA was one) I could
create prodA without importing anything from the prodA module.

I know I am being dense here but the obvious alludes me here.  Any
enlightenment would be much appreciated...

TIA

Eric