diff MoinMoin/storage/middleware/indexing.py @ 1918:f0b346ac6338

added return_rev param to store_revision() to avoid returning a revision object without need
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 20 Jan 2013 23:36:37 +0100
parents 4a054063fbb0
children 2bd864ed640e 5281fec759b1
line wrap: on
line diff
--- a/MoinMoin/storage/middleware/indexing.py	Sun Jan 20 21:55:30 2013 +0100
+++ b/MoinMoin/storage/middleware/indexing.py	Sun Jan 20 23:36:37 2013 +0100
@@ -864,6 +864,7 @@
                        contenttype_current=None,
                        contenttype_guessed=None,
                        acl_parent=None,
+                       return_rev=False,
                        ):
         """
         Store a revision into the backend, write metadata and data to it.
@@ -875,7 +876,8 @@
         :type meta: dict
         :type data: open file (file must be closed by caller)
         :param overwrite: if True, allow overwriting of existing revs.
-        :returns: a Revision instance of the just created revision
+        :param return_rev: if True, return a Revision instance of the just created revision
+        :returns: a Revision instance or None
         """
         if remote_addr is None:
             try:
@@ -937,7 +939,8 @@
         self.indexer.index_revision(meta, content)
         if not overwrite:
             self._current = self.indexer._document(revid=revid)
-        return Revision(self, revid)
+        if return_rev:
+            return Revision(self, revid)
 
     def store_all_revisions(self, meta, data):
         """