[Checkins] SVN: Products.PluggableAuthService/trunk/ Cleaned out a number of old imports, we require Zope >= 2.12.

Hanno Schlichting hannosch at hannosch.eu
Sun Jun 6 12:23:10 EDT 2010


Log message for revision 113213:
  Cleaned out a number of old imports, we require Zope >= 2.12.
  

Changed:
  U   Products.PluggableAuthService/trunk/CHANGES.txt
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/UserPropertySheet.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/authservice.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/plugins.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/propertysheets.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/request.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/BasePlugin.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/DynamicGroupsPlugin.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBGroupManager.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBRoleManager.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBUserManager.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/conformance.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/test_exportimport.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/utils.py
  U   Products.PluggableAuthService/trunk/Products/PluggableAuthService/utils.py
  U   Products.PluggableAuthService/trunk/Products/__init__.py

-=-
Modified: Products.PluggableAuthService/trunk/CHANGES.txt
===================================================================
--- Products.PluggableAuthService/trunk/CHANGES.txt	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/CHANGES.txt	2010-06-06 16:23:10 UTC (rev 113213)
@@ -4,6 +4,8 @@
 1.7.1 (unreleased)
 ------------------
 
+- Cleaned out a number of old imports, we require Zope >= 2.12.
+
 - Updated setDefaultRoles to use the addPermission API if available.
 
 

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/UserPropertySheet.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/UserPropertySheet.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/UserPropertySheet.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -18,20 +18,12 @@
 from types import IntType
 from types import FloatType
 from types import LongType
-from types import TupleType
-from types import ListType
 from types import InstanceType
 from types import BooleanType
 
-try:
-    from types import StringTypes
-except ImportError:
-    from types import StringType
-    from types import UnicodeType
-    StringTypes = ( StringType, UnicodeType )
+StringTypes = (str, unicode, )
+_SequenceTypes = (tuple, list, )
 
-_SequenceTypes = ( TupleType, ListType )
-
 from DateTime.DateTime import DateTime
 
 from OFS.Image import Image

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/authservice.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/authservice.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/authservice.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -16,10 +16,7 @@
 $Id$
 """
 
-try:
-    from zope.interface import Interface
-except ImportError:
-    from Interface import Interface
+from zope.interface import Interface
 from AccessControl.ZopeSecurityPolicy import _noroles
 
 

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/plugins.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/plugins.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/plugins.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -16,11 +16,9 @@
 $Id$
 """
 
-try:
-    from zope.interface import Interface
-except ImportError:
-    from Interface import Interface
+from zope.interface import Interface
 
+
 class IExtractionPlugin( Interface ):
 
     """ Extracts login name and credentials from a request.

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/propertysheets.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/propertysheets.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/propertysheets.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -16,11 +16,9 @@
 $Id$
 """
 
-try:
-    from zope.interface import Interface
-except ImportError:
-    from Interface import Interface
+from zope.interface import Interface
 
+
 class IPropertySheet( Interface ):
 
     """ Interface for queryable property sheets.

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/request.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/request.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/interfaces/request.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -18,11 +18,9 @@
 # Eventually, those interfaces should be moved to Zope and imported
 # here as aliases for backward compatibility.
 
-try:
-    from zope.interface import Interface
-except ImportError:
-    from Interface import Interface
+from zope.interface import Interface
 
+
 class IRequest( Interface ):
 
     """ Base Request Interface

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/BasePlugin.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/BasePlugin.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/BasePlugin.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -20,13 +20,6 @@
 from Acquisition import aq_base, aq_parent, aq_inner
 from AccessControl import ClassSecurityInfo
 from App.class_init import default__class_init__ as InitializeClass
-try:
-    from zope.interface import Interface
-except ImportError:
-    from Interface.Implements import flattenInterfaces
-else:
-    def flattenInterfaces(implemented):
-        return implemented.flattened()
 
 from zope.interface import implementedBy
 from zope.interface import providedBy
@@ -37,6 +30,10 @@
 from Products.PluggableAuthService.permissions import ManageUsers
 from Products.PluggableAuthService.utils import createViewName
 
