diff --git a/plone/app/discussion/PRINCIPLES.txt b/plone/app/discussion/PRINCIPLES.txt index 11b4679..d7ab048 100644 --- a/plone/app/discussion/PRINCIPLES.txt +++ b/plone/app/discussion/PRINCIPLES.txt @@ -55,7 +55,7 @@ plone.app.discussion. Ids can be based on the creation date. Discussion items send events - The usual zope.lifecycleevent and zope.app.container events should be + The usual zope.lifecycleevent and zope.container events should be fired when discussion items are added, removed, or modified. Outstanding questions diff --git a/plone/app/discussion/catalog.py b/plone/app/discussion/catalog.py index 8651255..3c3a141 100644 --- a/plone/app/discussion/catalog.py +++ b/plone/app/discussion/catalog.py @@ -4,7 +4,7 @@ indexes with values based on the IComment interface. Also provide event handlers to actually catalog the comments. """ -from string import split, join +from string import join from DateTime import DateTime @@ -15,7 +15,6 @@ from Products.ZCatalog.interfaces import IZCatalog from plone.app.discussion.interfaces import IConversation, IComment from plone.indexer import indexer -from plone.indexer.interfaces import IIndexer MAX_DESCRIPTION=25 diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index c6bb031..25a1239 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -12,9 +12,12 @@ from AccessControl.Owned import Owned from plone.app.discussion.interfaces import IComment from Products.CMFCore.DynamicType import DynamicType +from Products.CMFCore.CMFCatalogAware import CMFCatalogAware +from Products.CMFCore.CMFCatalogAware import WorkflowAware from Products.CMFCore.utils import getToolByName -class Comment(DynamicType, Traversable, RoleManager, Owned, Implicit): +class Comment(CMFCatalogAware, WorkflowAware, DynamicType, + Traversable, RoleManager, Owned, Implicit): """A comment. This object attempts to be as lightweight as possible. We implement a @@ -84,17 +87,6 @@ class Comment(DynamicType, Traversable, RoleManager, Owned, Implicit): """ return self.portal_type - # CMF's event handlers assume any IDynamicType has these :( - - def opaqueItems(self): - return [] - - def opaqueIds(self): - return [] - - def opaqueValues(self): - return [] - CommentFactory = Factory(Comment) def notify_workflow(obj, event): diff --git a/plone/app/discussion/configure.zcml b/plone/app/discussion/configure.zcml index a8012cf..5abd83f 100644 --- a/plone/app/discussion/configure.zcml +++ b/plone/app/discussion/configure.zcml @@ -58,31 +58,31 @@ diff --git a/plone/app/discussion/conversation.py b/plone/app/discussion/conversation.py index de4d156..2d470ea 100644 --- a/plone/app/discussion/conversation.py +++ b/plone/app/discussion/conversation.py @@ -16,7 +16,7 @@ from persistent import Persistent from plone.registry.interfaces import IRegistry -from zope.app.component.hooks import getSite +from zope.site.hooks import getSite from zope.interface import implements, implementer from zope.component import adapts, adapter, queryUtility @@ -38,10 +38,10 @@ from Products.CMFCore.interfaces import IFolderish from Products.CMFPlone.interfaces import IPloneSiteRoot, INonStructuralFolder -from zope.app.container.contained import ContainerModifiedEvent +from zope.container.contained import ContainerModifiedEvent -from zope.app.container.contained import ObjectAddedEvent -from zope.app.container.contained import ObjectRemovedEvent +from zope.lifecycleevent import ObjectAddedEvent +from zope.lifecycleevent import ObjectRemovedEvent from BTrees.OIBTree import OIBTree diff --git a/plone/app/discussion/tests/layer.py b/plone/app/discussion/tests/layer.py index 081fa2a..718b7c7 100644 --- a/plone/app/discussion/tests/layer.py +++ b/plone/app/discussion/tests/layer.py @@ -1,12 +1,25 @@ +from Testing import ZopeTestCase as ztc + from Products.PloneTestCase import ptc -import collective.testcaselayer.ptc +from Products.PloneTestCase import layer +from Products.Five import zcml +from Products.Five import fiveconfigure -ptc.setupPloneSite() +ptc.setupPloneSite( + extension_profiles=('plone.app.discussion:default', ) +) -class Layer(collective.testcaselayer.ptc.BasePTCLayer): - """Install plone.app.discussion""" +class DiscussionLayer(layer.PloneSite): + """Configure plone.app.discussion""" - def afterSetUp(self): - self.addProfile('plone.app.discussion:default') + @classmethod + def setUp(cls): + fiveconfigure.debug_mode = True + import plone.app.discussion + zcml.load_config("configure.zcml", plone.app.discussion) + fiveconfigure.debug_mode = False + ztc.installPackage("plone.app.discussion", quiet=1) -DiscussionLayer = Layer([collective.testcaselayer.ptc.ptc_layer]) \ No newline at end of file + @classmethod + def tearDown(cls): + pass diff --git a/setup.py b/setup.py index 8f08669..48add53 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,6 @@ setup(name='plone.app.discussion', install_requires=[ 'setuptools', 'collective.autopermission', - 'collective.testcaselayer', 'plone.app.registry', 'plone.indexer', 'plone.registry', @@ -38,7 +37,9 @@ setup(name='plone.app.discussion', 'zope.component', 'zope.annotation', 'zope.event', - 'zope.app.container', # XXX: eventually should change to zope.container + 'zope.container', + 'zope.lifecycleevent', + 'zope.site', ], entry_points=""" [z3c.autoinclude.plugin]