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

View File

@ -14,6 +14,11 @@ Changelog
Related to https://dev.plone.org/plone/ticket/11737 Related to https://dev.plone.org/plone/ticket/11737
[WouterVH] [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) 2.0.4 (2011-05-28)
------------------ ------------------

View File

@ -248,10 +248,13 @@ class CommentsViewlet(ViewletBase):
def update(self): def update(self):
super(CommentsViewlet, self).update() super(CommentsViewlet, self).update()
z2.switch_on(self, request_layer=IFormLayer) if self.is_discussion_allowed() and \
self.form = self.form(aq_inner(self.context), self.request) (self.is_anonymous() and self.anonymous_discussion_allowed() \
alsoProvides(self.form, IWrappedForm) or self.can_reply()):
self.form.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()
# view methods # view methods