Merge pull request #39 from tisto/master

Pep8 and code analysis.
This commit is contained in:
Timo Stollenwerk 2013-12-15 03:05:53 -08:00
commit 5c4599a7f3
6 changed files with 9 additions and 8 deletions

View File

@ -5,6 +5,7 @@ package-extras = [test]
parts += parts +=
mkrelease mkrelease
pocompile pocompile
code-analysis
[mkrelease] [mkrelease]
recipe = zc.recipe.egg recipe = zc.recipe.egg
@ -14,6 +15,11 @@ eggs = jarn.mkrelease
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = zest.pocompile eggs = zest.pocompile
[code-analysis]
recipe = plone.recipe.codeanalysis
directory = ${buildout:directory}/plone/app/discussion
flake8-max-complexity = 50
[versions] [versions]
plone.app.discussion = plone.app.discussion =
zope.interface = 4.0.5 zope.interface = 4.0.5

View File

@ -1,7 +1,5 @@
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from zope.component import queryUtility
from Acquisition import aq_inner, aq_parent from Acquisition import aq_inner, aq_parent
from zope.annotation.interfaces import IAnnotations from zope.annotation.interfaces import IAnnotations

View File

@ -1,14 +1,15 @@
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
def index_object(obj, event): def index_object(obj, event):
"""Index the object when it is added to the conversation. """Index the object when it is added to the conversation.
""" """
catalog = getToolByName(obj, 'portal_catalog') catalog = getToolByName(obj, 'portal_catalog')
return catalog.reindexObject(obj) return catalog.reindexObject(obj)
def unindex_object(obj, event): def unindex_object(obj, event):
"""Unindex the object when it is removed from the conversation. """Unindex the object when it is removed from the conversation.
""" """
catalog = getToolByName(obj, 'portal_catalog') catalog = getToolByName(obj, 'portal_catalog')
return catalog.unindexObject(obj) return catalog.unindexObject(obj)

View File

@ -19,8 +19,6 @@ from plone.app.discussion.testing import (
from plone.app.discussion.interfaces import IConversation from plone.app.discussion.interfaces import IConversation
from plone.app.discussion.testing import COLLECTION_TYPE
class CatalogSetupTest(unittest.TestCase): class CatalogSetupTest(unittest.TestCase):

View File

@ -308,7 +308,7 @@ class ConversationTest(unittest.TestCase):
# Create a folder # Create a folder
self.typetool.constructContent('Folder', self.portal, 'f1') self.typetool.constructContent('Folder', self.portal, 'f1')
f1 = self.portal.f1
# Usually we don't create a conversation on a folder # Usually we don't create a conversation on a folder
conversation = self.portal.f1.restrictedTraverse('@@conversation_view') conversation = self.portal.f1.restrictedTraverse('@@conversation_view')

View File

@ -1,8 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import unittest import unittest
from DateTime import DateTime
from zope.component import createObject from zope.component import createObject
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName