[Zope-CMF] Porting of normal zope product to cmf

Jeffrey P Shell jeffrey@cuemedia.com
Mon, 17 Sep 2001 10:34:03 -0600


No, the CMF does not have its own ObjectManager.  It does have its 
own Folder classes (PortalFolder, SkinnedFolder).  Sometimes, 
however, it's useful to subclass from object manager and never be a 
folder (as is the case of a project I'm working on right now).  In 
those cases, it's very important to get the inheritance right.  I 
had done::

class Thing(PortalContent, ObjectManager, ...):
    ...

which caused _setObject to work fine, but caused 
objectValues/objectIds/etc NOT to work (PortalContent defines its 
own objectValues that returns an empty tuple).  Changing the 
inheritance order to::

class Thing(ObjectManager, PortalContent, ...):
    ...

has worked fine with no adverse side effects (at least, not that 
i've seen yet).

Jeffrey P Shell, http://www.cuemedia.com/

> From: Gitte Wange <gitte@mmmanager.org>
> Subject: [Zope-CMF] Porting of normal zope product to cmf
>
> Hello,
>
> I am trying to port an old Zope Product (a Shop product) to CMF.
> In the old product there is a function that creates an order and 
> it would be
> useful to also have this function in the new product :-)
>
> To create the order object these lines of code are used (in my cmf 
> product
> taken from the original product) :
> ob = ShopOrder(id)
> self._setObject(id, ob)
> ob = getattr(self, id)
> ob._initialize(credit_details, order_details, personal_details)
> order = getattr(self, id)
>
> But I get an error in line 2 - the self._setObject() call
> The error is
> Error Type: AttributeError
> Error Value: _setObject
>
> and the last lines of the traceback is:
> File
> /usr/local/Zope-2.4.0-linux2-x86/lib/python/Products/MMMShop/ShopManager.
> py,
> line 141, in createOrder
>     (Object: DynamicType)
> AttributeError: (see above)
>
> I guess it's because the old object inhereted ObjectManager and 
> mine doesn't
> ... but doesn't CMF has it's own ObjectManager module ???
>
> My question is then:
> Should I call something else than _.setObject and if true: What 
> should I call
> then in order to create the order object and get hold of it again ?
>
> TIA,
> Gitte Wange