From b5f4df5f17ff17c095e6892bc86fe84ca66bccb6 Mon Sep 17 00:00:00 2001 From: tisto Date: Sun, 15 Dec 2013 12:00:25 +0100 Subject: [PATCH 1/3] Add code analysis section. --- buildout.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/buildout.cfg b/buildout.cfg index 560c0f6..6bbf249 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -5,6 +5,7 @@ package-extras = [test] parts += mkrelease pocompile + code-analysis [mkrelease] recipe = zc.recipe.egg @@ -14,6 +15,10 @@ eggs = jarn.mkrelease recipe = zc.recipe.egg eggs = zest.pocompile +[code-analysis] +recipe = plone.recipe.codeanalysis +directory = ${buildout:directory}/plone/app/discussion + [versions] plone.app.discussion = zope.interface = 4.0.5 From f0a9d9ad6bec8804ff546f79709bf1547e6d47ad Mon Sep 17 00:00:00 2001 From: tisto Date: Sun, 15 Dec 2013 12:02:32 +0100 Subject: [PATCH 2/3] Pep8 --- plone/app/discussion/patches.py | 2 -- plone/app/discussion/subscribers.py | 3 ++- plone/app/discussion/tests/test_catalog.py | 2 -- plone/app/discussion/tests/test_conversation.py | 2 +- plone/app/discussion/tests/test_moderation_view.py | 2 -- 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/plone/app/discussion/patches.py b/plone/app/discussion/patches.py index f803f10..9491702 100644 --- a/plone/app/discussion/patches.py +++ b/plone/app/discussion/patches.py @@ -1,7 +1,5 @@ from Products.CMFCore.utils import getToolByName -from zope.component import queryUtility - from Acquisition import aq_inner, aq_parent from zope.annotation.interfaces import IAnnotations diff --git a/plone/app/discussion/subscribers.py b/plone/app/discussion/subscribers.py index 20ac7ad..07e0bb5 100644 --- a/plone/app/discussion/subscribers.py +++ b/plone/app/discussion/subscribers.py @@ -1,14 +1,15 @@ from Products.CMFCore.utils import getToolByName + def index_object(obj, event): """Index the object when it is added to the conversation. """ catalog = getToolByName(obj, 'portal_catalog') return catalog.reindexObject(obj) + def unindex_object(obj, event): """Unindex the object when it is removed from the conversation. """ catalog = getToolByName(obj, 'portal_catalog') return catalog.unindexObject(obj) - diff --git a/plone/app/discussion/tests/test_catalog.py b/plone/app/discussion/tests/test_catalog.py index 8c5291a..cbe8df6 100644 --- a/plone/app/discussion/tests/test_catalog.py +++ b/plone/app/discussion/tests/test_catalog.py @@ -19,8 +19,6 @@ from plone.app.discussion.testing import ( from plone.app.discussion.interfaces import IConversation -from plone.app.discussion.testing import COLLECTION_TYPE - class CatalogSetupTest(unittest.TestCase): diff --git a/plone/app/discussion/tests/test_conversation.py b/plone/app/discussion/tests/test_conversation.py index 770e3af..278adb5 100644 --- a/plone/app/discussion/tests/test_conversation.py +++ b/plone/app/discussion/tests/test_conversation.py @@ -308,7 +308,7 @@ class ConversationTest(unittest.TestCase): # Create a folder self.typetool.constructContent('Folder', self.portal, 'f1') - f1 = self.portal.f1 + # Usually we don't create a conversation on a folder conversation = self.portal.f1.restrictedTraverse('@@conversation_view') diff --git a/plone/app/discussion/tests/test_moderation_view.py b/plone/app/discussion/tests/test_moderation_view.py index 33064b6..c821200 100644 --- a/plone/app/discussion/tests/test_moderation_view.py +++ b/plone/app/discussion/tests/test_moderation_view.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- import unittest -from DateTime import DateTime - from zope.component import createObject from Products.CMFCore.utils import getToolByName From 38cfae5647ce2df31451b4af39c2413b00a5530f Mon Sep 17 00:00:00 2001 From: tisto Date: Sun, 15 Dec 2013 12:04:05 +0100 Subject: [PATCH 3/3] Set flake8 max complexity to 50. --- buildout.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/buildout.cfg b/buildout.cfg index 6bbf249..d8d5f93 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -18,6 +18,7 @@ eggs = zest.pocompile [code-analysis] recipe = plone.recipe.codeanalysis directory = ${buildout:directory}/plone/app/discussion +flake8-max-complexity = 50 [versions] plone.app.discussion =