Pep8
This commit is contained in:
parent
a3883d7e7b
commit
0558a9b739
@ -58,8 +58,8 @@ COMMENT_DESCRIPTION_MARKDOWN = _(
|
||||
COMMENT_DESCRIPTION_INTELLIGENT_TEXT = _(
|
||||
u"comment_description_intelligent_text",
|
||||
default=u"You can add a comment by filling out the form below. " +
|
||||
"Plain text formatting. Web and email addresses are transformed " +
|
||||
"into clickable links.")
|
||||
"Plain text formatting. Web and email addresses are " +
|
||||
"transformed into clickable links.")
|
||||
|
||||
COMMENT_DESCRIPTION_MODERATION_ENABLED = _(
|
||||
u"comment_description_moderation_enabled",
|
||||
@ -113,8 +113,8 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
||||
member_email = member.getProperty('email')
|
||||
|
||||
# Hide the user_notification checkbox if user notification is disabled
|
||||
# or the user is not logged in. Also check if the user has a valid email
|
||||
# address
|
||||
# or the user is not logged in. Also check if the user has a valid
|
||||
# email address
|
||||
if member_email == '' or \
|
||||
not settings.user_notification_enabled or \
|
||||
mtool.isAnonymousUser():
|
||||
@ -185,7 +185,8 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
||||
comment.author_name = author_name
|
||||
comment.author_email = author_email
|
||||
comment.user_notification = user_notification
|
||||
comment.creation_date = comment.modification_date = datetime.utcnow()
|
||||
comment.creation_date = datetime.utcnow()
|
||||
comment.modification_date = datetime.utcnow()
|
||||
elif not portal_membership.isAnonymousUser() and can_reply:
|
||||
# Member
|
||||
member = portal_membership.getAuthenticatedMember()
|
||||
@ -204,7 +205,8 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
||||
comment.author_name = fullname
|
||||
comment.author_email = email
|
||||
comment.user_notification = user_notification
|
||||
comment.creation_date = comment.modification_date = datetime.utcnow()
|
||||
comment.creation_date = datetime.utcnow()
|
||||
comment.modification_date = datetime.utcnow()
|
||||
else: # pragma: no cover
|
||||
raise Unauthorized("Anonymous user tries to post a comment, but "
|
||||
"anonymous commenting is disabled. Or user does not have the "
|
||||
|
@ -60,7 +60,7 @@ class TestCommentForm(unittest.TestCase):
|
||||
'portal_discussion',
|
||||
None)
|
||||
self.discussionTool.overrideDiscussionFor(self.portal.doc1, False)
|
||||
self.membershipTool = getToolByName(self.folder, 'portal_membership', None)
|
||||
self.membershipTool = getToolByName(self.folder, 'portal_membership')
|
||||
self.memberdata = self.portal.portal_memberdata
|
||||
self.context = getattr(self.portal, 'doc1')
|
||||
|
||||
@ -261,7 +261,8 @@ class TestCommentsViewlet(unittest.TestCase):
|
||||
# Anonymous has no 'can review' permission
|
||||
self.assertFalse(self.viewlet.can_review())
|
||||
# The reviewer role has the 'Review comments' permission
|
||||
self.portal.acl_users._doAddUser('reviewer', 'secret', ['Reviewer'], [])
|
||||
self.portal.acl_users._doAddUser(
|
||||
'reviewer', 'secret', ['Reviewer'], [])
|
||||
login(self.portal, 'reviewer')
|
||||
self.assertTrue(self.viewlet.can_review())
|
||||
|
||||
@ -276,7 +277,8 @@ class TestCommentsViewlet(unittest.TestCase):
|
||||
# Anonymous has no 'can review' permission
|
||||
self.assertFalse(self.viewlet.can_manage())
|
||||
# The reviewer role has the 'Review comments' permission
|
||||
self.portal.acl_users._doAddUser('reviewer', 'secret', ['Reviewer'], [])
|
||||
self.portal.acl_users._doAddUser(
|
||||
'reviewer', 'secret', ['Reviewer'], [])
|
||||
login(self.portal, 'reviewer')
|
||||
self.assertTrue(self.viewlet.can_manage())
|
||||
|
||||
@ -295,8 +297,8 @@ class TestCommentsViewlet(unittest.TestCase):
|
||||
self.assertTrue(self.viewlet.comment_transform_message())
|
||||
self.assertEqual(
|
||||
self.viewlet.comment_transform_message(),
|
||||
"You can add a comment by filling out the form below. Plain text " +
|
||||
"formatting.")
|
||||
"You can add a comment by filling out the form below. Plain " +
|
||||
"text formatting.")
|
||||
|
||||
# Set text transform to intelligent text
|
||||
registry = queryUtility(IRegistry)
|
||||
@ -358,7 +360,7 @@ class TestCommentsViewlet(unittest.TestCase):
|
||||
('comment_review_workflow,'))
|
||||
# Check if workflow actions are available
|
||||
reply = self.viewlet.get_replies(workflow_actions=True).next()
|
||||
self.assertTrue(reply.has_key('actions'))
|
||||
self.assertTrue('actions' in reply)
|
||||
self.assertEqual(reply['actions'][0]['id'],
|
||||
'publish')
|
||||
self.assertEqual(reply['actions'][0]['url'],
|
||||
|
@ -12,7 +12,8 @@ from Products.CMFCore.utils import getToolByName
|
||||
from plone.app.testing import TEST_USER_ID, setRoles
|
||||
|
||||
from plone.app.discussion.interfaces import IDiscussionSettings
|
||||
from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||
from plone.app.discussion.testing import \
|
||||
PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||
|
||||
|
||||
class RegistryTest(unittest.TestCase):
|
||||
@ -166,5 +167,6 @@ class ConfigurationChangedSubscriberTest(unittest.TestCase):
|
||||
# setting itself remains unchanged.
|
||||
self.settings.moderation_enabled = True
|
||||
|
||||
|
||||
def test_suite():
|
||||
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|
||||
|
@ -15,7 +15,8 @@ from Products.CMFCore.utils import getToolByName
|
||||
|
||||
from plone.app.testing import TEST_USER_ID, setRoles
|
||||
|
||||
from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||
from plone.app.discussion.testing import \
|
||||
PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||
|
||||
from plone.app.discussion import interfaces
|
||||
from plone.app.discussion.interfaces import IConversation
|
||||
@ -179,7 +180,6 @@ class ConversationTest(unittest.TestCase):
|
||||
# 1) allow_discussion attribute: Every content object in Plone
|
||||
# has a allow_discussion attribute. By default it is set to None.
|
||||
|
||||
|
||||
# Create a conversation.
|
||||
IConversation(self.portal.doc1)
|
||||
|
||||
@ -289,7 +289,6 @@ class ConversationTest(unittest.TestCase):
|
||||
settings.globally_enabled = True
|
||||
self.assertEqual(conversation.enabled(), True)
|
||||
|
||||
|
||||
def test_allow_discussion_for_news_items(self):
|
||||
|
||||
self.typetool.constructContent('News Item', self.portal, 'newsitem')
|
||||
@ -710,8 +709,7 @@ class ConversationTest(unittest.TestCase):
|
||||
self.assertFalse('Discussion Item' in BAD_TYPES)
|
||||
|
||||
def test_no_comment(self):
|
||||
conversation = IConversation(self.portal.doc1)
|
||||
|
||||
IConversation(self.portal.doc1)
|
||||
# Make sure no conversation has been created
|
||||
self.assertTrue('plone.app.discussion:conversation' not in
|
||||
IAnnotations(self.portal.doc1))
|
||||
@ -850,5 +848,6 @@ class RepliesTest(unittest.TestCase):
|
||||
self.assertEqual(len(replies_to_comment1_1), 1)
|
||||
self.assertEqual(len(replies_to_comment2), 1)
|
||||
|
||||
|
||||
def test_suite():
|
||||
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|
||||
|
Loading…
Reference in New Issue
Block a user