[Zope] Python Base Classes, ZObjectManager, and Subobjects

Ross Patterson rossp@ppc.ucsc.edu
Sun, 27 Jan 2002 14:30:55 -0800 (PST)


I'm transitioning a product from pure ZClasses to a hybrid product python base
classes and ZClasses.  So this is my first time working with python
products.

I'm trying to setup a python base class to provide a central place to
subclass ZObjectManager and CatalogAware that I can rebase later
without the ZClass hassle.  But when I try to create a ZClass in the
product and subclass to one of my python base classes, I don't get the
subobjects tab in my ZClass.

Clearly I'm missing somthing basic here, but I have scoured the docs
and mailing lists for a clue before coming here.  BTW, I did find this
post earlier that no one seemed to reply to, and below that are my
actual python files.

---quoted message---

I want to create a Python base class that inherits from the
ObjectManager and has the "Subobjects" tab in the ZClass management
screen.  Inheriting from OFS.ObjectManager.ObjectManager does not do
this - I need to inherit from ZClasses.ObjectManager.ObjectManager.

I still don't know how to have the Subobjects propertysheet thing
work.  I've tried the two ways I listed in my last email of doing
this, but I can't get it to work.

One way was:

class MyObjectManager(ZClasses.ObjectManager.ObjectManager):
    " .... "

class ZMyObjectManager:
    """Mix-in for Object Management
    """

    _zclass_=myObjectManager

    propertysheets=ZClasses.ObjectManager.ZObjectManagerPropertySheets()

    manage_options=(
        {'label': 'Subobjects', 'action'
:'propertysheets/subobjects/manage'},
)

and then register ZMyObjectManager as a base class in __init__.py.
The other way was:

class MyObjectManager(ZClasses.ObjectManager.ObjectManager):
    propertysheets=ZClasses.ObjectManager.ZObjectManagerPropertySheets()

    manage_options=(
        {'label': 'Subobjects', 'action'
:'propertysheets/subobjects/manage'},
)

and register that as the base class.  Neither of them work.

-- 
Itamar S.T.  itamars@ibm.net

---end quoted message---


#!/usr/bin/python
# __init__.py

from ZClasses import createZClassForBase

from PartBase import PartBase
from SitePartBase import SitePartBase
from ProjectPartBase import ProjectPartBase

def initialize( context ) :
	createZClassForBase( PartBase, globals(), 'ZCPPartBase' )
	createZClassForBase( SitePartBase, globals(), 'ZCPSitePartBase' )
	createZClassForBase( ProjectPartBase, globals(), 'ZCPProjectPartBase' )

#!/usr/bin/python
# PartBases.py

from ZClasses.ObjectManager import ZObjectManager
from Products.ZCatalog.CatalogAwareness import CatalogAware

class PartBases ( CatalogAware, ZObjectManager ) :
	"""
	Base Classes for all ZCP Parts
	"""

#!/usr/bin/python
# PartBase.py

from PartBases import PartBases

class PartBase ( PartBases ) :
	"""
	Base Class for ZCP Parts
	"""

#!/usr/bin/python
# Products/ZCapitalProjects/SitePartBases.py

from PartBases import PartBases

class SitePartBase ( PartBases ) :
	"""
	Base Class for ZCP Site Parts
	"""

#!/usr/bin/python
# Products/ZCapitalProjects/ProjectPartBases.py

from PartBases import PartBases

class ProjectPartBase ( PartBases ) :
	"""
	Base Class for ZCP Project Parts
	"""

-----------------------------------------------------------------
| Ross Patterson			rossp@cats.ucsc.edu	|
| Programmer/Analyst			(831)459-2792		|
| Physical Planning & Construction	Fax:(831)423-7436	|
| UC Santa Cruz				http:www2.ucsc.edu/ppc	|
-----------------------------------------------------------------