Fix old-style exception raising
svn path=/plone.app.discussion/trunk/; revision=48884
This commit is contained in:
parent
9db8909ea7
commit
f2e47227f9
@ -171,8 +171,8 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
|||||||
# Check if conversation is enabled on this content object
|
# Check if conversation is enabled on this content object
|
||||||
if not self.__parent__.restrictedTraverse(
|
if not self.__parent__.restrictedTraverse(
|
||||||
'@@conversation_view').enabled():
|
'@@conversation_view').enabled():
|
||||||
raise Unauthorized, "Discussion is not enabled for this content\
|
raise Unauthorized("Discussion is not enabled for this content "
|
||||||
object."
|
"object.")
|
||||||
|
|
||||||
# The add-comment view is called on the conversation object
|
# The add-comment view is called on the conversation object
|
||||||
conversation = IConversation(self.__parent__)
|
conversation = IConversation(self.__parent__)
|
||||||
@ -218,11 +218,10 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
|||||||
comment.author_email = email
|
comment.author_email = email
|
||||||
comment.user_notification = user_notification
|
comment.user_notification = user_notification
|
||||||
comment.creation_date = comment.modification_date = datetime.utcnow()
|
comment.creation_date = comment.modification_date = datetime.utcnow()
|
||||||
else:
|
else: # pragma: no cover
|
||||||
raise Unauthorized, \
|
raise Unauthorized("Anonymous user tries to post a comment, but "
|
||||||
"""Anonymous user tries to post a comment, but
|
"anonymous commenting is disabled. Or user does not have the "
|
||||||
anonymous commenting is disabled. Or user
|
"'reply to item' permission.")
|
||||||
does not have the 'reply to item' permission.""" # pragma: no cover
|
|
||||||
|
|
||||||
# Check if the added comment is a reply to an existing comment
|
# Check if the added comment is a reply to an existing comment
|
||||||
# or just a regular reply to the content object.
|
# or just a regular reply to the content object.
|
||||||
|
Loading…
Reference in New Issue
Block a user