From fcb4bbf94bf8aa490df087c69a9628e865d7fa91 Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Mon, 25 Jan 2016 14:45:59 +0100 Subject: [PATCH] Get rid of the monkey patch on Products.CMFPlone's CatalogTool. --- CHANGES.rst | 5 +++- plone/app/discussion/configure.zcml | 14 --------- plone/app/discussion/conversation.py | 5 ++-- plone/app/discussion/patches.py | 43 ---------------------------- setup.py | 1 - 5 files changed, 6 insertions(+), 62 deletions(-) delete mode 100644 plone/app/discussion/patches.py diff --git a/CHANGES.rst b/CHANGES.rst index 876ecd3..5e47cd9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,7 +11,10 @@ New: Fixes: -- *add item here* +- Get rid of the monkey patch on Products.CMFPlone's CatalogTool. + Issue https://github.com/plone/Products.CMFPlone/issues/1332 + [staeff, fredvd] + 2.4.9 (2015-11-25) diff --git a/plone/app/discussion/configure.zcml b/plone/app/discussion/configure.zcml index 0a3fe54..4e634ba 100644 --- a/plone/app/discussion/configure.zcml +++ b/plone/app/discussion/configure.zcml @@ -2,7 +2,6 @@ xmlns="http://namespaces.zope.org/zope" xmlns:genericsetup="http://namespaces.zope.org/genericsetup" xmlns:i18n="http://namespaces.zope.org/i18n" - xmlns:monkey="http://namespaces.plone.org/monkey" xmlns:zcml="http://namespaces.zope.org/zcml" xmlns:five="http://namespaces.zope.org/five" i18n_domain="plone"> @@ -62,19 +61,6 @@ profile="plone.app.discussion:default" /> - - - - - - - diff --git a/plone/app/discussion/conversation.py b/plone/app/discussion/conversation.py index f0ebc4d..0e074a7 100644 --- a/plone/app/discussion/conversation.py +++ b/plone/app/discussion/conversation.py @@ -21,6 +21,7 @@ from OFS.event import ObjectWillBeAddedEvent from OFS.event import ObjectWillBeRemovedEvent from OFS.Traversable import Traversable from Products.CMFPlone.interfaces import IHideFromBreadcrumbs +from Products.CMFPlone import DISCUSSION_ANNOTATION_KEY as ANNOTATION_KEY from persistent import Persistent from plone.app.discussion.comment import Comment from plone.app.discussion.interfaces import IConversation @@ -37,12 +38,10 @@ from zope.lifecycleevent import ObjectAddedEvent from zope.lifecycleevent import ObjectCreatedEvent from zope.lifecycleevent import ObjectRemovedEvent + import time -ANNOTATION_KEY = 'plone.app.discussion:conversation' - - class Conversation(Traversable, Persistent, Explicit): """A conversation is a container for all comments on a content object. diff --git a/plone/app/discussion/patches.py b/plone/app/discussion/patches.py deleted file mode 100644 index fd0070b..0000000 --- a/plone/app/discussion/patches.py +++ /dev/null @@ -1,43 +0,0 @@ -from Acquisition import aq_inner -from Acquisition import aq_parent -from Products.CMFCore.utils import getToolByName -from Products.CMFPlone.utils import base_hasattr -from Products.CMFPlone.utils import safe_callable -from plone.app.discussion.conversation import ANNOTATION_KEY -from zope.annotation.interfaces import IAnnotations - - -def patchedClearFindAndRebuild(self): - """Empties catalog, then finds all contentish objects (i.e. objects - with an indexObject method), and reindexes them. - This may take a long time. - """ - - def indexObject(obj, path): - - if (base_hasattr(obj, 'indexObject') and - safe_callable(obj.indexObject)): - - try: - obj.indexObject() - - annotions = IAnnotations(obj) - catalog = getToolByName(obj, "portal_catalog") - if ANNOTATION_KEY in annotions: - conversation = annotions[ANNOTATION_KEY] - conversation = conversation.__of__(obj) - for comment in conversation.getComments(): - try: - if catalog: - catalog.indexObject(comment) - except StopIteration: # pragma: no cover - pass - - except TypeError: - # Catalogs have 'indexObject' as well, but they - # take different args, and will fail - pass - - self.manage_catalogClear() - portal = aq_parent(aq_inner(self)) - portal.ZopeFindAndApply(portal, search_sub=True, apply_func=indexObject) diff --git a/setup.py b/setup.py index 7c2e09a..8547015 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,6 @@ version = '2.4.10.dev0' install_requires = [ 'setuptools', - 'collective.monkeypatcher', 'plone.app.layout', 'plone.app.registry', 'plone.app.uuid',