[Testbot] Plone 5.0 - Python 2.7 - Build # 1997 - Still failing! - 7 failure(s)

jenkins at plone.org jenkins at plone.org
Tue Mar 18 11:51:35 UTC 2014


-------------------------------------------------------------------------------
Plone 5.0 - Python 2.7 - Build # 1997 - Still Failing!
-------------------------------------------------------------------------------

http://jenkins.plone.org/job/plone-5.0-python-2.7/1997/


-------------------------------------------------------------------------------
CHANGES
-------------------------------------------------------------------------------

Repository: plone.app.workflow
Branch: refs/heads/master
Date: 2014-03-14T20:41:11+01:00
Author: Robert Niederreiter (rnixx) <office at squarewave.at>
Commit: https://github.com/plone/plone.app.workflow/commit/65a97fd01afa4fbf17182e7100960e36a9a0e3af

Introduce ``required_interface`` attribute on ``plone.app.workflow.interfaces.ISharingPageRole``

Files changed:
M CHANGES.txt
M plone/app/workflow/browser/sharing.py
M plone/app/workflow/exportimport.py
M plone/app/workflow/interfaces.py
M plone/app/workflow/localroles.py
M plone/app/workflow/tests/test_exportimport.py
M setup.py

diff --git a/CHANGES.txt b/CHANGES.txt
index 38423bf..6cf6871 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,10 +1,12 @@
 Changelog
 =========
 
-2.2.1 (unreleased)
-------------------
+2.3 (unreleased)
+----------------
 
-- Nothing changed yet.
+- Introduce ``required_interface`` attribute on
+  ``plone.app.workflow.interfaces.ISharingPageRole``.
+  [rnix]
 
 
 2.2.0 (2014-02-23)
diff --git a/plone/app/workflow/browser/sharing.py b/plone/app/workflow/browser/sharing.py
index f73ece4..09ec4d3 100644
--- a/plone/app/workflow/browser/sharing.py
+++ b/plone/app/workflow/browser/sharing.py
@@ -132,8 +132,13 @@ def roles(self):
 
         for name, utility in getUtilitiesFor(ISharingPageRole):
             permission = utility.required_permission
-            if permission is None or portal_membership.checkPermission(permission, context):
-                pairs.append(dict(id = name, title = utility.title))
+            if permission is not None:
+                if not portal_membership.checkPermission(permission, context):
+                    continue
+            iface = utility.required_interface
+            if iface is not None and not iface.providedBy(context):
+                continue
+            pairs.append(dict(id = name, title = utility.title))
 
         pairs.sort(key=lambda x: normalizeString(translate(x["title"], context=self.request)))
         return pairs
diff --git a/plone/app/workflow/exportimport.py b/plone/app/workflow/exportimport.py
index 3333d91..ffdc81b 100644
--- a/plone/app/workflow/exportimport.py
+++ b/plone/app/workflow/exportimport.py
@@ -8,6 +8,8 @@
 from zope.component import queryMultiAdapter
 from zope.component.interfaces import IComponentRegistry
 
+from zope.dottedname.resolve import resolve
+
 from Products.GenericSetup.interfaces import IBody
 from Products.GenericSetup.interfaces import ISetupEnviron
 from Products.GenericSetup.utils import XMLAdapterBase
@@ -16,6 +18,7 @@
 PMF = MessageFactory('plone')
 
 
