Skip to content

Commit

Permalink
Make import of LocalrolesModifiedEvent conditional, so plone.restapi
Browse files Browse the repository at this point in the history
doesn't prevent Plone 4.3 deployments < 4.3.4 from booting.
  • Loading branch information
lukasgraf committed Mar 23, 2017
1 parent 24828cd commit 69859d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CHANGES.rst
Expand Up @@ -4,7 +4,11 @@ Changelog
1.0a11 (unreleased)
-------------------

- Nothing changed yet.
Bugfixes:

- Make import of LocalrolesModifiedEvent conditional, so plone.restapi
doesn't prevent Plone 4.3 deployments < 4.3.4 from booting.
[lgraf]


1.0a10 (2017-03-22)
Expand Down
16 changes: 11 additions & 5 deletions src/plone/restapi/deserializer/local_roles.py
@@ -1,15 +1,20 @@
# -*- coding: utf-8 -*-
from AccessControl.interfaces import IRoleManager
from Products.CMFCore.interfaces import ICatalogAware

from plone.app.workflow.events import LocalrolesModifiedEvent
from plone.restapi.deserializer import json_body
from plone.restapi.interfaces import IDeserializeFromJson
from Products.CMFCore.interfaces import ICatalogAware
from zope.component import adapter
from zope.component import getMultiAdapter
from zope.event import notify
from zope.interface import Interface
from zope.interface import implementer
from zope.interface import Interface

try:
from plone.app.workflow.events import LocalrolesModifiedEvent
LOCALROLES_MODIFIED_EVENT_AVAILABLE = True
except ImportError:
# Plone < 4.3.4
LOCALROLES_MODIFIED_EVENT_AVAILABLE = False


marker = object()
Expand Down Expand Up @@ -53,4 +58,5 @@ def __call__(self):

if ICatalogAware(self.context) and (inherit_reindex or roles_reindex):
self.context.reindexObjectSecurity()
notify(LocalrolesModifiedEvent(self.context, self.request))
if LOCALROLES_MODIFIED_EVENT_AVAILABLE:
notify(LocalrolesModifiedEvent(self.context, self.request))

0 comments on commit 69859d6

Please sign in to comment.