[Checkins] SVN: mongopersist/trunk/ Make sure that the object is not saved again at the end, if it is

Stephen Richter cvs-admin at zope.org
Mon Mar 12 17:21:55 UTC 2012


Log message for revision 124581:
  Make sure that the object is not saved again at the end, if it is 
  dumped.
  

Changed:
  U   mongopersist/trunk/CHANGES.txt
  U   mongopersist/trunk/src/mongopersist/datamanager.py

-=-
Modified: mongopersist/trunk/CHANGES.txt
===================================================================
--- mongopersist/trunk/CHANGES.txt	2012-03-12 17:19:38 UTC (rev 124580)
+++ mongopersist/trunk/CHANGES.txt	2012-03-12 17:21:52 UTC (rev 124581)
@@ -50,6 +50,11 @@
   OID is chosen as the key. Ids are perfect key, because they are guaranteed
   to be unique within the collection.
 
+- Since people did not like the setitem with ``None`` key implementation, I
+  also added the ``MongoContainer.add(value, key=None)`` method, which makes
+  specifying the key optional. The default implementation is to use the OID,
+  if the key is ``None``.
+
 - Removed ``fields`` argument from the ``MongoContainer.find(...)`` and
   ``MongoContainer.find_one(...)`` methods, since it was not used.
 

Modified: mongopersist/trunk/src/mongopersist/datamanager.py
===================================================================
--- mongopersist/trunk/src/mongopersist/datamanager.py	2012-03-12 17:19:38 UTC (rev 124580)
+++ mongopersist/trunk/src/mongopersist/datamanager.py	2012-03-12 17:21:52 UTC (rev 124581)
@@ -186,7 +186,10 @@
         return CollectionWrapper(self._get_collection_from_object(obj), self)
 
     def dump(self, obj):
-        return self._writer.store(obj)
+        res = self._writer.store(obj)
+        if obj in self._registered_objects:
+            obj._p_changed = False
+            self._registered_objects.remove(obj)
 
     def load(self, dbref):
         return self._reader.get_ghost(dbref)



More information about the checkins mailing list