Skip to content

Commit

Permalink
Merge 5ee0a4d into b418067
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Jan 18, 2020
2 parents b418067 + 5ee0a4d commit 54c53f3
Show file tree
Hide file tree
Showing 159 changed files with 705 additions and 813 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -76,5 +76,8 @@ Backwards incompatible changes
first, migrate to Python 3 and than switch to Zope 5.
(`#692 <https://github.com/zopefoundation/Zope/issues/692>`_)

- Remove Python 2 support code and dependency on ``six``.
(`#692 <https://github.com/zopefoundation/Zope/issues/692>`_)

- Drop support for running Zope with ZServer as it is Python 2 only.
(`#592 <https://github.com/zopefoundation/Zope/issues/592>`_)
1 change: 1 addition & 0 deletions setup.cfg
Expand Up @@ -14,6 +14,7 @@ ignore =
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_standard_library = _thread
known_third_party = ipaddress, PasteDeploy, six, waitress, chameleon, paste
known_zope = AccessControl, Acquisition, DateTime, DocumentTemplate, ExtensionClass, MultiMapping, Persistence, persistent, RestrictedPython, Testing, transaction, ZConfig, zExceptions, ZODB, zope, Zope2, App
default_section = ZOPE
Expand Down
1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -82,7 +82,6 @@ def _read_file(filename):
'ZConfig >= 2.9.2',
'ZODB',
'setuptools >= 36.2',
'six',
'transaction >= 2.4',
'waitress',
'zExceptions >= 3.4',
Expand Down
5 changes: 2 additions & 3 deletions src/App/ApplicationManager.py
Expand Up @@ -14,8 +14,7 @@
import os
import sys
import time

from six.moves.urllib import parse
from urllib import parse

from AccessControl.class_init import InitializeClass
from AccessControl.requestmethod import requestmethod
Expand All @@ -30,7 +29,7 @@
from Products.PageTemplates.PageTemplateFile import PageTemplateFile


class FakeConnection(object):
class FakeConnection:
# Supports the methods of Connection that CacheManager needs

def __init__(self, db, parent_jar):
Expand Down
6 changes: 2 additions & 4 deletions src/App/Extensions.py
Expand Up @@ -17,14 +17,12 @@
import os
from functools import total_ordering

from six import exec_

import Products
from zExceptions import NotFound


@total_ordering
class FuncCode(object):
class FuncCode:

def __init__(self, f, im=0):
self.co_varnames = f.__code__.co_varnames[im:]
Expand Down Expand Up @@ -183,7 +181,7 @@ def getObject(module, name, reload=0):
raise NotFound("The specified module, '%s', "
"couldn't be opened." % module)
module_dict = {}
exec_(execsrc, module_dict)
exec(execsrc, module_dict)

if old is not None:
# XXX Accretive??
Expand Down
8 changes: 3 additions & 5 deletions src/App/Management.py
Expand Up @@ -15,10 +15,8 @@

import html
import itertools

import six
from six.moves.urllib.parse import quote
from six.moves.urllib.parse import unquote
from urllib.parse import quote
from urllib.parse import unquote

import zope.event
from AccessControl import ClassSecurityInfo
Expand Down Expand Up @@ -206,7 +204,7 @@ def manage_zmi_logout(self, REQUEST, RESPONSE):
def _get_zmi_additionals(self, attrib):
# Get additional assets for styling ZMI defined on properties in ZMI.
additionals = getattr(self, attrib, ()) or ()
if isinstance(additionals, six.string_types):
if isinstance(additionals, str):
additionals = (additionals, )
return additionals

Expand Down
6 changes: 3 additions & 3 deletions src/App/ProductContext.py
Expand Up @@ -35,7 +35,7 @@
LOG = getLogger('ProductContext')


class ProductContext(object):
class ProductContext:

def __init__(self, product, app, package):
self.__prod = product
Expand Down Expand Up @@ -205,15 +205,15 @@ def registerHelpTitle(self, title=None):
pass

def getProductHelp(self):
class DummyHelp(object):
class DummyHelp:
lastRegistered = None
return DummyHelp()

def getApplication(self):
return self.__app


class AttrDict(object):
class AttrDict:

def __init__(self, ob):
self.ob = ob
Expand Down
2 changes: 1 addition & 1 deletion src/App/Undo.py
Expand Up @@ -110,7 +110,7 @@ def manage_undo_transactions(self, transaction_info=(), REQUEST=None):
descriptions.append(tid[-1])

