Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DeprecationWarnings occurring on Zope 5. #82

Merged
merged 10 commits into from
Oct 30, 2020
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Change Log
2.5.1 (unreleased)
------------------

- Nothing changed yet.
- Fix DeprecationWarnings occurring on Zope 5.


2.5 (2020-10-12)
Expand Down
2 changes: 1 addition & 1 deletion Products/PluggableAuthService/PropertiedUser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

from AccessControl.PermissionRole import _what_not_even_god_should_do
from AccessControl.User import BasicUser
from AccessControl.users import BasicUser
from Acquisition import aq_inner
from Acquisition import aq_parent

Expand Down
3 changes: 1 addition & 2 deletions Products/PluggableAuthService/UserPropertySheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
from DateTime.DateTime import DateTime
from OFS.Image import Image

from Products.PluggableAuthService.utils import classImplements

from .interfaces.propertysheets import IPropertySheet
from .utils import classImplements


StringTypes = (str, six.text_type)
Expand Down
6 changes: 3 additions & 3 deletions Products/PluggableAuthService/plugins/BasePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from zope.interface import implementedBy
from zope.interface import providedBy

from Products.PluggableAuthService.permissions import ManageUsers
from Products.PluggableAuthService.utils import classImplements
from Products.PluggableAuthService.utils import createViewName
from ..permissions import ManageUsers
from ..utils import classImplements
from ..utils import createViewName


def flattenInterfaces(implemented):
Expand Down
6 changes: 3 additions & 3 deletions Products/PluggableAuthService/plugins/LocalRolePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zope.interface import Interface

from Products.PluggableAuthService.interfaces.plugins import IRolesPlugin
from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
from Products.PluggableAuthService.utils import classImplements
from ..interfaces.plugins import IRolesPlugin
from ..utils import classImplements
from .BasePlugin import BasePlugin


class ILocalRolePlugin(Interface):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import manage_users
from AccessControl.User import nobody
from AccessControl.users import nobody
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from zope.interface import Interface

from Products.PluggableAuthService.interfaces.plugins import IGroupsPlugin
from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
from Products.PluggableAuthService.PropertiedUser import PropertiedUser
from Products.PluggableAuthService.utils import classImplements
from ..interfaces.plugins import IGroupsPlugin
from ..PropertiedUser import PropertiedUser
from ..utils import classImplements
from .BasePlugin import BasePlugin


class IRecursiveGroupsPlugin(Interface):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
if HAVE_ZSERVER:
from ZServer.FTPRequest import FTPRequest

from Products.PluggableAuthService.interfaces.request import IFTPRequest
from ..interfaces.request import IFTPRequest


class IRequestTypeSnifferPlugin(Interface):
Expand Down
7 changes: 4 additions & 3 deletions Products/PluggableAuthService/plugins/ScriptablePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
from zope.interface import providedBy

import Products
from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
from Products.PluggableAuthService.utils import classImplements
from Products.PluggableAuthService.utils import directlyProvides

from ..utils import classImplements
from ..utils import directlyProvides
from .BasePlugin import BasePlugin


class IScriptablePlugin(Interface):
Expand Down
2 changes: 1 addition & 1 deletion Products/PluggableAuthService/plugins/ZODBUserManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import six

from AccessControl import AuthEncoding
from AccessControl import ClassSecurityInfo
from AccessControl.class_init import InitializeClass
from AccessControl.requestmethod import postonly
from AccessControl.SecurityManagement import getSecurityManager
from AuthEncoding import AuthEncoding
from BTrees.OOBTree import OOBTree
from OFS.Cache import Cacheable
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def setup_sniffer(self):
def setup_user(self):
# Create a user for testing:

from Products.PluggableAuthService.PropertiedUser import PropertiedUser
from ...PropertiedUser import PropertiedUser
pas = self.folder.acl_users
self.assertIsNone(pas.getUserById('test_user_'))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
##############################################################################
import unittest

from Products.PluggableAuthService.tests.conformance import \
IChallengePlugin_conformance
from Products.PluggableAuthService.tests.conformance import \
ILoginPasswordHostExtractionPlugin_conformance

from ...tests.conformance import IChallengePlugin_conformance
from ...tests.conformance import ILoginPasswordHostExtractionPlugin_conformance
from ...tests.test_PluggableAuthService import FauxContainer
from ...tests.test_PluggableAuthService import FauxObject
from ...tests.test_PluggableAuthService import FauxRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
##############################################################################
import unittest

from AccessControl.AuthEncoding import pw_encrypt
from AuthEncoding.AuthEncoding import pw_encrypt
from zExceptions import Forbidden

from ...plugins.tests.helpers import makeRequestAndResponse
Expand Down Expand Up @@ -521,7 +521,7 @@ def test_getUserByIdWithOptionalMangling(self):

def test_addUser_with_not_yet_encrypted_password(self):
# See collector #1869 && #1926
from AccessControl.AuthEncoding import is_encrypted
from AuthEncoding.AuthEncoding import is_encrypted

