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.

>From the quoted message I can see that I need to do something with the
_zclass_, propertysheets, and manage_options of my base class.  Is
this documented anywhere.  I just gave up on reading the code.

---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.  [EMAIL PROTECTED]

---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                        [EMAIL PROTECTED]     |
| Programmer/Analyst                    (831)459-2792           |
| Physical Planning & Construction      Fax:(831)423-7436       |
| UC Santa Cruz                         http:www2.ucsc.edu/ppc  |
-----------------------------------------------------------------



_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to