Skip to content

Commit

Permalink
- Drop support for Python 2.7, 3.5, 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Jan 31, 2023
1 parent 6366257 commit 4d0daf3
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 47 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/tests.yml
Expand Up @@ -21,9 +21,6 @@ jobs:
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["2.7", "py27"]
- ["3.5", "py35"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
Expand Down Expand Up @@ -57,7 +54,7 @@ jobs:
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls coverage-python-version
pip install coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 1 addition & 3 deletions .meta.toml
Expand Up @@ -2,11 +2,10 @@
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[meta]
template = "zope-product"
commit-id = "d6240444ec6c9e203f2fd9f62c3e6038f9189e96"
commit-id = "e5c611fb"

[python]
with-pypy = false
with-legacy-python = true
with-sphinx-doctests = false
with-windows = false
with-future-python = false
Expand All @@ -23,7 +22,6 @@ known_zope = "Products"

[manifest]
additional-rules = [
"include buildout4.cfg",
"recursive-include src *.pt",
"recursive-include src *.zcml",
]
1 change: 0 additions & 1 deletion MANIFEST.in
Expand Up @@ -7,6 +7,5 @@ include buildout.cfg
include tox.ini

recursive-include src *.py
include buildout4.cfg
recursive-include src *.pt
recursive-include src *.zcml
4 changes: 2 additions & 2 deletions setup.cfg
@@ -1,7 +1,7 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[bdist_wheel]
universal = 1
universal = 0

[flake8]
doctests = 1
Expand All @@ -17,7 +17,7 @@ ignore =
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_third_party = six, docutils, pkg_resources
known_third_party = six, docutils, pkg_resources, pytz
known_zope = Products
known_first_party =
default_section = ZOPE
Expand Down
9 changes: 2 additions & 7 deletions setup.py
Expand Up @@ -33,23 +33,18 @@ def read(name):
license='ZPL 2.1',
description='Error log for Zope.',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
author_email='zope-dev@zope.dev',
long_description='\n'.join([read('README.rst'),
read('CHANGES.rst')]),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Framework :: Zope',
'Framework :: Zope :: 4',
'Framework :: Zope :: 5',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
Expand All @@ -61,7 +56,7 @@ def read(name):
packages=find_packages('src'),
namespace_packages=['Products'],
package_dir={'': 'src'},
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
python_requires='>=3.7',
install_requires=[
'setuptools',
'AccessControl',
Expand Down
26 changes: 6 additions & 20 deletions src/Products/SiteErrorLog/SiteErrorLog.py
Expand Up @@ -18,6 +18,7 @@
import os
import sys
import time
from _thread import allocate_lock
from random import random

from AccessControl.class_init import InitializeClass
Expand All @@ -38,14 +39,6 @@
from .interfaces import ErrorRaisedEvent


try:
# Python 3
from _thread import allocate_lock
except ImportError:
# Python 2
from thread import allocate_lock


LOG = logging.getLogger('Zope.SiteErrorLog')

# Permission names
Expand Down Expand Up @@ -78,13 +71,6 @@

cleanup_lock = allocate_lock()

try:
# Python 2
bstr = basestring
except NameError:
# Python 3
bstr = str


class SiteErrorLog(SimpleItem):
"""Site error log class. You can put an error log anywhere in the tree
Expand Down Expand Up @@ -179,7 +165,7 @@ def raising(self, info):
if strtype in self._ignored_exceptions:
return

if not isinstance(info[2], bstr):
if not isinstance(info[2], str):
tb_text = ''.join(
format_exception(*info, **{'as_html': 0}))
tb_html = ''.join(
Expand Down Expand Up @@ -211,7 +197,7 @@ def raising(self, info):
if next:
next = list(next)
next.reverse()
strv = '%s [ /%s ]' % (strv, '/'.join(next))
strv = '{} [ /{} ]'.format(strv, '/'.join(next))

log = self._getLog()
entry_id = str(now) + str(random()) # Low chance of collision
Expand Down Expand Up @@ -240,7 +226,7 @@ def raising(self, info):
if self.copy_to_zlog:
self._do_copy_to_zlog(now, strtype, entry_id,
str(url), tb_text)
return '%s/showEntry?id=%s' % (self.absolute_url(), entry_id)
return f'{self.absolute_url()}/showEntry?id={entry_id}'

def _do_copy_to_zlog(self, now, strtype, entry_id, url, tb_text):
when = _rate_restrict_pool.get(strtype, 0)
Expand All @@ -249,7 +235,7 @@ def _do_copy_to_zlog(self, now, strtype, entry_id, url, tb_text):
now - _rate_restrict_burst * _rate_restrict_period)
next_when += _rate_restrict_period
_rate_restrict_pool[strtype] = next_when
LOG.error('%s %s\n%s' % (entry_id, url, tb_text.rstrip()))
LOG.error(f'{entry_id} {url}\n{tb_text.rstrip()}')

@security.protected(use_error_logging)
def getProperties(self):
Expand Down Expand Up @@ -359,7 +345,7 @@ def IPubFailureSubscriber(event):
# retried, just log a short message instead.
if isinstance(event.exc_info[1], TransientError) and \
request.supports_retry():
LOG.info('%s at %s: %s. Request will be retried.' % (
LOG.info('{} at {}: {}. Request will be retried.'.format(
event.exc_info[0].__name__,
request.get('PATH_INFO') or '<unknown>',
str(event.exc_info[1])))
Expand Down
2 changes: 1 addition & 1 deletion src/Products/SiteErrorLog/__init__.py
Expand Up @@ -27,7 +27,7 @@ def install_errorlog(app):

error_log = SiteErrorLog.SiteErrorLog()
app._setObject('error_log', error_log)
commit(u'Added site error_log at /error_log')
commit('Added site error_log at /error_log')


def initialize(context):
Expand Down
2 changes: 1 addition & 1 deletion src/Products/SiteErrorLog/tests/testSiteErrorLog.py
Expand Up @@ -240,7 +240,7 @@ def testCleanup(self):
class SiteErrorLogUITests(Testing.ZopeTestCase.FunctionalTestCase):

def setUp(self):
super(SiteErrorLogUITests, self).setUp()
super().setUp()

Zope2.App.zcml.load_site(force=True)

Expand Down
9 changes: 1 addition & 8 deletions tox.ini
Expand Up @@ -4,9 +4,6 @@
minversion = 3.18
envlist =
lint
py27
py35
py36
py37
py38
py39
Expand All @@ -20,8 +17,7 @@ deps =
zc.buildout >= 3.0.1
wheel > 0.37
commands_pre =
py27,py35: {envbindir}/buildout -nc {toxinidir}/buildout4.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
!py27-!py35: {envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
{envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
commands =
{envdir}/bin/test {posargs:-cv}

Expand All @@ -33,7 +29,6 @@ allowlist_externals =
mkdir
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
- flake8 {toxinidir}/src {toxinidir}/setup.py
flake8 {toxinidir}/src {toxinidir}/setup.py
check-manifest
check-python-versions
Expand Down Expand Up @@ -63,7 +58,6 @@ allowlist_externals =
deps =
{[testenv]deps}
coverage
coverage-python-version
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run {envdir}/bin/test {posargs:-cv}
Expand All @@ -72,7 +66,6 @@ commands =

[coverage:run]
branch = True
plugins = coverage_python_version
source = Products.SiteErrorLog

[coverage:report]
Expand Down

0 comments on commit 4d0daf3

Please sign in to comment.