incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [19/21] git commit: [#5086] avoid errors when working on an orphaned TicketHistory
Date Thu, 11 Oct 2012 19:58:52 GMT
[#5086] avoid errors when working on an orphaned TicketHistory


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

Branch: refs/heads/cj/4942
Commit: e2e43cf6c01b53015a5e12e18fba6cbd27a2512c
Parents: a0b3a36
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Mon Oct 8 22:23:46 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Tue Oct 9 14:49:58 2012 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e2e43cf6/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 31753ae..b65d0f8 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -160,21 +160,31 @@ class TicketHistory(Snapshot):
         return Ticket.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
 
     @property
     def assigned_to(self):
-        if self.data.assigned_to_id is None: return None
+        if self.data.assigned_to_id is None:
+            return None
         return User.query.get(_id=self.data.assigned_to_id)
 
     def index(self):
+        orig = self.original()
+        if not orig:
+            return None
         result = Snapshot.index(self)
         result.update(
             title_s='Version %d of %s' % (
-                self.version,self.original().summary),
+                self.version, orig.summary),
             type_s='Ticket Snapshot',
             text=self.data.summary)
         return result


Mime
View raw message