+
 class PersistentSharingPageRole(Persistent):
     """These are registered as local utilities when managing the sharing
     page roles.
@@ -24,10 +27,13 @@ class PersistentSharingPageRole(Persistent):
 
     title = u""
     required_permission = None
+    required_interface = None
 
-    def __init__(self, title=u"", required_permission=None):
+    def __init__(self, title=u"",
+                 required_permission=None, required_interface=None):
         self.title = PMF(title)
         self.required_permission = required_permission
+        self.required_interface = required_interface
 
 
 class SharingXMLAdapter(XMLAdapterBase):
@@ -78,6 +84,9 @@ def _initRole(self, node):
         name = unicode(node.getAttribute('id'))
         title = unicode(node.getAttribute('title'))
         required = node.getAttribute('permission') or None
+        iface = node.getAttribute('interface') or None
+        if iface is not None:
+            iface = resolve(iface)
 
         if node.hasAttribute('remove'):
             utility = self.context.queryUtility(ISharingPageRole, name)
@@ -87,7 +96,8 @@ def _initRole(self, node):
                 self.context.unregisterUtility(utility, ISharingPageRole, name)
             return
 
-        component = PersistentSharingPageRole(title=title, required_permission=required)
+        component = PersistentSharingPageRole(
+            title=title, required_permission=required, required_interface=iface)
 
         self.context.registerUtility(component, ISharingPageRole, name, info=self.info_tag)
 
@@ -102,6 +112,11 @@ def _extractRole(self, reg):
         if component.required_permission:
             node.setAttribute('permission', component.required_permission)
 
+        if component.required_interface:
+            iface = component.required_interface
+            iface = iface.__module__ + '.' + iface.__name__
+            node.setAttribute('interface', iface)
+
         return node
 
 
diff --git a/plone/app/workflow/interfaces.py b/plone/app/workflow/interfaces.py
index 57397ba..e485e9c 100644
--- a/plone/app/workflow/interfaces.py
+++ b/plone/app/workflow/interfaces.py
@@ -14,5 +14,11 @@ class ISharingPageRole(Interface):
 
     title = schema.TextLine(title=u"A friendly name for the role")
 
-    required_permission = schema.TextLine(title=u"Permission required to manage this local role",
-                                          required=False)
+    required_permission = schema.TextLine(
+        title=u"Permission required to manage this local role",
+        required=False)
+
+    required_interface = schema.Object(
+        schema=Interface,
+        title=u"Context interface required to display this role",
+        required=False)
diff --git a/plone/app/workflow/localroles.py b/plone/app/workflow/localroles.py
index ed9e5f8..d75bb41 100644
--- a/plone/app/workflow/localroles.py
+++ b/plone/app/workflow/localroles.py
@@ -11,12 +11,12 @@
 
 # These are for everyone
 
-
 class ReaderRole(object):
     implements(ISharingPageRole)
 
     title = _(u"title_can_view", default=u"Can view")
     required_permission = permissions.DelegateReaderRole
+    required_interface = None
 
 
 class EditorRole(object):
@@ -24,6 +24,7 @@ class EditorRole(object):
 
     title = _(u"title_can_edit", default=u"Can edit")
     required_permission = permissions.DelegateEditorRole
+    required_interface = None
 
 
 class ContributorRole(object):
@@ -31,6 +32,7 @@ class ContributorRole(object):
 
     title = _(u"title_can_add", default=u"Can add")
     required_permission = permissions.DelegateContributorRole
+    required_interface = None
 
 
 class ReviewerRole(object):
@@ -38,6 +40,7 @@ class ReviewerRole(object):
 
     title = _(u"title_can_review", default=u"Can review")
     required_permission = permissions.DelegateReviewerRole
+    required_interface = None
 
 # Only managers can manage these
 
diff --git a/plone/app/workflow/tests/test_exportimport.py b/plone/app/workflow/tests/test_exportimport.py
index 6a5b39c..f715cfc 100644
--- a/plone/app/workflow/tests/test_exportimport.py
+++ b/plone/app/workflow/tests/test_exportimport.py
@@ -1,5 +1,6 @@
 import unittest
 from plone.testing.zca import UNIT_TESTING
+from zope.interface import Interface
 from zope.component import provideAdapter, provideUtility, getUtilitiesFor, getSiteManager
 
 from five.localsitemanager import make_objectmanager_site
@@ -56,7 +57,10 @@ def test_import_single_no_purge(self):
 
         xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
+    <role id='CopyEditor'
+          title='Can copyedit'
+          permission='Delegate edit copy'
+          interface='zope.interface.Interface' />
 </sharing>
 """
         context = DummyImportContext(self.site, purge=False)