+def flattenInterfaces(implemented):
+    return implemented.flattened()
+
+
 class BasePlugin(SimpleItem, PropertyManager):
 
     """ Base class for all PluggableAuthService Plugins

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/DynamicGroupsPlugin.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/DynamicGroupsPlugin.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/DynamicGroupsPlugin.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -19,6 +19,7 @@
 
 from Acquisition import aq_inner, aq_parent
 from AccessControl import ClassSecurityInfo
+from AccessControl.requestmethod import postonly
 from OFS.SimpleItem import SimpleItem
 from OFS.PropertyManager import PropertyManager
 from OFS.Folder import Folder
@@ -39,8 +40,8 @@
 from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
 from Products.PluggableAuthService.utils import createViewName
 from Products.PluggableAuthService.utils import classImplements
-from Products.PluggableAuthService.utils import postonly
 
+
 class IDynamicGroupsPlugin(Interface):
     """ Marker interface.
     """

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBGroupManager.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBGroupManager.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBGroupManager.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -17,6 +17,7 @@
 """
 from Acquisition import aq_parent
 from AccessControl import ClassSecurityInfo
+from AccessControl.requestmethod import postonly
 from App.class_init import InitializeClass
 from BTrees.OOBTree import OOBTree
 
@@ -32,8 +33,8 @@
 from Products.PluggableAuthService.permissions import ManageGroups
 from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
 from Products.PluggableAuthService.utils import classImplements
-from Products.PluggableAuthService.utils import postonly
 
+
 class IZODBGroupManager(Interface):
     """ Marker interface.
     """

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBRoleManager.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBRoleManager.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBRoleManager.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -17,6 +17,7 @@
 """
 from Acquisition import aq_parent, aq_inner
 from AccessControl import ClassSecurityInfo
+from AccessControl.requestmethod import postonly
 from BTrees.OOBTree import OOBTree
 from App.class_init import InitializeClass
 
@@ -34,7 +35,6 @@
 from Products.PluggableAuthService.permissions import ManageUsers
 from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
 from Products.PluggableAuthService.utils import classImplements
-from Products.PluggableAuthService.utils import postonly
 
 import logging 
 

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBUserManager.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBUserManager.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/ZODBUserManager.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -22,6 +22,7 @@
     from sha import sha
 
 from AccessControl import ClassSecurityInfo, AuthEncoding
+from AccessControl.requestmethod import postonly
 from AccessControl.SecurityManagement import getSecurityManager
 from App.class_init import default__class_init__ as InitializeClass
 from BTrees.OOBTree import OOBTree
@@ -43,8 +44,8 @@
 from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
 from Products.PluggableAuthService.utils import classImplements
 from Products.PluggableAuthService.utils import createViewName
-from Products.PluggableAuthService.utils import postonly
 
+
 class IZODBUserManager(Interface):
     """ Marker interface.
     """

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/conformance.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/conformance.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/conformance.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -16,10 +16,7 @@
 $Id$
 """
 
-try:
-    from zope.interface.verify import verifyClass
-except ImportError:
-    from Interface.Verify import verifyClass
+from zope.interface.verify import verifyClass
 
 
 class IExtractionPlugin_conformance:

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/test_exportimport.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/test_exportimport.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/test_exportimport.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -36,10 +36,10 @@
     from zope.interface import Interface
 
     try:
-        from zope.app.testing.placelesssetup import PlacelessSetup
+        from zope.component.testing import PlacelessSetup
     except ImportError:
-        # BBB for Zope 2.8
-        from zope.app.tests.placelesssetup import PlacelessSetup
+        # BBB for Zope 2.11
+        from zope.app.testing.placelesssetup import PlacelessSetup
 
     class _TestBase(PlacelessSetup, BaseRegistryTests):
 
@@ -63,14 +63,9 @@
         def _setUpAdapters(self):
             from zope.app.testing import ztapi
 
-            try:
-                from OFS.interfaces import IObjectManager
-                from OFS.interfaces import ISimpleItem
-                from OFS.interfaces import IPropertyManager
-            except ImportError: # BBB
-                from Products.Five.interfaces import IObjectManager
-                from Products.Five.interfaces import ISimpleItem
-                from Products.Five.interfaces import IPropertyManager
+            from OFS.interfaces import IObjectManager
+            from OFS.interfaces import ISimpleItem
+            from OFS.interfaces import IPropertyManager
 
             from Products.GenericSetup.interfaces import IContentFactoryName
             from Products.GenericSetup.interfaces import ICSVAware
