diff --git a/plone/app/discussion/browser/comment.py b/plone/app/discussion/browser/comment.py new file mode 100644 index 0000000..f08e930 --- /dev/null +++ b/plone/app/discussion/browser/comment.py @@ -0,0 +1,16 @@ +from Acquisition import aq_parent + +from Products.Five.browser import BrowserView + +class View(BrowserView): + """Comment View. + + Redirect from /path/to/object/++conversation++default/123456789 + to /path/to/object#comment-123456789. + """ + + def __call__(self): + comment_id = aq_parent(self).id + self.request.response.redirect( + aq_parent(aq_parent(aq_parent(self))).absolute_url() + + '#' + str(comment_id)) \ No newline at end of file diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index e65453a..27d625e 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -41,20 +41,6 @@ from plone.z3cform import layout, z2 from plone.z3cform.fieldsets import extensible -class View(BrowserView): - """Comment View. - - Redirect from /path/to/object/++conversation++default/123456789 - to /path/to/object#comment-123456789. - """ - - def __call__(self): - comment_id = aq_parent(self).id - self.request.response.redirect( - aq_parent(aq_parent(aq_parent(self))).absolute_url() + - '#' + str(comment_id)) - - class AutoResizeTextArea(TextAreaWidget): """Textarea with autoresize CSS class. """ @@ -218,6 +204,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form): # a cancel button that is handled by a jQuery method. pass + class CommentsViewlet(ViewletBase, layout.FormWrapper): form = CommentForm diff --git a/plone/app/discussion/browser/configure.zcml b/plone/app/discussion/browser/configure.zcml index f131592..85024bd 100644 --- a/plone/app/discussion/browser/configure.zcml +++ b/plone/app/discussion/browser/configure.zcml @@ -83,7 +83,7 @@ name="view" for="plone.app.discussion.interfaces.IComment" layer="..interfaces.IDiscussionLayer" - class=".comments.View" + class=".comment.View" permission="zope2.View" />