You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/04/16 18:28:48 UTC
[3/6] allura git commit: [#6017] ticket:751 Clear Ming's cache for
attachments to generate a changelog
[#6017] ticket:751 Clear Ming's cache for attachments to generate a changelog
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/677fd677
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/677fd677
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/677fd677
Branch: refs/heads/master
Commit: 677fd677338c3a2c62c4674273f68ca2cc1186ad
Parents: 130ccec
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Apr 8 10:10:02 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Thu Apr 16 10:43:47 2015 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/tracker_main.py | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/677fd677/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 2b4e807..7558eab 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -38,6 +38,7 @@ from bson.errors import InvalidId
from webhelpers import feedgenerator as FG
from ming import schema
+from ming.odm import session
from ming.orm.ormsession import ThreadLocalORMSession
from ming.utils import LazyProperty
@@ -1434,6 +1435,11 @@ class TicketController(BaseController, FeedController):
attachment = post_data['attachment']
changes['attachments'] = attachments_info(self.ticket.attachments)
self.ticket.add_multiple_attachments(attachment)
+ # flush new attachments to db
+ session(self.ticket.attachment_class()).flush()
+ # self.ticket.attachments is ming's LazyProperty, we need to reset
+ # it's cache to fetch updated attachments here:
+ self.ticket.__dict__.pop('attachments')
changes['attachments'] = attachments_info(self.ticket.attachments)
for cf in c.app.globals.custom_fields or []:
if 'custom_fields.' + cf.name in post_data: