allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [5/5] git commit: [#6100] Put MovedTicket in its own collection; add indexes
Date Wed, 18 Sep 2013 15:13:35 GMT
[#6100] Put MovedTicket in its own collection; add indexes

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>


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

Branch: refs/heads/master
Commit: 66cb620e01ef3e81242b5a5c6fece0ba257b743d
Parents: 671627e
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Wed Sep 18 15:12:30 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Wed Sep 18 15:12:30 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py | 33 ++++++++++++++++++++++----
 ForgeTracker/forgetracker/tracker_main.py |  7 ++----
 2 files changed, 31 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/66cb620e/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 0ef8cab..d0b69c2 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -36,10 +36,27 @@ from ming.orm import FieldProperty, ForeignIdProperty, RelationProperty
 from ming.orm.declarative import MappedClass
 from ming.orm.ormsession import ThreadLocalORMSession
 
-from allura.model import (Artifact, MovedArtifact, VersionedArtifact, Snapshot,
-                          project_orm_session, BaseAttachment, VotableArtifact, AppConfig,
Mailbox, User)
-from allura.model import User, Feed, Thread, Notification, ProjectRole
-from allura.model import ACE, ALL_PERMISSIONS, DENY_ALL
+from allura.model import (
+        ACE,
+        DENY_ALL,
+
+        AppConfig,
+        Artifact,
+        BaseAttachment,
+        Feed,
+        Mailbox,
+        MovedArtifact,
+        Notification,
+        ProjectRole,
+        Snapshot,
+        Thread,
+        User,
+        VersionedArtifact,
+        VotableArtifact,
+
+        artifact_orm_session,
+        project_orm_session,
+)
 from allura.model.timeline import ActivityObject
 from allura.model.notification import MailFooter
 
@@ -1088,6 +1105,14 @@ class TicketAttachment(BaseAttachment):
 
 
 class MovedTicket(MovedArtifact):
+
+    class __mongometa__:
+        session = artifact_orm_session
+        name='moved_ticket'
+        indexes = [
+            ('app_config_id', 'ticket_num'),
+        ]
+
     ticket_num = FieldProperty(int, required=True, allow_none=False)
 
 Mapper.compile_all()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/66cb620e/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 968d16e..6c6c20d 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1180,18 +1180,15 @@ class TicketController(BaseController, FeedController):
                 if self.ticket is not None:
                     utils.permanent_redirect(self.ticket.url())
                 else:
-                    # trying to check if ticket was moved from here
+                    # check if ticket was moved
                     moved_ticket = TM.MovedTicket.query.find({
                         'app_config_id': c.app.config._id,
                         'ticket_num': self.ticket_num,
                     }).first()
                     if moved_ticket:
-                        flash('Ticket #{} was moved to this app'.format(
-                            moved_ticket.ticket_num
-                        ))
+                        flash('Original ticket was moved to this location')
                         utils.permanent_redirect(moved_ticket.moved_to_url)
             self.attachment = AttachmentsController(self.ticket)
-            # self.comments = CommentController(self.ticket)
 
     def _check_security(self):
         if self.ticket is not None:


Mime
View raw message