PersistentMapping not persistent?
hey there, I've been trying to get around a problem in my zope 2.4.2 persistentMapping. I've built the zodb auth source of exIserFolder.. it basically uses a PersistentMapping to store all the user accounts, passwords and roles. Everything works fine, but then I noticed passwords getting reset when zope restarts (or just on a long non-activity period) I create a user, set his password and roles.. everything goes ok.. I change his password to something different.. and it works.. but then I restart zope, and his password gets resetted to the old one. now if I use a self.data={} instead of self.data=PersistentMapping() and then add a self._p_changed=1 on every method that updates the self.data everything works as expected, so here goes the question: is PersistentMapping fscked up on 2.4.2 or does it still need something similar to self._p_changed=1 to commit all the transactions back into zodb ? any hints, I could fix this by NOT using PersistentMapping, but since that's what User.py uses, I thought it was going to be a good way to do it.... please.. help :P Alex
alex@quad.com.ar wrote:
is PersistentMapping fscked up on 2.4.2 or does it still need something similar to self._p_changed=1 to commit all the transactions back into zodb ?
I suspect it's rather something that you are doing that is fscked up ;-) Perhaps you can explain what you're putting in self.data and we can see what's going on... cheers, Chris PS: For _lots_ of users, use an OOBTree instead of a PersistentMapping
ok, here's a simplified view of my object __init__(self): self.data=PersistentMapping() createUser(self,user,password,roles=[]): self.data[username]={'username': username, 'password': password, 'roles': roles} updateUser(self,username,password, roles): self.data[username]['roles']=roles if password: self.data[username]['password']=password there's a lot more on the object as you would guess, but that's the relevant code to my problem. both create and update works.. but after updating a user password and/or roles the changes only last for a while, and as I said, if I replace all this with a self.data={} and signaling with self._p_changed then everything works fine. can you see any potential problem in that code? Thanks for the help Alex ----- Original Message ----- From: "Chris Withers" <chrisw@nipltd.com> To: <alex@quad.com.ar> Cc: <zope@zope.org> Sent: Wednesday, November 07, 2001 10:34 AM Subject: Re: [Zope] PersistentMapping not persistent?
alex@quad.com.ar wrote:
is PersistentMapping fscked up on 2.4.2 or does it still need something similar to self._p_changed=1 to commit all the transactions back into
zodb ?
I suspect it's rather something that you are doing that is fscked up ;-)
Perhaps you can explain what you're putting in self.data and we can see what's going on...
cheers,
Chris
PS: For _lots_ of users, use an OOBTree instead of a PersistentMapping
* alex@quad.com.ar <alex@quad.com.ar> [011107 18:57]:
ok, here's a simplified view of my object
__init__(self): self.data=PersistentMapping()
createUser(self,user,password,roles=[]): self.data[username]={'username': username, 'password': password, 'roles': roles}
can you see any potential problem in that code?
It looks to me like your problem is that self.data is a PersistentMapping, but self.data[username] isn't. Have you tried:
createUser(self,user,password,roles=[]): self.data[username]=PersisentMapping() self.data[username].update({'username': username, 'password': password, 'roles':roles})
seb.
participants (3)
-
alex@quad.com.ar -
Chris Withers -
seb bacon