bug fix in memcached session handling: avoid overwriting/clearing old session data when data with another package name are stored

This commit is contained in:
Helmut Merz 2011-08-25 11:51:18 +02:00
parent 6651a1fc17
commit 0732f956c2

View file

@ -46,8 +46,14 @@ class SessionDataContainer(object):
def __setitem__(self, key, value):
client = component.getUtility(IMemcachedClient)
#print '***', key, value
client.set(value, key, lifetime=self.lifetime, ns=self.namespace)
oldValue = client.query(key, ns=self.namespace)
if oldValue:
oldValue.update(value)
newValue = oldValue
else:
newValue = value
#print '***', oldValue, value, newValue
client.set(newValue, key, lifetime=self.lifetime, ns=self.namespace)
class Session(object):