You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2012/10/11 21:58:52 UTC

[21/21] git commit: [#5086] deleting a versioned artifact will delete all its snapshots

[#5086] deleting a versioned artifact will delete all its snapshots


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/349639c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/349639c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/349639c7

Branch: refs/heads/cj/4942
Commit: 349639c700613b9fefba5529e74e381b7d2d9f06
Parents: 0c25b52
Author: Dave Brondsema <db...@geek.net>
Authored: Mon Oct 8 21:31:09 2012 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Mon Oct 8 21:31:09 2012 +0000

----------------------------------------------------------------------
 Allura/allura/model/artifact.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/349639c7/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index ad6c5e7..197ed86 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -405,6 +405,13 @@ class VersionedArtifact(Artifact):
         else:
             return self.mod_date
 
+    def delete(self):
+        # remove history so that the snapshots aren't left orphaned
+        super(VersionedArtifact, self).delete()
+        HC = self.__mongometa__.history_class
+        HC.query.remove(dict(artifact_id=self._id))
+
+
 class Message(Artifact):
     """
     A message