[Zope-CMF] How to Override CMFDefault Content Class Methods?

Yuppie schubbe@web.de
Mon, 15 Jul 2002 13:07:36 +0200


Hi!

 >>What I want to do, is to customize the behavior of existing CMFDefault
 >>content items, without - touching the CMF Product - converting
 >>existing content objects to items of a new subclass

J C Lawrence wrote:
 > Write a HotFix?

Good idea. But there is one problem left I don't know how to solve with 
a hotfix:

I need the functionality of the OrderedFolder product inside my CMF Site.
So far I use a quick and dirty hack of PortalFolder:

<code>
   - from OFS.Folder import Folder
   + from Products.OrderedFolder.OrderedFolder import OrderedFolder
   - class PortalFolder( Folder, DynamicType ):
   + class PortalFolder( OrderedFolder, DynamicType ):
</code>

It works pretty well, but I want to clean up my CMF installation.

I think the recommended way would be creating a subclass like

<code>
   class MyPortalFolder( OrderedFolder, PortalFolder ): pass
</code>

But that raises a lot of new problems:

1. The CMF portal root is a subclass of PortalFolder. I want to have the 
new functionality also inside the CMF portal root.

2. I would have to convert all my existing PortalFolders to MyPortalFolders.

3. Using ftp/WebDAV, how would I make sure that new folders are 
MyPortalFolders?

Is there a way to solve this with a hotfix? I just can override methods, 
not complete classes. Right? And I can't inherit all methods of an other 
class. So writing a hotfix, I have to explicitly add each method I want 
to use of another class?

Tres Seaver wrote:
> Skins allow you to add new "actions" (ZPT, DTML Methods, PythonScripts,
> External Methods) to the site;  these "methodish" items can be
> associated with particular content types by way of the "Actions" tab
> of the 'portal_types' tool.  No conversions required, but you may need
> to be fairly clever in implementing these skin methods to ensure that
> they work cleanly for both "old" and "new" instances.

I'm afraid my question was not specific enough. What you propose is 
useful for changing the behavior of the skin. But in a case like 
described above, where also ZMI, ftp and WebDAV are involved, skinning 
is not the solution. Or am I wrong?

Thanks for your help so far!

	Yuppie