if tids:
transaction.get().note(u"Undo %s" % ' '.join(descriptions))
transaction.get().note("Undo %s" % ' '.join(descriptions))
self._p_jar.db().undoMultiple(tids)

if REQUEST is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/App/ZApplication.py
Expand Up @@ -18,7 +18,7 @@
"""


class ZApplicationWrapper(object):
class ZApplicationWrapper:

def __init__(self, db, name, klass=None):
self._db = db
Expand Down
2 changes: 1 addition & 1 deletion src/App/config.py
Expand Up @@ -51,7 +51,7 @@ def setConfiguration(cfg):
os.environ["INSTANCE_HOME"] = cfg.instancehome


class DefaultConfiguration(object):
class DefaultConfiguration:
"""
This configuration should be used effectively only during unit tests
"""
Expand Down
2 changes: 1 addition & 1 deletion src/App/special_dtml.py
Expand Up @@ -42,7 +42,7 @@
)


class Code(object):
class Code:
pass


Expand Down
2 changes: 1 addition & 1 deletion src/App/tests/testManagement.py
Expand Up @@ -47,7 +47,7 @@ class TestTabs(Testing.ZopeTestCase.ZopeTestCase):

def setUp(self):
from OFS.DTMLMethod import addDTMLMethod
super(TestTabs, self).setUp()
super().setUp()
self.app.REQUEST['PARENTS'] = [self.app]
addDTMLMethod(self.folder, 'page')

Expand Down
18 changes: 9 additions & 9 deletions src/App/tests/test_ApplicationManager.py
Expand Up @@ -8,7 +8,7 @@
import Testing.ZopeTestCase


class DummyConnection(object):
class DummyConnection:

def __init__(self, db):
self.__db = db
Expand All @@ -17,7 +17,7 @@ def db(self):
return self.__db


class DummyDBTab(object):
class DummyDBTab:
def __init__(self, databases=None):
self._databases = databases or {}

Expand All @@ -31,7 +31,7 @@ def getDatabase(self, name):
return self._databases[name]


class DummyDB(object):
class DummyDB:

_packed = None

Expand All @@ -53,22 +53,22 @@ def pack(self, when):
self._packed = when


class ConfigTestBase(object):
class ConfigTestBase:

def setUp(self):
super(ConfigTestBase, self).setUp()
super().setUp()
import App.config
self._old_config = App.config._config

def tearDown(self):
import App.config
App.config._config = self._old_config
super(ConfigTestBase, self).tearDown()
super().tearDown()

def _makeConfig(self, **kw):
import App.config

class DummyConfig(object):
class DummyConfig:
def __init__(self):
self.debug_mode = False

Expand Down Expand Up @@ -286,7 +286,7 @@ def _makeOne(self):
return self._getTargetClass()()

def _makeJar(self, dbname, dbsize):
class Jar(object):
class Jar:
def db(self):
return self._db
jar = Jar()
Expand Down Expand Up @@ -370,7 +370,7 @@ class MenuDtmlTests(ConfigTestBase, Testing.ZopeTestCase.FunctionalTestCase):
"""Browser testing ..dtml.menu.dtml."""

def setUp(self):
super(MenuDtmlTests, self).setUp()
super().setUp()
uf = self.app.acl_users
uf.userFolderAddUser('manager', 'manager_pass', ['Manager'], [])
self.browser = Testing.testbrowser.Browser()
Expand Down
2 changes: 1 addition & 1 deletion src/App/tests/test_class_init.py
Expand Up @@ -29,7 +29,7 @@ def test_extension_class(self):
class AnotherClass(ExtensionClass.Base):
_need__name__ = 1

class C(object):
class C:
foo = AnotherClass

InitializeClass(C)
20 changes: 10 additions & 10 deletions src/OFS/Application.py
Expand Up @@ -179,7 +179,7 @@ def initialize(app):
initializer.initialize()


class AppInitializer(object):
class AppInitializer:
""" Initialze an Application object (called at startup) """

def __init__(self, app):
Expand Down Expand Up @@ -215,21 +215,21 @@ def install_app_manager(self):
del app.__dict__['Control_Panel']
app._objects = tuple(i for i in app._objects
if i['id'] != 'Control_Panel')
self.commit(u'Removed persistent Control_Panel')
self.commit('Removed persistent Control_Panel')

def install_required_roles(self):
app = self.getApp()

# Ensure that Owner role exists.
if hasattr(app, '__ac_roles__') and not ('Owner' in app.__ac_roles__):
app.__ac_roles__ = app.__ac_roles__ + ('Owner',)
self.commit(u'Added Owner role')
self.commit('Added Owner role')

# ensure the Authenticated role exists.
if hasattr(app, '__ac_roles__'):
if 'Authenticated' not in app.__ac_roles__:
app.__ac_roles__ = app.__ac_roles__ + ('Authenticated',)
self.commit(u'Added Authenticated role')
self.commit('Added Authenticated role')

def install_inituser(self):
app = self.getApp()
Expand All @@ -238,7 +238,7 @@ def install_inituser(self):
users = app.acl_users
if hasattr(users, '_createInitialUser'):
app.acl_users._createInitialUser()
self.commit(u'Created initial user')
self.commit('Created initial user')
users = aq_base(users)
migrated = getattr(users, '_ofs_migrated', False)
if not migrated:
Expand All @@ -252,7 +252,7 @@ def install_inituser(self):
users._ofs_migrated = True
users._p_changed = True
app._p_changed = True
transaction.get().note(u'Migrated user folder')
transaction.get().note('Migrated user folder')
transaction.commit()

def install_virtual_hosting(self):
Expand All @@ -266,17 +266,17 @@ def install_virtual_hosting(self):
vhm = VirtualHostMonster()
vhm.id = 'virtual_hosting'
vhm.addToContainer(app)
self.commit(u'Added virtual_hosting')
self.commit('Added virtual_hosting')

def install_root_view(self):
app = self.getApp()
if 'index_html' not in app:
from Products.PageTemplates.ZopePageTemplate \
import ZopePageTemplate
root_pt = ZopePageTemplate('index_html')
root_pt.pt_setTitle(u'Auto-generated default page')
root_pt.pt_setTitle('Auto-generated default page')
app._setObject('index_html', root_pt)
self.commit(u'Added default view for root object')
self.commit('Added default view for root object')

def install_products(self):
return install_products(self.getApp())
Expand All @@ -287,7 +287,7 @@ def install_standards(self):
delattr(app, '_standard_objects_have_been_added')
if getattr(app, '_initializer_registry', None) is not None:
delattr(app, '_initializer_registry')
transaction.get().note(u'Removed unused application attributes.')
transaction.get().note('Removed unused application attributes.')
transaction.commit()


Expand Down
6 changes: 3 additions & 3 deletions src/OFS/Cache.py
Expand Up @@ -80,7 +80,7 @@ def getVerifiedManagerIds(container):
manager_timestamp = 0


class Cacheable(object):
class Cacheable:
"""Mix-in for cacheable objects."""

manage_options = (
Expand Down Expand Up @@ -386,7 +386,7 @@ def findCacheables(
traceback.print_exc()


class Cache(object):
class Cache:
"""
A base class (and interface description) for caches.
Note that Cache objects are not intended to be visible by
Expand Down Expand Up @@ -420,7 +420,7 @@ def ZCache_set(self, ob, data, view_name, keywords, mtime_func):
raise NotImplementedError


