[Zope-CMF] modifying default user creation

seb bacon seb@jamkit.com
Tue, 19 Jun 2001 15:19:41 +0100


* Cyrille Giquello <cyrille@ktaland.com> [010619 13:48]:
> After parsed files from CMF,
> I can see :
> 
> CMFCore/MembershipTool.py
>     class MembershipTool :
> 
> CMFDefault/MembershipTool.py
>     import Products.CMFCore.MembershipTool
>     class MembershipTool :
> 
> So, perhaps I can overload CMFDefault to customize CMF Behavior.
> Perhaps it's the good way ?

CMFDefault/MembershipTool subclasses CMFCore/MembershipTool.  The Core
MembershipTool is more or less an interface with some default
implementations, which the CMFDefault version extends / implements.
If your MembershipTool will have mostly the same functionality as the
CMFDefault one, subclass that.  If it will have mostly different
functionality, you can subclass the Core version.

In your case, you will probably want to subclass the Default version,
and only override one method.

> If it is, how can I do ?

I think I remember someone putting a howto up, but I can't remember,
and I need to get on with my work...but have a look :)

  from Products.CMFDefault.MembershipTool import MembershipTool
  class MembershipTool(MembershipTool):
    # etc

Will start you off.  You can only add one tool of each type to a Site,
so you'll have to work out how to replace the existing tool with your
own.  Look in Portal.py, at how it sets up each tool in turn.  If you
register your tool in __init__.py, you will be able to add it TTW, as
long as there isn't another portal_membership already instatiated.

> Because, at first, there is the add product 'CMFSite' to overload or replacing ?
> Then, in CMFCore and CMFCalendar there are call to CMFDefault.method() ...

There shouldn't be anything in the Core which refers to Default - if
there is, it should probably be filed in the Tracker.  OTOH, you can
think of CMFCalendar as an example of how to create new content
types.  It is created in the context of CMFDefault, and uses some of
its methods.

cheers,

seb