From 250b2cf0a58e33b3a663041c55722243332dac1e Mon Sep 17 00:00:00 2001 From: David Glick Date: Mon, 13 Jan 2025 20:07:20 -0800 Subject: [PATCH] Update to match version policy, simplify --- cookieplone/settings.py | 6 ------ cookieplone/utils/validators.py | 18 ------------------ tests/utils/test_validators.py | 9 --------- 3 files changed, 33 deletions(-) diff --git a/cookieplone/settings.py b/cookieplone/settings.py index 784307c..9693e3a 100644 --- a/cookieplone/settings.py +++ b/cookieplone/settings.py @@ -2,14 +2,8 @@ # # SPDX-License-Identifier: MIT PLONE_MIN_VERSION = "6" -PLONE_PYTHON_VERSIONS = { - (6, 0): ["3.8", "3.9", "3.10", "3.11", "3.12"], - (6, 1): ["3.10", "3.11", "3.12", "3.13"], -} SUPPORTED_PYTHON_VERSIONS = [ - "3.8", - "3.9", "3.10", "3.11", "3.12", diff --git a/cookieplone/utils/validators.py b/cookieplone/utils/validators.py index d07d480..16fc213 100644 --- a/cookieplone/utils/validators.py +++ b/cookieplone/utils/validators.py @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: MIT import re -import sys from typing import Any from urllib.parse import urlparse @@ -89,23 +88,6 @@ def validate_plone_version(value: str) -> str: return "" if status else f"{value} is not a valid Plone version." -def validate_python_version(plone_version: str) -> str: - """Validate current Python is compatible with specified Plone version.""" - plone_version_tuple = tuple(_version_from_str(plone_version).release[:2]) - supported_python_versions = ( - settings.PLONE_PYTHON_VERSIONS.get(plone_version_tuple) or [] - ) - if not supported_python_versions: - return f"Cookieplone doesn't support Plone version {plone_version}" - python_version = f"{sys.version_info.major}.{sys.version_info.minor}" - return ( - "" - if python_version in supported_python_versions - else f"You have Python {python_version} but Plone {plone_version} " - f"requires one of the following Pythons: {', '.join(supported_python_versions)}" - ) - - def validate_volto_version(value: str) -> str: """Validate Volto Version.""" version = _version_from_str(value) diff --git a/tests/utils/test_validators.py b/tests/utils/test_validators.py index 55106b9..e8973bf 100644 --- a/tests/utils/test_validators.py +++ b/tests/utils/test_validators.py @@ -192,12 +192,3 @@ def test_validate_plone_version(version: str, expected: str): def test_validate_volto_version(version: str, expected: str): func = validators.validate_volto_version assert func(version) == expected - - -def test_validate_python_version(): - assert validators.validate_python_version("6.0.14") == "" - assert validators.validate_python_version("6.1.0b2") == "" - assert ( - validators.validate_python_version("5.2") - == "Cookieplone doesn't support Plone version 5.2" - )