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 when working on an orphaned TicketHistory
Date Mon, 08 Oct 2012 22:24:12 GMT
Updated Branches:
  refs/heads/db/5086 8ee45925e -> 2b56aacf3


[#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/2b56aacf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2b56aacf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2b56aacf

Branch: refs/heads/db/5086
Commit: 2b56aacf3a2caca62ad1df971ac7d2dcf8c3a8f0
Parents: b505279
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Mon Oct 8 22:23:46 2012 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Mon Oct 8 22:23:46 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/2b56aacf/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