[Checkins] SVN: mongopersist/trunk/ - Bug: When an object has a SimpleContainer as attribute, then simply loading
Stephen Richter
cvs-admin at zope.org
Fri Mar 9 21:33:42 UTC 2012
Log message for revision 124547:
- Bug: When an object has a SimpleContainer as attribute, then simply loading
this object would cause it to written at the end of the transaction. The
culprit was a persistent dictionary containing the SimpleContainer
state. This dictionary got modified during state load and caused it to be
registered as a changed object and it was marked as a ``_p_mongo_sub_object``
and had the original object as ``_p_mongo_doc_object``.
Get ready for release.
Changed:
U mongopersist/trunk/CHANGES.txt
U mongopersist/trunk/setup.py
U mongopersist/trunk/src/mongopersist/zope/container.py
-=-
Modified: mongopersist/trunk/CHANGES.txt
===================================================================
--- mongopersist/trunk/CHANGES.txt 2012-03-09 20:20:42 UTC (rev 124546)
+++ mongopersist/trunk/CHANGES.txt 2012-03-09 21:33:37 UTC (rev 124547)
@@ -5,9 +5,16 @@
0.5.5 (unreleased)
------------------
-- Moved ZODB dependency to test dependency
+- Feature: Moved ZODB dependency to test dependency
+- Bug: When an object has a SimpleContainer as attribute, then simply loading
+ this object would cause it to written at the end of the transaction. The
+ culprit was a persistent dictionary containing the SimpleContainer
+ state. This dictionary got modified during state load and caused it to be
+ registered as a changed object and it was marked as a ``_p_mongo_sub_object``
+ and had the original object as ``_p_mongo_doc_object``.
+
0.5.4 (2012-03-05)
------------------
Modified: mongopersist/trunk/setup.py
===================================================================
--- mongopersist/trunk/setup.py 2012-03-09 20:20:42 UTC (rev 124546)
+++ mongopersist/trunk/setup.py 2012-03-09 21:33:37 UTC (rev 124547)
@@ -9,7 +9,7 @@
setup (
name='mongopersist',
- version='0.5.5.dev0',
+ version='0.5.5',
author = "Stephan Richter",
author_email = "stephan.richter at gmail.com",
description = "Mongo Persistence Backend",
Modified: mongopersist/trunk/src/mongopersist/zope/container.py
===================================================================
--- mongopersist/trunk/src/mongopersist/zope/container.py 2012-03-09 20:20:42 UTC (rev 124546)
+++ mongopersist/trunk/src/mongopersist/zope/container.py 2012-03-09 21:33:37 UTC (rev 124547)
@@ -49,6 +49,11 @@
return state
def __setstate__(self, state):
+ # Mongopersist always reads a dictionary as persistent dictionary. And
+ # modifying this dictionary will cause the persistence mechanism to
+ # kick in. So we create a new object that we can easily modify without
+ # harm.
+ state = dict(state)
state['_SampleContainer__data'] = state.pop('data', {})
super(SimpleMongoContainer, self).__setstate__(state)
More information about the checkins
mailing list