@@ -217,14 +212,9 @@
         def _setUpAdapters(self):
             from zope.app.testing import ztapi
 
-            try:
-                from OFS.interfaces import IObjectManager
-                from OFS.interfaces import IPropertyManager
-                from OFS.interfaces import ISimpleItem
-            except ImportError: # BBB
-                from Products.Five.interfaces import IObjectManager
-                from Products.Five.interfaces import IPropertyManager
-                from Products.Five.interfaces import ISimpleItem
+            from OFS.interfaces import IObjectManager
+            from OFS.interfaces import IPropertyManager
+            from OFS.interfaces import ISimpleItem
 
             from Products.GenericSetup.interfaces import IContentFactory
             from Products.GenericSetup.interfaces import ICSVAware

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/utils.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/utils.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/tests/utils.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -17,14 +17,8 @@
 """
 
 def _setUpDefaultTraversable():
-    # Work around behavior change in Zope 2.10 due to its use of the 
-    # Zope 3 pagetemplates
-    try:
-        from zope.interface import Interface
-        from zope.component import provideAdapter
-        from zope.traversing.interfaces import ITraversable
-        from zope.traversing.adapters import DefaultTraversable
-        provideAdapter(DefaultTraversable, (Interface,), ITraversable)
-    except ImportError:
-        # Zope < 2.10 - no need to do anything
-        pass
+    from zope.interface import Interface
+    from zope.component import provideAdapter
+    from zope.traversing.interfaces import ITraversable
+    from zope.traversing.adapters import DefaultTraversable
+    provideAdapter(DefaultTraversable, (Interface,), ITraversable)

Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/utils.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/utils.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/utils.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -21,49 +21,23 @@
 
 from App.Common import package_home
 
-try:
-    from Products.Five.bridge import fromZ2Interface
-except ImportError:
-    def fromZ2Interface(i):
-        # Raise ValueError to work around a cornerish case where
-        # zope.interface is available but Five is not.
-        raise ValueError, i
 
 from zope import interface
 def directlyProvides(obj, *interfaces):
-    # convert any Zope 2 interfaces to Zope 3 using fromZ2Interface
     normalized_interfaces = []
     for i in interfaces:
-        try:
-            i = fromZ2Interface(i)
-        except ValueError: # already a Zope 3 interface
-            pass
         normalized_interfaces.append(i)
     return interface.directlyProvides(obj, *normalized_interfaces)
 
 def classImplements(class_, *interfaces):
-    # convert any Zope 2 interfaces to Zope 3 using fromZ2Interface
     normalized_interfaces = []
     for i in interfaces:
-        try:
-            i = fromZ2Interface(i)
-        except ValueError: # already a Zope 3 interface
-            pass
         normalized_interfaces.append(i)
     return interface.classImplements(class_, *normalized_interfaces)
 
-# postonly protection
-try:
-    # Zope 2.8.9, 2.9.7 and 2.10.3 (and up)
-    from AccessControl.requestmethod import postonly
-except ImportError:
-    try:
-        # Try the hotfix too
-        from Products.Hotfix_20070320 import postonly
-    except:
-        def postonly(callable): return callable
+# BBB import
+from AccessControl.requestmethod import postonly
 
-
 product_dir = package_home( globals() )
 product_prefix = os.path.join( os.path.split(product_dir)[:-1] )
 

Modified: Products.PluggableAuthService/trunk/Products/__init__.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/__init__.py	2010-06-06 16:14:30 UTC (rev 113212)
+++ Products.PluggableAuthService/trunk/Products/__init__.py	2010-06-06 16:23:10 UTC (rev 113213)
@@ -1,6 +1 @@
-# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
-try:
-    __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
-    from pkgutil import extend_path
-    __path__ = extend_path(__path__, __name__)
+__import__('pkg_resources').declare_namespace(__name__)



More information about the checkins mailing list