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

Shane Hathaway shane@digicool.com
Fri, 20 Apr 2001 11:14:19 -0400


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