diff --git a/CHANGES.txt b/CHANGES.txt index 7079ef0..cd53525 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -14,6 +14,11 @@ Changelog Related to https://dev.plone.org/plone/ticket/11737 [WouterVH] +- Do not render/update the comment form in CommentViewlets if commenting is + disabled, since this slows down the page rendering. This fixes + http://dev.plone.org/plone/ticket/11930 + [fafhrd] + 2.0.4 (2011-05-28) ------------------ diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index d9f0431..159d3af 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -248,10 +248,13 @@ class CommentsViewlet(ViewletBase): def update(self): super(CommentsViewlet, self).update() - z2.switch_on(self, request_layer=IFormLayer) - self.form = self.form(aq_inner(self.context), self.request) - alsoProvides(self.form, IWrappedForm) - self.form.update() + if self.is_discussion_allowed() and \ + (self.is_anonymous() and self.anonymous_discussion_allowed() \ + or self.can_reply()): + z2.switch_on(self, request_layer=IFormLayer) + self.form = self.form(aq_inner(self.context), self.request) + alsoProvides(self.form, IWrappedForm) + self.form.update() # view methods