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. #184

Merged
merged 6 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,24 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"]
plone-version: ["6.0", "5.2"]
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"]
plone-version: ["6.1", "6.0"]
exclude:
- python-version: 3.12
plone-version: 5.2
- python-version: 3.11
plone-version: 5.2
- python-version: 3.10
plone-version: 5.2
- python-version: 3.9
plone-version: 5.2
plone-version: 6.1
steps:
# git checkout
- uses: actions/checkout@v2

# python setup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

# python cache
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
cache-dependency-path: "**/requirements.txt"

# python install
- run: pip install virtualenv
- run: pip install wheel
- name: pip install
run: pip install -r requirements-${{ matrix.plone-version }}.txt

Expand Down
2 changes: 1 addition & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs = [
]

[pyproject]
dependencies_ignores = "['plone.app.redirector']"
dependencies_ignores = "['plone.app.layout', 'plone.app.redirector', 'plone.base', 'Products.CMFPlone']"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ repos:
hooks:
- id: pyroma
- repo: https://github.com/mgedmin/check-python-versions
rev: "0.22.0"
rev: "0.22.1"
hooks:
- id: check-python-versions
args: ['--only', 'setup.py,pyproject.toml']
Expand Down
23 changes: 0 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,6 @@ bin/buildout: bin/pip
bin/python bin/pip:
python$(version) -m venv . || virtualenv --python=python$(version) .

py2:
virtualenv --python=python2 .
bin/pip install --upgrade pip
bin/pip install -r requirements.txt

.PHONY: Build Plone 5.2 with Python 2
build-plone-5.2-py: py2 ## Build Plone 5.2 with Python 2
bin/pip install --upgrade pip
bin/pip install -r requirements.txt
bin/buildout -c plone-5.2.x.cfg

.PHONY: Build Plone 5.2
build-plone-5.2: .installed.cfg ## Build Plone 5.2
bin/pip install --upgrade pip
bin/pip install -r requirements.txt
bin/buildout -c plone-5.2.x.cfg

.PHONY: Build Plone 5.2 Performance
build-plone-5.2-performance: .installed.cfg ## Build Plone 5.2
bin/pip install --upgrade pip
bin/pip install -r requirements.txt
bin/buildout -c plone-5.2.x-performance.cfg

build-plone-6.0: ## Build Plone 6.0
python$(version) -m venv .
bin/pip install --upgrade pip
Expand Down
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Named services can be registered by providing a 'name' attribute in the service
<plone:service
method="GET"
accept="application/json"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.base.interfaces.IPloneSiteRoot"
factory=".service.Search"
name="search"
permission="zope2.View"
Expand Down Expand Up @@ -256,7 +256,7 @@ defines a policy for the site root.
.. code-block:: XML

<plone:CORSPolicy
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.base.interfaces.IPloneSiteRoot"
layer="myproduct.interfaces.IMyBrowserLayer"
allow_origin="*"
allow_methods="GET"
Expand Down Expand Up @@ -315,6 +315,8 @@ and then running "bin/buildout"
Plone/Python Support
--------------------

plone.rest 5.x.x supports Plone 6.x on Python 3.9 and newer.

plone.rest 4.x.x supports Plone 5.2 and 6.x on Python 3.8 and newer.

