Redirect to the comment form action instead of the absolute url when a comment is posted. This fixes the accidentially triggered file upload when a comment is posted on a file content object.

svn path=/plone.app.discussion/trunk/; revision=38664
This commit is contained in:
Timo Stollenwerk 2010-08-09 12:25:14 +00:00
parent 7fef29cf64
commit d37d5aa9f5
2 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,11 @@ Changelog
1.0b6 (unreleased) 1.0b6 (unreleased)
------------------ ------------------
* Redirect to the comment form action instead of the absolute url when a
comment is posted. This fixes the accidentially triggered file upload when a
comment is posted on a file content object.
[timo]
* We need five:registerPackage to register the i18n folder. * We need five:registerPackage to register the i18n folder.
[vincentfretin] [vincentfretin]

View File

@ -182,10 +182,10 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
IStatusMessage(self.context.REQUEST).addStatusMessage( IStatusMessage(self.context.REQUEST).addStatusMessage(
_("Your comment awaits moderator approval."), _("Your comment awaits moderator approval."),
type="info") type="info")
self.request.response.redirect(context.absolute_url()) self.request.response.redirect(self.action)
else: else:
# Redirect to comment (inside a content object page) # Redirect to comment (inside a content object page)
self.request.response.redirect(context.absolute_url() + '#' + str(comment_id)) self.request.response.redirect(self.action + '#' + str(comment_id))
@button.buttonAndHandler(_(u"Cancel")) @button.buttonAndHandler(_(u"Cancel"))
def handleCancel(self, action): def handleCancel(self, action):