incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [7/50] git commit: [#4339] ticket:237 move ticket after all fields are processed
Date Tue, 22 Jan 2013 23:23:18 GMT
[#4339] ticket:237 move ticket after all fields are processed


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

Branch: refs/heads/cj/4691
Commit: 57a43ea1d8e1f36a575bf7c0921c7359ebd05dd2
Parents: 5c2f5a3
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu Dec 20 14:46:34 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Fri Jan 18 21:53:18 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py |   36 +++++++++++------------
 1 files changed, 17 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/57a43ea1/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index b14b8ca..d7227fd 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -524,27 +524,9 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
 
     def move(self, app_config):
         '''Move ticket from current tickets app to tickets app with given app_config'''
-        self.globals.invalidate_bin_counts()
         app = app_config.project.app_instance(app_config)
         prior_url = self.url()
         prior_app = self.app
-
-        # ensure unique ticket_num
-        while True:
-            with h.push_context(app_config.project_id, app_config_id=app_config._id):
-                ticket_num = app.globals.next_ticket_num()
-            self.ticket_num = ticket_num
-            self.app_config_id = app_config._id
-            try:
-                session(self).flush(self)
-                h.log_action(log, 'moved').info('Ticket %s moved to %s' % (prior_url, self.url()))
-                break
-            except OperationFailure, err:
-                if 'duplicate' in err.args[0]:
-                    log.warning('Try to create duplicate ticket %s when moving from %s' %
(self.url(), prior_url))
-                    session(self).expunge(self)
-                    continue
-
         prior_cfs = [
             (cf['name'], cf['type'], cf['label'])
             for cf in prior_app.globals.custom_fields or []]
@@ -558,7 +540,6 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
                 skipped_fields.append(cf)
             elif cf[1] == 'user':  # can convert and field type == user
                 user_fields.append(cf)
-
         messages = []
         for cf in skipped_fields:
             name = cf[0]
@@ -585,6 +566,23 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             custom_fields[fn] = old_val
         self.custom_fields = custom_fields
 
+        self.globals.invalidate_bin_counts()
+        # move ticket. ensure unique ticket_num
+        while True:
+            with h.push_context(app_config.project_id, app_config_id=app_config._id):
+                ticket_num = app.globals.next_ticket_num()
+            self.ticket_num = ticket_num
+            self.app_config_id = app_config._id
+            try:
+                session(self).flush(self)
+                h.log_action(log, 'moved').info('Ticket %s moved to %s' % (prior_url, self.url()))
+                break
+            except OperationFailure, err:
+                if 'duplicate' in err.args[0]:
+                    log.warning('Try to create duplicate ticket %s when moving from %s' %
(self.url(), prior_url))
+                    session(self).expunge(self)
+                    continue
+
         message = 'Ticket moved from %s' % prior_url
         if messages:
             message += '\n\nCan\'t be converted:\n\n'


Mime
View raw message