plone.rest 3.x.x supports Plone 5.2 on Python 2.7 and 3.6 to 3.8 and Plone 6.0 on Python 3.8 to 3.11.
Expand Down
2 changes: 1 addition & 1 deletion news/178.internal
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Update Plone to 6.0.9 and 5.2.14 in buildout. Also removes buildout of unsupported Plone versions. @wesleybl
Update Plone to 6.0.14 and 6.1.0b2 for testing. Also removes buildout of unsupported Plone versions. @wesleybl, @davisagli
1 change: 1 addition & 0 deletions news/4090.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop support for Plone 5.2 and Python 3.8. @davisagli
1 change: 1 addition & 0 deletions news/4090.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix DeprecationWarnings. [maurits]
4 changes: 0 additions & 4 deletions plone-5.2.x.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion plone-6.0.x.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[buildout]
extends =
https://dist.plone.org/release/6.0.9/versions.cfg
https://dist.plone.org/release/6.0.14/versions.cfg
base.cfg
4 changes: 4 additions & 0 deletions plone-6.1.x.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[buildout]
extends =
https://dist.plone.org/release/6.1.0b2/versions.cfg
base.cfg
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Zope = [
'Products.CMFCore', 'Products.CMFDynamicViewFTI',
]
python-dateutil = ['dateutil']
ignore-packages = ['plone.app.redirector']
ignore-packages = ['plone.app.layout', 'plone.app.redirector', 'plone.base', 'Products.CMFPlone']

##
# Add extra configuration options in .meta.toml:
Expand Down
1 change: 0 additions & 1 deletion requirements-5.2.txt

This file was deleted.

2 changes: 1 addition & 1 deletion requirements-6.0.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-r https://dist.plone.org/release/6.0.9/requirements.txt
-r https://dist.plone.org/release/6.0.14/requirements.txt
1 change: 1 addition & 0 deletions requirements-6.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-r https://dist.plone.org/release/6.1.0b2/requirements.txt
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-r requirements-6.0.txt
-r requirements-6.1.txt
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()


version = "4.1.4.dev0"
version = "5.0.0.dev0"

long_description = read("README.rst") + "\n\n" + read("CHANGES.rst") + "\n\n"

Expand All @@ -24,11 +24,11 @@ def read(*rnames):
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Plone",
"Framework :: Plone :: 5.2",
"Framework :: Plone :: 6.0",
"Framework :: Plone :: 6.1",
"Framework :: Plone :: Core",
"Framework :: Zope2",
"Framework :: Zope :: 4",
"Framework :: Zope :: 5",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: OS Independent",
"Programming Language :: Python",
Expand All @@ -37,6 +37,7 @@ def read(*rnames):
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
],
Expand All @@ -57,14 +58,12 @@ def read(*rnames):
"requests",
"BTrees",
"plone.app.contenttypes[test]",
"plone.app.layout",
"plone.app.redirector",
"plone.app.textfield",
"plone.namedfile",
"plone.testing",
"z3c.relationfield",
"zope.intid",
"plone.base",
]
),
install_requires=[
Expand Down
27 changes: 0 additions & 27 deletions src/plone/rest/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,3 @@ def __before_publishing_traverse__(self, arg1, arg2=None):
return

return self._old___before_publishing_traverse__(arg1, arg2)


PERMANENT_REDIRECT = {308: "Permanent Redirect"}


def patch_zpublisher_status_codes(scope, unused_original, unused_replacement):
"""Add '308 Permanent Redirect' to the list of status codes the ZPublisher
knows about. Otherwise setStatus() will turn it into a 500.

This is needed for up to and including Plone 5.1.
"""
status_reasons = getattr(scope, "status_reasons", {})
if 308 in status_reasons:
# Already present in zExceptions >= 3.2 / Zope >= 4.0a1 / Plone 5.2
return

# Patch the forward mapping (code -> reason)
status_reasons.update(PERMANENT_REDIRECT)

# Update the reverse mapping
status_codes = getattr(scope, "status_codes", {})
key, val = PERMANENT_REDIRECT.items()[0]

status_codes["".join(val.split(" ")).lower()] = key
status_codes[val.lower()] = key
status_codes[key] = key
status_codes[str(key)] = key
10 changes: 0 additions & 10 deletions src/plone/rest/patches.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,4 @@
preserveOriginal="true"
/>

<monkey:patch
original="status_codes"
replacement=".patches.PERMANENT_REDIRECT"
module="ZPublisher.HTTPResponse"
handler=".patches.patch_zpublisher_status_codes"
description="Teach ZPublisher about status 308"
ignoreOriginal="True"
preconditions="Zope2-=4.0a1"
/>

</configure>
5 changes: 3 additions & 2 deletions src/plone/rest/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from plone.app.testing import IntegrationTesting
from plone.app.testing import PloneSandboxLayer
from plone.rest.service import Service
from plone.testing import z2
from plone.testing import zope
from zope.configuration import xmlconfig


Expand All @@ -22,7 +22,8 @@ def setUpZope(self, app, configurationContext):
bases=(PLONE_REST_FIXTURE,), name="PloneRestLayer:Integration"
)
PLONE_REST_FUNCTIONAL_TESTING = FunctionalTesting(
bases=(PLONE_REST_FIXTURE, z2.ZSERVER_FIXTURE), name="PloneRestLayer:Functional"
bases=(PLONE_REST_FIXTURE, zope.WSGI_SERVER_FIXTURE),
name="PloneRestLayer:Functional",
)