@@ -66,15 +70,21 @@ def test_import_single_no_purge(self):
         roles = self.roles()
 
         self.assertEqual(1, len(roles))
+
         self.assertEqual('Can copyedit', roles['CopyEditor'].title)
         self.assertEqual('Delegate edit copy', roles['CopyEditor'].required_permission)
+        self.assertEqual(Interface, roles['CopyEditor'].required_interface)
 
     def test_import_multiple_no_purge(self):
 
         xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
-    <role id='Controller' title='Can control' />
+    <role id='CopyEditor'
+          title='Can copyedit'
+          permission='Delegate edit copy'
+          interface='zope.interface.Interface' />
+    <role id='Controller'
+          title='Can control' />
 </sharing>
 """
         context = DummyImportContext(self.site, purge=False)
@@ -86,6 +96,7 @@ def test_import_multiple_no_purge(self):
         self.assertEqual(2, len(roles))
         self.assertEqual('Can copyedit', roles['CopyEditor'].title)
         self.assertEqual('Delegate edit copy', roles['CopyEditor'].required_permission)
+        self.assertEqual(Interface, roles['CopyEditor'].required_interface)
         self.assertEqual('Can control', roles['Controller'].title)
         self.assertEqual(None, roles['Controller'].required_permission)
 
@@ -93,7 +104,10 @@ def test_import_multiple_times_no_purge(self):
 
         xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
+    <role id='CopyEditor'
+          title='Can copyedit'
+          permission='Delegate edit copy'
+          interface='zope.interface.Interface' />
 </sharing>
 """
         context = DummyImportContext(self.site, purge=False)
@@ -105,10 +119,12 @@ def test_import_multiple_times_no_purge(self):
         self.assertEqual(1, len(roles))
         self.assertEqual('Can copyedit', roles['CopyEditor'].title)
         self.assertEqual('Delegate edit copy', roles['CopyEditor'].required_permission)
+        self.assertEqual(Interface, roles['CopyEditor'].required_interface)
 
         xml = """\
 <sharing>
-    <role id='Controller' title='Can control' />
+    <role id='Controller'
+          title='Can control' />
 </sharing>
 """
         context = DummyImportContext(self.site, purge=False)
@@ -120,6 +136,7 @@ def test_import_multiple_times_no_purge(self):
         self.assertEqual(2, len(roles))
         self.assertEqual('Can copyedit', roles['CopyEditor'].title)
         self.assertEqual('Delegate edit copy', roles['CopyEditor'].required_permission)
+        self.assertEqual(Interface, roles['CopyEditor'].required_interface)
         self.assertEqual('Can control', roles['Controller'].title)
         self.assertEqual(None, roles['Controller'].required_permission)
 
@@ -127,7 +144,10 @@ def test_import_multiples_times_purge(self):
 
         xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
+    <role id='CopyEditor'
+          title='Can copyedit'
+          permission='Delegate edit copy'
+          interface='zope.interface.Interface' />
 </sharing>
 """
         context = DummyImportContext(self.site, purge=False)
@@ -139,10 +159,12 @@ def test_import_multiples_times_purge(self):
         self.assertEqual(1, len(roles))
         self.assertEqual('Can copyedit', roles['CopyEditor'].title)
         self.assertEqual('Delegate edit copy', roles['CopyEditor'].required_permission)
+        self.assertEqual(Interface, roles['CopyEditor'].required_interface)
 
         xml = """\
 <sharing>
-    <role id='Controller' title='Can control' />
+    <role id='Controller'
+          title='Can control' />
 </sharing>
 """
         context = DummyImportContext(self.site, purge=True)
@@ -159,7 +181,10 @@ def test_import_multiples_times_no_purge_overwrite(self):
 
         xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
+    <role id='CopyEditor'
+          title='Can copyedit'
+          permission='Delegate edit copy'
+          interface='zope.interface.Interface' />
 </sharing>
 """
         context = DummyImportContext(self.site, purge=False)
