[Zope-CMF] DBMS back-end for CMF?

Tres Seaver tseaver@zope.com
17 Apr 2002 22:14:29 -0400


On Wed, 2002-04-17 at 21:08, Jeffrey P Shell wrote:
> On 4/17/02 4:45 PM, "Tres Seaver" <tseaver@zope.com> wrote:
> 
> > 
> > Yes.  The CMF's "tools" are intended to be replaceable;  in your case,
> > you want to replace the 'portal_memberdata' tool with one which reads
> > and writes member properties via SQL.  The interface for the tool is
> > defined in:
> > 
> > http://cvs.zope.org/CMF/CMFCore/interfaces/portal_memberdata.py
> > 
> 
> That seems woefully small, compared to all of the code that's in the default
> Memberdata tool.  I remember trying to monkey around with doing custom
> memberdata a couple of months back, and getting scared off.  I had a
> situation where contacts could be turned into members, and I was trying to
> keep the existing contact data (an object in the ZODB) as the memberdata.
> The default tool was complex enough and the interface small enough that I
> had a hard time figuring out what the real interdependencies were, and had
> to give up to deal with other pressing concerns.
> 
> So, are the Memberdata interface requirements really as simple as
> interfaces/portal_memberdata.py r1.4, or does this interface have to be
> updated?

The interface describes three methods:

  'wrapUser'

  'getMemberdataContents'

  'pruneMemberdataContents'

The only real dependency on the 'portal_memberdata' tool is in the
CMFCore/MembershipTool:

 $ pwd                                                              
 /home/tseaver/projects/CMF
 [/home/tseaver/projects/CMF] 
 $ find . -type "f" | xargs grep -l portal_memberdata | grep -v pyc 
 ./HISTORY.txt
 ./CMFCore/dtml/explainMemberDataTool.dtml
 ./CMFCore/MemberDataTool.py
 ./CMFCore/MembershipTool.py
 ./CMFCore/interfaces/CVS/Entries
 ./CMFCore/interfaces/portal_memberdata.py
 ./CMFDefault/Extensions/migrate_ptk.py
 
The 'portal_membership' tool actually uses only two methods of the
memberdata tool:

  'wrapUser' -- Take a "bare" user object; return a wrapped object,
    which implements the Member interface.

  'searchMemberDataContents' -- A fairly ugly hack, to allow for
    membership tools which can't cleanly enumerate all members
    (e.g., the LDAP-based ones) to perform minimal searching. This
    method is *not* in the interface, but should be.

The other two methods in the interface aren't used anywhere, and should
be removed (the methods are only used by the ZMI of the tool itself).

The 'Member' interface (defined in CMFCore/interfaces/Membership.py)
is in *much* greater need of updating:  the tool's 'wrapUser' method
has to return objects which implement it, but the interface is
completely inadequate (it isn't even an interface!)  The dependencies
on 'portal_membership.getAuthenticatedMember' are much larger than
those on the tool.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com