incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [10/50] git commit: [#4339] ticket:237 preserve custom fields only from a new tracker
Date Tue, 22 Jan 2013 23:23:18 GMT
[#4339] ticket:237 preserve custom fields only from a new tracker


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

Branch: refs/heads/cj/4691
Commit: 5c2f5a37ef28dfac243b49f9454e6f5b20769803
Parents: f602a5c
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu Dec 20 13:01:54 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Fri Jan 18 21:53:18 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5c2f5a37/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index b33cd45..b14b8ca 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -562,10 +562,10 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
         messages = []
         for cf in skipped_fields:
             name = cf[0]
-            messages.append('- **%s**: %s' % (name, self.custom_fields[name]))
+            messages.append('- **%s**: %s' % (name, self.custom_fields.get(name, '')))
         for cf in user_fields:
             name = cf[0]
-            username = self.custom_fields[name]
+            username = self.custom_fields.get(name, None)
             user = app_config.project.user_in_project(username)
             if not user or user == User.anonymous():
                 messages.append('- **%s**: %s (user not in project)' % (name, username))
@@ -575,6 +575,16 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
         if user and not app_config.project.user_in_project(user.username):
             messages.append('- **assigned_to**: %s (user not in project)' % user.username)
             self.assigned_to_id = None
+
+        custom_fields = {}
+        for cf in new_cfs:
+            fn, ft, fl = cf
+            old_val = self.custom_fields.get(fn, None)
+            if old_val is None:
+                custom_fields[fn] = None if ft == 'user' else ''
+            custom_fields[fn] = old_val
+        self.custom_fields = custom_fields
+
         message = 'Ticket moved from %s' % prior_url
         if messages:
             message += '\n\nCan\'t be converted:\n\n'


Mime
View raw message