class CacheManager(object):
class CacheManager:
"""
A base class for cache managers. Implement ZCacheManager_getCache().
"""
Expand Down
8 changes: 3 additions & 5 deletions src/OFS/CopySupport.py
Expand Up @@ -19,13 +19,11 @@
import warnings
from json import dumps
from json import loads
from urllib.parse import quote
from urllib.parse import unquote
from zlib import compress
from zlib import decompressobj

import six
from six.moves.urllib.parse import quote
from six.moves.urllib.parse import unquote

import transaction
from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager
Expand Down Expand Up @@ -190,7 +188,7 @@ def _pasteObjects(self, cp, cb_maxsize=0):
try:
op, mdatas = _cb_decode(cp, cb_maxsize)
except Exception as e:
six.raise_from(CopyError('Clipboard Error'), e)
raise CopyError('Clipboard Error') from e

oblist = []
app = self.getPhysicalRoot()
Expand Down
2 changes: 1 addition & 1 deletion src/OFS/DTMLDocument.py
Expand Up @@ -13,7 +13,7 @@
"""DTML Document objects.
"""

from six.moves.urllib.parse import quote
from urllib.parse import quote

from AccessControl import getSecurityManager
from AccessControl.class_init import InitializeClass
Expand Down

0 comments on commit 54c53f3

Please sign in to comment.