allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject [11/17] allura git commit: [#6017] ticket:751 Add attachment information to ticket changelog entries
Date Thu, 16 Apr 2015 17:05:08 GMT
[#6017] ticket:751 Add attachment information to ticket changelog entries


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

Branch: refs/heads/hs/7852
Commit: 130cceccd0c4ce69e0b37cb1977df5bb2b33c20b
Parents: a3f7d44
Author: Aleksey 'LXj' Alekseyev <gotletter@gmail.com>
Authored: Tue Apr 7 17:22:16 2015 +0300
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Thu Apr 16 10:43:47 2015 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/tracker_main.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/130ccecc/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 4f20d88..2b4e807 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1389,6 +1389,14 @@ class TicketController(BaseController, FeedController):
 
     @require_post()
     def _update_ticket(self, post_data):
+        def attachments_info(attachments):
+            text = ''
+            for attach in attachments:
+                text = "%s %s (%s; %s) " % (
+                    text, attach.filename,
+                    h.do_filesizeformat(attach.length), attach.content_type)
+            return text
+
         require_access(self.ticket, 'update')
         changes = changelog()
         comment = post_data.pop('comment', None)
@@ -1424,7 +1432,9 @@ class TicketController(BaseController, FeedController):
 
         if 'attachment' in post_data:
             attachment = post_data['attachment']
+            changes['attachments'] = attachments_info(self.ticket.attachments)
             self.ticket.add_multiple_attachments(attachment)
+            changes['attachments'] = attachments_info(self.ticket.attachments)
         for cf in c.app.globals.custom_fields or []:
             if 'custom_fields.' + cf.name in post_data:
                 value = post_data['custom_fields.' + cf.name]


Mime
View raw message