Expand Down
12 changes: 6 additions & 6 deletions src/plone/rest/testing.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,42 @@
<plone:service
method="GET"
factory=".demo.Get"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.base.interfaces.IPloneSiteRoot"
permission="zope2.View"
/>

<plone:service
method="POST"
factory=".demo.Post"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.base.interfaces.IPloneSiteRoot"
permission="cmf.AddPortalContent"
/>

<plone:service
method="PUT"
factory=".demo.Put"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.base.interfaces.IPloneSiteRoot"
permission="cmf.ModifyPortalContent"
/>

<plone:service
method="DELETE"
factory=".demo.Delete"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.base.interfaces.IPloneSiteRoot"
permission="zope2.DeleteObjects"
/>

<plone:service
method="PATCH"
factory=".demo.Patch"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.base.interfaces.IPloneSiteRoot"
permission="cmf.ModifyPortalContent"
/>

<plone:service
method="OPTIONS"
factory=".demo.Options"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
for="plone.base.interfaces.IPloneSiteRoot"
permission="zope2.View"
/>

Expand Down
2 changes: 1 addition & 1 deletion src/plone/rest/tests/test_traversal.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from base64 import b64encode
from plone.app.layout.navigation.interfaces import INavigationRoot
from plone.app.testing import setRoles
from plone.app.testing import SITE_OWNER_NAME
from plone.app.testing import SITE_OWNER_PASSWORD
from plone.app.testing import TEST_USER_ID
from plone.base.interfaces import INavigationRoot
from plone.rest.service import Service
from plone.rest.testing import PLONE_REST_INTEGRATION_TESTING
from Products.SiteAccess.VirtualHostMonster import VirtualHostMonster
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ set_env =
##
deps =
zope.testrunner
-c https://dist.plone.org/release/6.0-dev/constraints.txt
-c https://dist.plone.org/release/6.1-dev/constraints.txt

##
# Specify additional deps in .meta.toml:
Expand Down Expand Up @@ -143,7 +143,7 @@ set_env =
deps =
coverage
zope.testrunner
-c https://dist.plone.org/release/6.0-dev/constraints.txt
-c https://dist.plone.org/release/6.1-dev/constraints.txt

commands =
coverage run --branch --source plone.rest {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s plone.rest {posargs}
Expand All @@ -160,7 +160,7 @@ deps =
twine
build
towncrier
-c https://dist.plone.org/release/6.0-dev/constraints.txt
-c https://dist.plone.org/release/6.1-dev/constraints.txt

commands =
# fake version to not have to install the package
Expand Down Expand Up @@ -188,7 +188,7 @@ allowlist_externals =
deps =
pipdeptree
pipforester
-c https://dist.plone.org/release/6.0-dev/constraints.txt
-c https://dist.plone.org/release/6.1-dev/constraints.txt

commands =
# Generate the full dependency tree
Expand Down
Loading