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

Sigve Tjora sigve@tjora.no
Mon, 23 Apr 2001 15:44:53 +0200 (CEST)


> 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..."

Shane:
> In the member data tool, add a property called "myData".  Then change
> the code above to:
>
> portal_registration.setProperties(myData="some special preference")

I want to store a plain python dictionary, and not just for the
authenticated user.

If I just store the dictionary in the user object, eg.

user=portal_membership.getAutehnticatedUser()
user.myData={"id1":"data1", "id2":"data2"}

If I do it this way, the userobject "looses" this property when I restart
Zope. Why is that? How can I store basic python-objects within the
userobject?

mvh Sigve Tjora