USER_ID = 'not_yet_encrypted'
PASSWORD = 'password'
Expand All @@ -538,7 +538,7 @@ def test_addUser_with_not_yet_encrypted_password(self):

def test_addUser_with_preencrypted_password(self):
# See collector #1869 && #1926
from AccessControl.AuthEncoding import pw_encrypt
from AuthEncoding.AuthEncoding import pw_encrypt

USER_ID = 'already_encrypted'
PASSWORD = 'password'
Expand All @@ -554,7 +554,7 @@ def test_addUser_with_preencrypted_password(self):
self.assertEqual(uid_and_info, (USER_ID, USER_ID))

def test_updateUserPassword_with_not_yet_encrypted_password(self):
from AccessControl.AuthEncoding import is_encrypted
from AuthEncoding.AuthEncoding import is_encrypted

USER_ID = 'not_yet_encrypted'
PASSWORD = 'password'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
ConformsToIFilesystemExporter
from Products.GenericSetup.tests.conformance import \
ConformsToIFilesystemImporter
from Products.PluggableAuthService.tests.utils import _setUpDefaultTraversable

from ...tests.utils import _setUpDefaultTraversable


class _TestBase(BaseRegistryTests, ConformsToIFilesystemExporter,
Expand Down
6 changes: 3 additions & 3 deletions Products/PluggableAuthService/tests/test_Caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def _makePlugins(self, plugin_type_info=None):

def _makeAndFill(self):

from Products.PluggableAuthService.plugins import ZODBRoleManager
from Products.PluggableAuthService.plugins import ZODBUserManager
from ..plugins import ZODBRoleManager
from ..plugins import ZODBUserManager

plugin_registry = self._makePlugins()
user_source = ZODBUserManager.ZODBUserManager('zodb_users')
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_caching_in_PAS(self):
# First, we register the ZODBUserManager as a plugin suitable
# for storing and returning user objects and the ZODBRoleManager
# for roles. Basic scaffolding to be able to store and retrieve users.
from Products.PluggableAuthService.interfaces import plugins
from ..interfaces import plugins

plugin_registry.activatePlugin(plugins.IUserEnumerationPlugin,
user_source.getId())
Expand Down
4 changes: 2 additions & 2 deletions Products/PluggableAuthService/tests/test_MoreCaching.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

from AccessControl.Permissions import view as View

from Products.PluggableAuthService.interfaces.plugins import IExtractionPlugin
from Products.PluggableAuthService.tests import pastc
from ..interfaces.plugins import IExtractionPlugin
from . import pastc


class CachingTests(pastc.PASTestCase):
Expand Down
17 changes: 6 additions & 11 deletions Products/PluggableAuthService/tests/test_PluggableAuthService.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
from zExceptions import Unauthorized
from zope.interface import implementer

from Products.PluggableAuthService.utils import directlyProvides

from ..interfaces.plugins import INotCompetentPlugin
from ..utils import directlyProvides
from .conformance import IUserFolder_conformance


Expand Down Expand Up @@ -756,8 +755,7 @@ def test__extractUserIds_authenticate_emergency_user_broken_extor(self):

from AccessControl.users import UnrestrictedUser

from Products.PluggableAuthService import PluggableAuthService

from .. import PluggableAuthService
from ..interfaces.plugins import IExtractionPlugin

old_eu = PluggableAuthService.emergency_user
Expand Down Expand Up @@ -862,8 +860,7 @@ def test__extractUserIds_authenticate_emrgncy_with_broken_authicator(self):

from AccessControl.users import UnrestrictedUser

from Products.PluggableAuthService import PluggableAuthService

from .. import PluggableAuthService
from ..interfaces.plugins import IAuthenticationPlugin
from ..interfaces.plugins import IExtractionPlugin

Expand Down Expand Up @@ -913,8 +910,7 @@ def test__extractUserIds_emergency_user_always_wins(self):

from AccessControl.users import UnrestrictedUser

from Products.PluggableAuthService import PluggableAuthService

from .. import PluggableAuthService
from ..interfaces.plugins import IAuthenticationPlugin
from ..interfaces.plugins import IExtractionPlugin

Expand Down Expand Up @@ -987,8 +983,7 @@ def test__extractUserIds_emergency_user_always_wins_in_transform(self):

from AccessControl.users import UnrestrictedUser

from Products.PluggableAuthService import PluggableAuthService

from .. import PluggableAuthService
from ..interfaces.plugins import IAuthenticationPlugin
from ..interfaces.plugins import IExtractionPlugin

Expand Down Expand Up @@ -1403,7 +1398,7 @@ def test__findEmergencyUser_no_plugins(self):

from AccessControl.users import UnrestrictedUser

from Products.PluggableAuthService import PluggableAuthService
from .. import PluggableAuthService

old_eu = PluggableAuthService.emergency_user

Expand Down
2 changes: 1 addition & 1 deletion Products/PluggableAuthService/tests/test_PropertiedUser.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PropertiedUserTests(unittest.TestCase, IBasicUser_conformance,

def _getTargetClass(self):

from Products.PluggableAuthService.PropertiedUser import PropertiedUser
from ..PropertiedUser import PropertiedUser

return PropertiedUser

Expand Down
4 changes: 2 additions & 2 deletions Products/PluggableAuthService/tests/test_UserFolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def user_names(self):

def test__doAddUser_with_not_yet_encrypted_passwords(self):
# See collector #1869 && #1926
from AccessControl.AuthEncoding import is_encrypted
from AuthEncoding.AuthEncoding import is_encrypted

USER_ID = 'not_yet_encrypted'
PASSWORD = 'password'
Expand All @@ -240,7 +240,7 @@ def test__doAddUser_with_not_yet_encrypted_passwords(self):

def test__doAddUser_with_preencrypted_passwords(self):
# See collector #1869 && #1926
from AccessControl.AuthEncoding import pw_encrypt
from AuthEncoding.AuthEncoding import pw_encrypt

USER_ID = 'already_encrypted'
PASSWORD = 'password'
Expand Down
20 changes: 10 additions & 10 deletions Products/PluggableAuthService/tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ class ConformsToIPASEvent:
def test_class_conforms_to_IPASEvent(self):
from zope.interface.verify import verifyClass

from Products.PluggableAuthService.interfaces.events import IPASEvent
from ..interfaces.events import IPASEvent
verifyClass(IPASEvent, self._getTargetClass())

def test_instance_conforms_to_IPASEvent(self):
from zope.interface.verify import verifyObject

from Products.PluggableAuthService.interfaces.events import IPASEvent
from ..interfaces.events import IPASEvent
verifyObject(IPASEvent, self._makeOne())


class PASEventTests(unittest.TestCase, ConformsToIPASEvent):

def _getTargetClass(self):
from Products.PluggableAuthService.events import PASEvent
from ..events import PASEvent
return PASEvent

def _makeOne(self, principal=None):
Expand All @@ -44,7 +44,7 @@ def _makeOne(self, principal=None):
class PrincipalCreatedTests(unittest.TestCase, ConformsToIPASEvent):

def _getTargetClass(self):
from Products.PluggableAuthService.events import PrincipalCreated
from ..events import PrincipalCreated
return PrincipalCreated

def _makeOne(self, principal=None):
Expand All @@ -68,7 +68,7 @@ def test_instance_conforms_to_IPrincipalCreatedEvent(self):
class PrincipalDeletedTests(unittest.TestCase, ConformsToIPASEvent):

def _getTargetClass(self):
from Products.PluggableAuthService.events import PrincipalDeleted
from ..events import PrincipalDeleted
return PrincipalDeleted

def _makeOne(self, principal=None):
Expand All @@ -92,7 +92,7 @@ def test_instance_conforms_to_IPrincipalDeletedEvent(self):
class CredentialsUpdatedTests(unittest.TestCase, ConformsToIPASEvent):

def _getTargetClass(self):
from Products.PluggableAuthService.events import CredentialsUpdated
from ..events import CredentialsUpdated
return CredentialsUpdated

def _makeOne(self, principal=None, password='password'):
Expand All @@ -116,7 +116,7 @@ def test_instance_conforms_to_ICredentialsUpdatedEvent(self):
class PropertiesUpdatedTests(unittest.TestCase, ConformsToIPASEvent):

def _getTargetClass(self):
from Products.PluggableAuthService.events import PropertiesUpdated
from ..events import PropertiesUpdated
return PropertiesUpdated

def _makeOne(self, principal=None, properties=None):
Expand Down Expand Up @@ -146,7 +146,7 @@ class DummyPrincipal(object):
class GroupCreatedTests(unittest.TestCase, ConformsToIPASEvent):

def _getTargetClass(self):
from Products.PluggableAuthService.events import GroupCreated
from ..events import GroupCreated
return GroupCreated

def _makeOne(self, Group=None):
Expand All @@ -170,7 +170,7 @@ def test_instance_conforms_to_IGroupCreatedEvent(self):
class GroupDeletedTests(unittest.TestCase, ConformsToIPASEvent):

def _getTargetClass(self):
from Products.PluggableAuthService.events import GroupDeleted
from ..events import GroupDeleted
return GroupDeleted

def _makeOne(self, Group=None):
Expand All @@ -194,7 +194,7 @@ def test_instance_conforms_to_IGroupDeletedEvent(self):
class PrincipalAddedToGroupTests(unittest.TestCase, ConformsToIPASEvent):

def _getTargetClass(self):
from Products.PluggableAuthService.events import PrincipalAddedToGroup
from ..events import PrincipalAddedToGroup
return PrincipalAddedToGroup

def _makeOne(self, principal=None, group_id=None):
Expand Down
Loading