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 #11930

svn path=/plone.app.discussion/trunk/; revision=50489
This commit is contained in:
Timo Stollenwerk
2011-06-16 10:59:25 +00:00
parent 5fc9854d36
commit 98bcc19d5c
2 changed files with 12 additions and 4 deletions
+7 -4
View File
@@ -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