[zope] extra data for users

Harry Wilkinson harryw@nipltd.com
Wed, 24 Apr 2002 10:06:00 +0100


On Wednesday 24 April 2002 12:07 am, Ian! wrote:
> Sorry if this is a newbie question, but I'm having a hard time finding
> general advice on this. I'm really new to zope.
>
> I'm running zope, CFM and plone. I am trying to build a "secret santa"
> system, where each user will eventually be given the address and name of
> another user that they will send a gift to. This means that each user needs
> to have the additional "address" and "gives-to" fields.
>
> Can someone give a recommendation of how I should store this extra data?
> Should I extend the zope users, or should I store the data with the CFM
> member's folder (what format would this be?), or should I put it all in a
> database?
>
> Ideally I'd have the data with the zope user object, so that when someone
> deletes themself from the system I can track down their recipient and find
> the recipient a new giver. Is there an easy way to add new attributes to
> the user, and are they easily modified after the user is created?
>

If you're already using CMF, then member objects are exactly what you want.  
CMF member objects are basically just user objects in a user folder, but the 
member tools wrap them in a MemberData object which allows you to add 
properties to the member, which get stored in the ZODB.

I don't know of a good reference for CMF members; I always just look at the 
code itself to see what's there.  The 3 tools to look at for managing member 
objects are:

MembershipTool.py   (portal_membership in the ZMI)
MemberDataTool.py   (portal_memberdata in the ZMI)
RegistrationTool.py   (portal_registration in the ZMI)

These are in Products/CMFCore and Products/CMFDefault.  The MembershipTool.py 
is in both; the default tool inherits from the core tool.

Hope that's useful to you.


Harry