@@ -171,10 +196,13 @@ def test_import_multiples_times_no_purge_overwrite(self):
         self.assertEqual(1, len(roles))
         self.assertEqual('Can copyedit', roles['CopyEditor'].title)
         self.assertEqual('Delegate edit copy', roles['CopyEditor'].required_permission)
+        self.assertEqual(Interface, roles['CopyEditor'].required_interface)
 
         xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can edit copy' permission='Delegate: CopyEditor'/>
+    <role id='CopyEditor'
+          title='Can edit copy'
+          permission='Delegate: CopyEditor' />
 </sharing>
 """
         context = DummyImportContext(self.site, purge=False)
@@ -186,6 +214,7 @@ def test_import_multiples_times_no_purge_overwrite(self):
         self.assertEqual(1, len(roles))
         self.assertEqual('Can edit copy', roles['CopyEditor'].title)
         self.assertEqual('Delegate: CopyEditor', roles['CopyEditor'].required_permission)
+        self.assertEqual(None, roles['CopyEditor'].required_interface)
 
     def test_import_override_global(self):
 
@@ -193,8 +222,12 @@ def test_import_override_global(self):
 
         xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
-    <role id='DoerOfStuff' title='Can do stuff' permission='Delegate doing stuff'/>
+    <role id='CopyEditor'
+          title='Can copyedit'
+          permission='Delegate edit copy' />
+    <role id='DoerOfStuff'
+          title='Can do stuff'
+          permission='Delegate doing stuff' />
 </sharing>
 """
         context = DummyImportContext(self.site, purge=False)
@@ -206,6 +239,7 @@ def test_import_override_global(self):
         self.assertEqual(2, len(roles))
         self.assertEqual('Can copyedit', roles['CopyEditor'].title)
         self.assertEqual('Delegate edit copy', roles['CopyEditor'].required_permission)
+        self.assertEqual(None, roles['CopyEditor'].required_interface)
         self.assertEqual('Can do stuff', roles['DoerOfStuff'].title)
         self.assertEqual('Delegate doing stuff', roles['DoerOfStuff'].required_permission)
 
@@ -213,7 +247,9 @@ def test_remove_one(self):
 
         xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
+    <role id='CopyEditor'
+          title='Can copyedit'
+          permission='Delegate edit copy' />
 </sharing>
 """
         context = DummyImportContext(self.sm, purge=False)
@@ -227,7 +263,8 @@ def test_remove_one(self):
 
         xml = """\
 <sharing>
-    <role remove="True" id='CopyEditor'/>
+    <role remove="True"
+          id='CopyEditor' />
 </sharing>
 """
         context = DummyImportContext(self.sm, purge=False)
@@ -241,8 +278,12 @@ def test_remove_one(self):
     def test_remove_multiple(self):
         xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
-    <role id='DoerOfStuff' title='Can do stuff' permission='Delegate doing stuff'/>
+    <role id='CopyEditor'
+          title='Can copyedit'
+          permission='Delegate edit copy' />
+    <role id='DoerOfStuff'
+          title='Can do stuff'
+          permission='Delegate doing stuff' />
 </sharing>
 """
         context = DummyImportContext(self.sm, purge=False)
@@ -251,8 +292,13 @@ def test_remove_multiple(self):
 
         xml = """\
 <sharing>
-    <role id='Hacker' title='Can hack' permission='Hack the system'/>
-    <role remove="True" id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
+    <role id='Hacker'
+          title='Can hack'
+          permission='Hack the system' />
+    <role remove="True"
+          id='CopyEditor'
+          title='Can copyedit'
+          permission='Delegate edit copy' />
 </sharing>
 """
         context = DummyImportContext(self.sm, purge=False)
@@ -291,8 +337,9 @@ def test_export_multiple(self):
 
         import_xml = """\
 <sharing>
-    <role id='CopyEditor' title='Can copyedit' permission='Delegate edit copy'/>
-    <role id='Controller' title='Can control' />
+ <role title="Can control" id="Controller"/>
+ <role title="Can copyedit" id="CopyEditor"
+    interface="zope.interface.Interface" permission="Delegate edit copy"/>
 </sharing>
 """
 
