Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Make sure that the object is not saved again at the end, if it is
Browse files Browse the repository at this point in the history
dumped.
  • Loading branch information
strichter committed Mar 12, 2012
1 parent 1ab0276 commit b5c4057
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.txt
Expand Up @@ -50,6 +50,11 @@ CHANGES
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.

Expand Down
5 changes: 4 additions & 1 deletion src/mongopersist/datamanager.py
Expand Up @@ -186,7 +186,10 @@ def get_collection_from_object(self, obj):
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)
Expand Down

0 comments on commit b5c4057

Please sign in to comment.