Re: [Zope-dev] Patching Zope Products .. next Question
> Would this approach be appropriate? > > http://dev.zope.org/Members/Caseman/Dynamic_HotFix_News/Dynamic_Hotfix > > > You can hotpatch the __bases__ attribute of the derived class. > > ok .. I tried several different versions of patching .. 1st Try: Created a new class in the patch that subclassed the ZPatterns-Stuff directly: ### CMFCore.PortalFolder ### import CMFCore class PortalFolder( CustomizerFolder, CMFCore.PortalFolder.PortalFolder): """ Implements portal content management, but not UI details. """ meta_type = 'Portal Folder' portal_type = 'Folder' def __init__( self, id, title='' ): CustomizerFolder.__init__(self,id) self.id = id self.title = title CMFCore.PortalFolder.PortalFolder = PortalFolder InitializeClass(CMFCore.PortalFolder.PortalFolder) This works fine except the DataSkin-derived classes don't show up in the CustomizerFolder for customization (they're not properly initialized) 2nd Try: modify __bases__ directly .. ### CMFCore.PortalFolder ### def PortalFolder__init__( self, id, title='' ): CustomizerFolder.__init__(self,id) self.id = id self.title = title import Products.CMFCore.PortalFolder Products.CMFCore.PortalFolder.PortalFolder.__bases__ = tuple((CustomizerFolder,) + Products.CMFCore.PortalFolder.PortalFolder.__bases__) # the next line works only if i use the im_func # otherwise i get this error: # Error Type: TypeError # Error Value: unbound Python method must be called with PlugInContainer 1st argument Products.CMFCore.PortalFolder.PortalFolder.__init__ = PortalFolder__init__.im_func InitializeClass(Products.CMFCore.PortalFolder.PortalFolder) this one doesn't do anything ... do you see the failure .. have a hint what I'm doing wrong ??? thanks for your patience Ulrich Eck net-labs ___ 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 )
Re: [Zope-dev] Patching Zope Products .. next Question
Would this approach be appropriate? http://dev.zope.org/Members/Caseman/Dynamic_HotFix_News/Dynamic_Hotfix > From: "Ulrich Eck" <[EMAIL PROTECTED]> > Date: Wed, 11 Jul 2001 19:33:15 +0200 > To: "ZOPE-DEV Mailingliste" <[EMAIL PROTECTED]> > Subject: [Zope-dev] Patching Zope Products .. next Question > >> can I do this with: >> -- >> import Products.CMFCore.PortalContent >> >> <> >> >> InitializeClass(<>) >> Products.CMFCore.PortalContent.PortalContent = <> >> -- > > ok this works but there is another tricky thing now ... > > I need to patch two products: CMFCore and CMFDefault. > > first i patch CMFCore and I think this works (at least a portalfolder > is a customizerfolder :) > > I have now 2 new Classes PortalFolder and PortalContent .. > > but > > the CMFDefault.Document for example is still subclassed from > CMFCore.PortalContent (the default) and therefore doesn't behave > like a dataskin .. > > any ideas ? > > is the order in wich the modules are loaded known or changeable ?? > > if this doesn't work .. I need to release the patches as diffs or tarballs > replacing CMFDefault and Core .. not as nice as just patching them .. > > thanks > > Ulrich Eck > > > ___ > 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 ) ___ 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 )
Re: [Zope-dev] Patching Zope Products .. next Question
On Wed, 11 Jul 2001, Ulrich Eck wrote: > the CMFDefault.Document for example is still subclassed from > CMFCore.PortalContent (the default) and therefore doesn't behave > like a dataskin .. > > any ideas ? You can hotpatch the __bases__ attribute of the derived class. --RDM ___ 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 )
[Zope-dev] Patching Zope Products .. next Question
> can I do this with: > -- > import Products.CMFCore.PortalContent > > <> > > InitializeClass(<>) > Products.CMFCore.PortalContent.PortalContent = <> > -- ok this works but there is another tricky thing now ... I need to patch two products: CMFCore and CMFDefault. first i patch CMFCore and I think this works (at least a portalfolder is a customizerfolder :) I have now 2 new Classes PortalFolder and PortalContent .. but the CMFDefault.Document for example is still subclassed from CMFCore.PortalContent (the default) and therefore doesn't behave like a dataskin .. any ideas ? is the order in wich the modules are loaded known or changeable ?? if this doesn't work .. I need to release the patches as diffs or tarballs replacing CMFDefault and Core .. not as nice as just patching them .. thanks Ulrich Eck ___ 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 )