From 07b8ebc5df6d60f6b561771143304099beb6df4e Mon Sep 17 00:00:00 2001 From: Elizabeth Leddy Date: Tue, 24 Jan 2012 18:28:02 -0800 Subject: [PATCH] make sure commenting works when caching with modified headers --- CHANGES.txt | 7 +++++++ plone/app/discussion/comment.py | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4cb0e58..0ee8e18 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,13 @@ Changelog ========= +2.1.3 (unreleased) +------------------ + +- Set modified date of object receiving comments so that caching works + correctly (304s) + [eleddy] + 2.1.2 (2011-12-21) ------------------ diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index a4f7653..08a5e7f 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -206,9 +206,14 @@ def notify_content_object(obj, event): """Tell the content object when a comment is added """ content_obj = aq_parent(aq_parent(obj)) + # set the modified date and reindex the item accordingly + # so that 304s work correctly. This means that adding a comment + # effectively counts as modifying the content type. + content_obj.setModificationDate() content_obj.reindexObject(idxs=('total_comments', 'last_comment_date', - 'commentators',)) + 'commentators', + 'modified')) def notify_content_object_deleted(obj, event):