incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/2] git commit: [#5086] avoid errors on already orphaned BlogPostSnapshot instances
Date Mon, 08 Oct 2012 21:31:42 GMT
Updated Branches:
  refs/heads/db/5086 [created] 8ee45925e


[#5086] avoid errors on already orphaned BlogPostSnapshot instances


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

Branch: refs/heads/db/5086
Commit: 8ee45925e3e1f91db99637858a0afca46cf1d2ca
Parents: 349639c
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Mon Oct 8 21:31:33 2012 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Mon Oct 8 21:31:33 2012 +0000

----------------------------------------------------------------------
 ForgeBlog/forgeblog/model/blog.py |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ee45925/ForgeBlog/forgeblog/model/blog.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/model/blog.py b/ForgeBlog/forgeblog/model/blog.py
index 480d9bc..3ee4949 100644
--- a/ForgeBlog/forgeblog/model/blog.py
+++ b/ForgeBlog/forgeblog/model/blog.py
@@ -43,12 +43,21 @@ class BlogPostSnapshot(M.Snapshot):
         return BlogPost.query.get(_id=self.artifact_id)
 
     def shorthand_id(self):
-        return '%s#%s' % (self.original().shorthand_id(), self.version)
+        orig = self.original()
+        if not orig:
+            return None
+        return '%s#%s' % (orig.shorthand_id(), self.version)
 
     def url(self):
-        return self.original().url() + '?version=%d' % self.version
+        orig = self.original()
+        if not orig:
+            return None
+        return orig.url() + '?version=%d' % self.version
 
     def index(self):
+        orig = self.original()
+        if not orig:
+            return None
         result = super(BlogPostSnapshot, self).index()
         result.update(
             title_s='Version %d of %s' % (
@@ -64,10 +73,16 @@ class BlogPostSnapshot(M.Snapshot):
 
     @property
     def attachments(self):
+        orig = self.original()
+        if not orig:
+            return None
         return self.original().attachments
 
     @property
     def email_address(self):
+        orig = self.original()
+        if not orig:
+            return None
         return self.original().email_address
 
 class BlogPost(M.VersionedArtifact, ActivityObject):


Mime
View raw message