[Zope-dev] Patching Zope Products Question

Ulrich Eck lists@net-labs.de
Wed, 11 Jul 2001 13:27:19 +0200


> Ulrich Eck wrote:
> > 
> > I'm not shure however, what format this should be distributed .. for unix a 
> > CMF-ZPatterns-Patch
> > would probably be best .. other plattforms do not have this .. any comments ??
> 
> Make it into a Product that patches the CMF classes at runtime.
> 
> See Zope Hotfixes fot a template to work from.
> 


I have for example this modification of PortalContent:

## added for ZPatterns
from Products.ZPatterns.DataSkins import DataSkin

## changed for ZPatterns
class PortalContent(DataSkin, DynamicType, SimpleItem):
    """
        Base class for portal objects.
  """
.....

so I need to completely replace the 
Products.CMFCore.PortalContent.PortalContent
with a new class defined (mainly copied from original)
 in the __init__ of the Patch?

can I do this with:
--
import Products.CMFCore.PortalContent

<<define myclass here >>

InitializeClass(<<myclass>>)
Products.CMFCore.PortalContent.PortalContent = <<myclass>>
--

Is it the same to replace a class  in a module than replacing 
a method/attribute in a Class ??

thanks

Ulrich Eck