[CMF-checkins] CVS: CMF/CMFCore - MemberDataTool.py:1.23
Florent Guillaume
fg@nuxeo.com
Fri, 14 Mar 2003 11:35:35 -0500
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv24908
Modified Files:
MemberDataTool.py
Log Message:
Clean temporaries at the end of the request when wrapping users,
otherwise they may provide wrong defaults later (Collector #136).
For reference, the problem was:
- user foo is created and is wrapped -> _v_temps contains foo
- member foo is deleted
- user foo is re-created, then wrapped
-> an old MemberData in _v_temps is found and used
=> stale values are used for properties
-> it is not reregistered for storage in _members
=> any call to setMemberProperties is lost in an instance
that is not in _members.
=== CMF/CMFCore/MemberDataTool.py 1.22 => 1.23 ===
--- CMF/CMFCore/MemberDataTool.py:1.22 Thu Feb 13 02:44:07 2003
+++ CMF/CMFCore/MemberDataTool.py Fri Mar 14 11:35:35 2003
@@ -159,6 +159,7 @@
m = MemberData(base, id)
if temps is None:
self._v_temps = {id:m}
+ self.REQUEST._hold(CleanupTemp(self))
else:
temps[id] = m
else:
@@ -178,6 +179,14 @@
self._members[id] = m
InitializeClass(MemberDataTool)
+
+
+class CleanupTemp:
+ """Used to cleanup _v_temps at the end of the request."""
+ def __init__(self, tool):
+ self._tool = tool
+ def __del__(self):
+ del self._tool._v_temps
class MemberData (SimpleItem):