[Zope-CMF] Saving custom data in a MemberData-object from python

Phil Dodderidge pdodde@poyntz.com
Fri, 20 Apr 2001 15:59:27 +0000


I got it now.  I had misread what you wrote and thought you had written
portal_membership.setProperties(myData="some special preference").  I also had it
stuck in my mind that portal_registration was only used for creating members.

I have a site where some members will be able to set properties (and passwords) for
other members.  Is there a reason that the core Registration Tool only has a
function to set properties on the authenticated user?  I know that I can get around
this but is it something that should be added to the interface?

Thanks,

Phil

Shane Hathaway wrote:

> Phil Dodderidge wrote:
> >
> > Shane Hathaway wrote:
> >
> > > Sigve Tjora wrote:
> > > >
> > > > Hi!
> > > >
> > > > I want to save some data about users in their MemberData-object, and I use
> > > > python for the task. Is it ok just to set a propertie on an
> > > > MemberData-object or is there a better way?
> > > >
> > > > Eg. can I just write
> > > >   user=portal_membership.getAuthenticatedUser()
> > > >   user.myData="Just an object or a text..."
> > >
> > > In the member data tool, add a property called "myData".  Then change
> > > the code above to:
> > >
> > > portal_registration.setProperties(myData="some special preference")
> >
> > Is this last line right?  I thought that the setProperties function was in the
> > MemberData class.
>
> The method in the portal_memberdata tool is private.  It is supposed to
> be invoked only by portal_registration.setProperties() because
> portal_registration can enforce member property policies.
>
> The reasoning behind this is that portal_memberdata, which only the
> portal_membership tool is supposed to know about, can be ripped out and
> replaced by something else that provides member properties (such as
> LoginManager or whatever acts as acl_users.)
>
> Shane