[Zope-CMF] Re: Method Aliases on CMFSite?
yuppie
y.2005- at wcm-solutions.de
Wed Mar 23 12:00:11 EST 2005
Hi!
Jean-Francois.Doyon at CCRS.NRCan.gc.ca wrote:
> Indeed, I've noticed that. The PortalFolder class is mixed in pretty deep
> though (PortalObject).
>
> What I'd like to do is have CMFSite use something OTHER than
> "Folder"/PortalFolder however.
>
> Obviously my type would still be folderish, but I'd like to customize it
> some, and possible make both folder-ish AND content-ish.
>
> One idea would be to do something like this:
>
> Class MyCMFSite(MyType, CMFSite):
>
> Where MyType would be something like:
>
> Class MyType(PortalFolder, PortalContent):
>
> I'm not entirely sure that's safe though ... I may inadvertently overload
> something that's already overloaded, or something like that? I'll have to
> check.
If you check that you don't override something necessary for a Site, it
should be save. This might help you:
http://docs.neuroinf.de/api/cmf-api/public/CMFDefault.Portal.CMFSite-class.html
> I may even give it dublincore support. I'd simply create a portal type like
> any other, but for the sole purpose of being mixed-in and existing in the
> portal_types tool. It would never actually get constructed.
>
> Another option is to solely overload getTypeInfo() in MyCMFSite ... And have
> it return a TypeInformation() that suits my needs. This type however would
> not exist within the portal_types tool, and I'm wondering whether THAT may
> cause problems ...
This option changes the portal_type, not the really the class. So you
can't do the same things as with your first option.
If you want to do this, you have to do it in a different way.
getTypeInfo() is not always called for type specific behavior.
Just use _setPortalTypeName() to give the Site a new type name. And add
a new TypeInfo for that name.
HTH,
Yuppie
More information about the Zope-CMF
mailing list