[Testbot] Plone 4.3 - Python 2.6 - Build # 1877 - Still failing! - 7 failure(s)
jenkins at plone.org
jenkins at plone.org
Wed Mar 19 20:05:22 UTC 2014
-------------------------------------------------------------------------------
Plone 4.3 - Python 2.6 - Build # 1877 - Still Failing!
-------------------------------------------------------------------------------
http://jenkins.plone.org/job/plone-4.3-python-2.6/1877/
-------------------------------------------------------------------------------
CHANGES
-------------------------------------------------------------------------------
Repository: plone.app.workflow
Branch: refs/heads/2.1.x
Date: 2014-03-19T08:21:34+01:00
Author: Robert Niederreiter (rnixx) <office at squarewave.at>
Commit: https://github.com/plone/plone.app.workflow/commit/761cf845d38b5358af49ef885e73884332d927cd
Introduce LocalrolesModifiedEvent
Files changed:
A plone/app/workflow/events.py
M CHANGES.txt
M README.txt
M plone/app/workflow/browser/sharing.py
M plone/app/workflow/interfaces.py
M plone/app/workflow/tests/test_sharing_view.py
M setup.py
diff --git a/CHANGES.txt b/CHANGES.txt
index 941b455..d9ebf82 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,10 @@ Changelog
2.1.8 (unreleased)
------------------
+- Introduce ``plone.app.workflow.interfaces.ILocalrolesModifiedEvent``.
+ ``LocalrolesModifiedEvent`` gets fired after local roles have been changed.
+ [rnix]
+
- Introduce ``required_interface`` attribute on
``plone.app.workflow.interfaces.ISharingPageRole``.
[rnix]
diff --git a/README.txt b/README.txt
index bfcc5f4..ca551b5 100644
--- a/README.txt
+++ b/README.txt
@@ -1,11 +1,15 @@
Introduction
============
-plone.app.workflow contains workflow- and security-related features for Plone,
-including the sharing view.
+``plone.app.workflow`` contains workflow- and security-related features for
+Plone, including the sharing view.
-It also supports the `sharing.xml` GenericSetup syntax, to add new roles to
-the "Sharing" page::
+
+Generic Setup
+-------------
+
+This package supports the GenericSetup syntax to add new roles to the "Sharing"
+page. Local roles are defined in ``sharing.xml`` and looks as follows::
<sharing xmlns:i18n="http://xml.zope.org/namespaces/i18n" i18n:domain="plone">
<role
@@ -17,5 +21,20 @@ the "Sharing" page::
/>
</sharing>
-The `interface` attribute is optional. It declares the required interface a
-context must implement, so that the given role is displayed in the sharing tab.
+``id`` and ``title`` are mandatory, while ``permission`` and ``interface`` are
+optional.
+
+The ``permission`` attribute defines which permission is required in order to
+display the related role in the sharing form.
+
+The ``interface`` attribute declares the required interface a context must
+implement in order to display the related role in the sharing form.
+
+
+Event notification
+------------------
+
+This package introduces ``ILocalrolesModifiedEvent`` which derives from
+``zope.lifecycleevent.IModifiedEvent``. The concrete
+``LocalrolesModifiedEvent`` gets fired after local roles have been modified and
+after object security has been reindexed.
diff --git a/plone/app/workflow/browser/sharing.py b/plone/app/workflow/browser/sharing.py
index 3b55bf7..c0e0a47 100644
--- a/plone/app/workflow/browser/sharing.py
+++ b/plone/app/workflow/browser/sharing.py
@@ -3,6 +3,7 @@
from plone.memoize.instance import memoize, clearafter
from zope.component import getUtilitiesFor, getMultiAdapter
from zope.i18n import translate
+from zope.event import notify
from Acquisition import aq_parent, aq_base
from AccessControl import Unauthorized
@@ -17,6 +18,7 @@
from plone.app.workflow import PloneMessageFactory as _
from plone.app.workflow.interfaces import ISharingPageRole
+from plone.app.workflow.events import LocalrolesModifiedEvent
import json
@@ -105,6 +107,7 @@ def handle_form(self):
or reindex
if reindex:
self.context.reindexObjectSecurity()
+ notify(LocalrolesModifiedEvent(self.context, self.request))
IStatusMessage(self.request).addStatusMessage(
_(u"Changes saved."), type='info')
diff --git a/plone/app/workflow/events.py b/plone/app/workflow/events.py
new file mode 100644
index 0000000..0185b55
--- /dev/null
+++ b/plone/app/workflow/events.py
@@ -0,0 +1,9 @@
+from zope.interface import implementer
+from zope.lifecycleevent import ObjectModifiedEvent
+from plone.app.workflow.interfaces import ILocalrolesModifiedEvent
+
+
+ at implementer(ILocalrolesModifiedEvent)
+class LocalrolesModifiedEvent(ObjectModifiedEvent):
+ """Gets fired after local roles of an object has been changed.
+ """
diff --git a/plone/app/workflow/interfaces.py b/plone/app/workflow/interfaces.py
index e485e9c..73ddac9 100644
--- a/plone/app/workflow/interfaces.py
+++ b/plone/app/workflow/interfaces.py
@@ -1,7 +1,14 @@
from zope.interface import Interface
+from zope.lifecycleevent.interfaces import IObjectModifiedEvent
from zope import schema
+class ILocalrolesModifiedEvent(IObjectModifiedEvent):
+ """Interface for event which get fired after local roles of an object has
+ been changed.
+ """
+
+
class ISharingPageRole(Interface):
"""A named utility providing information about roles that are managed
by the sharing page.
diff --git a/plone/app/workflow/tests/test_sharing_view.py b/plone/app/workflow/tests/test_sharing_view.py
index 920d1fd..cdd8249 100644
--- a/plone/app/workflow/tests/test_sharing_view.py
+++ b/plone/app/workflow/tests/test_sharing_view.py
@@ -135,6 +135,39 @@ def getRoles(self, user_id):
self.assertEqual('borguser', info[1]['id'])
self.assertEqual('acquired', info[1]['roles'][u'Contributor'])
+ def test_localroles_modified_event(self):
+ from zope.interface import Interface
+ from zope.interface import implementer
+ from zope.event import notify
+ from zope.component import getGlobalSiteManager
+ from plone.app.workflow.interfaces import ILocalrolesModifiedEvent
+ from plone.app.workflow.events import LocalrolesModifiedEvent
+ # define local roles modified sensitive interface and class
+ class ILRMEContext(Interface):
+ pass
+ @implementer(ILRMEContext)
+ class LRMEContext(object):
+ def __init__(self):
+ # gets set by handler
+ self.context = None
+ self.event = None
+ # define handler
+ def lrme_handler(context, event):
+ context.context = context
+ context.event = event
+ # register handler
+ gsm = getGlobalSiteManager()
+ gsm.registerHandler(
+ lrme_handler, (ILRMEContext, ILocalrolesModifiedEvent))
+ # create object and notify subscriber
+ context = LRMEContext()
+ request = self.app.REQUEST
+ event = LocalrolesModifiedEvent(context, request)
+ notify(event)
+ # check subscriber called
+ self.assertEqual(context.context, context)
+ self.assertEqual(context.event, event)
+
def test_suite():
from unittest import TestSuite, makeSuite
diff --git a/setup.py b/setup.py
index bd7e034..cd2732e 100644
--- a/setup.py
+++ b/setup.py
@@ -39,6 +39,7 @@
'zope.i18n',
'zope.i18nmessageid',
'zope.interface',
+ 'zope.lifecycleevent',
'zope.schema',
'zope.site',
'zope.testing',
-------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CHANGES.log
Type: application/octet-stream
Size: 6963 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20140319/e2c3ecd2/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.log
Type: application/octet-stream
Size: 168512 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20140319/e2c3ecd2/attachment-0003.obj>
More information about the Testbot
mailing list