@@ -300,7 +347,8 @@ def test_export_multiple(self):
 <?xml version="1.0"?>
 <sharing>
  <role title="Can control" id="Controller"/>
- <role title="Can copyedit" id="CopyEditor" permission="Delegate edit copy"/>
+ <role title="Can copyedit" id="CopyEditor"
+    interface="zope.interface.Interface" permission="Delegate edit copy"/>
 </sharing>
 """
 
@@ -313,6 +361,7 @@ def test_export_multiple(self):
         export_sharing(export_context)
 
         self.assertEqual('sharing.xml', export_context._wrote[0][0])
+
         self.assertEqual(export_xml, export_context._wrote[0][1])
 
 
diff --git a/setup.py b/setup.py
index a01c2bc..13e4704 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 from setuptools import setup, find_packages
 
-version = '2.2.1.dev0'
+version = '2.3.dev0'
 
 setup(name='plone.app.workflow',
       version=version,
@@ -34,6 +34,7 @@
         'plone.memoize',
         'transaction',
         'zope.component',
+        'zope.dottedname',
         'zope.i18n',
         'zope.i18nmessageid',
         'zope.interface',


Repository: plone.app.workflow
Branch: refs/heads/master
Date: 2014-03-14T20:51:48+01:00
Author: Robert Niederreiter (rnixx) <office at squarewave.at>
Commit: https://github.com/plone/plone.app.workflow/commit/8c244799d984cb7bec79270397cf8aeff8468de9

update README

Files changed:
M README.txt

diff --git a/README.txt b/README.txt
index abba57b..148faf3 100644
--- a/README.txt
+++ b/README.txt
@@ -12,6 +12,7 @@ the "Sharing" page.::
           id="CopyEditor"
           title="Can edit copy"
           permission="Manage portal"
+          interface="Products.CMFPlone.interfaces.ISiteRoot"
           i18n:attributes="title"
           />
   </sharing>


Repository: plone.app.workflow
Branch: refs/heads/master
Date: 2014-03-17T13:18:09+01:00
Author: Robert Niederreiter (rnixx) <office at squarewave.at>
Commit: https://github.com/plone/plone.app.workflow/commit/0fbc02da8565f7fb98f1f9d1e433746bf239bb8e

be friendly to utilities implemented without required_interface

Files changed:
M plone/app/workflow/browser/sharing.py

diff --git a/plone/app/workflow/browser/sharing.py b/plone/app/workflow/browser/sharing.py
index 09ec4d3..de888b7 100644
--- a/plone/app/workflow/browser/sharing.py
+++ b/plone/app/workflow/browser/sharing.py
@@ -135,7 +135,8 @@ def roles(self):
             if permission is not None:
                 if not portal_membership.checkPermission(permission, context):
                     continue
-            iface = utility.required_interface
+            # be friendly to utilities implemented without required_interface
+            iface = getattr(utility, 'required_interface', None)
             if iface is not None and not iface.providedBy(context):
                 continue
             pairs.append(dict(id = name, title = utility.title))


Repository: plone.app.workflow
Branch: refs/heads/master
Date: 2014-03-18T11:58:03+01:00
Author: Johannes Raggam (thet) <raggam-nl at adm.at>
Commit: https://github.com/plone/plone.app.workflow/commit/c6c60bf964d3602c5a8f2b6c57ffbe8201cb6fb1

about the interface attribute on the sharing tab

Files changed:
M README.txt

diff --git a/README.txt b/README.txt
index 148faf3..445876e 100644
--- a/README.txt
+++ b/README.txt
@@ -16,3 +16,6 @@ the "Sharing" page.::
           i18n:attributes="title"
           />
   </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.




-------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CHANGES.log
Type: application/octet-stream
Size: 19369 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20140318/ea8be2de/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.log
Type: application/octet-stream
Size: 186491 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20140318/ea8be2de/attachment-0003.obj>


More information about the Testbot mailing list