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

Update validation for Volto and Node versions #49

Merged
merged 3 commits into from
Nov 12, 2024
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
13 changes: 4 additions & 9 deletions cookieplone/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@
"3.12",
]

DEFAULT_NODE = 18
DEFAULT_NODE = 22
SUPPORTED_NODE_VERSIONS = [
"16",
"17",
"18",
"19",
"20",
"22",
]


VOLTO_MIN_VERSION = "16"
VOLTO_MIN_VERSION = "18.0.0-alpha.1"
VOLTO_NODE = {
16: 16,
17: DEFAULT_NODE,
18: 20,
18: 22,
}
MIN_DOCKER_VERSION = "20.10"

Expand Down
2 changes: 1 addition & 1 deletion cookieplone/utils/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def validate_volto_version(value: str) -> str:
status = bool(version) and (
version >= _version_from_str(settings.VOLTO_MIN_VERSION)
)
return "" if status else f"{value} is not a valid Volto version."
return "" if status else f"Volto version {value} is not supported by this template."


def run_context_validations(
Expand Down
1 change: 1 addition & 0 deletions news/49.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix validation of Volto and Node versions. @davisagli
2 changes: 1 addition & 1 deletion tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def func(filter_: str) -> Path:
["package_path", "{{'foo.bar.baz' | package_path}}", "foo/bar/baz"],
["pascal_case", "{{'foo_bar' | pascal_case}}", "FooBar"],
["use_prerelease_versions", "{{ '' | use_prerelease_versions }}", "No"],
["node_version_for_volto", "{{'17' | node_version_for_volto}}", "18"],
["node_version_for_volto", "{{'18' | node_version_for_volto}}", "22"],
["gs_language_code", "{{'ES' | gs_language_code}}", "es"],
["gs_language_code", "{{'es-MX' | gs_language_code}}", "es-mx"],
["locales_language_code", "{{'es-mx' | locales_language_code}}", "es_MX"],
Expand Down
5 changes: 2 additions & 3 deletions tests/utils/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,9 @@ def test_validate_plone_version(version: str, expected: str):
@pytest.mark.parametrize(
"version,expected",
(
("14.0.0", "14.0.0 is not a valid Volto version."),
("18.0.0-alpha.21", ""),
("17.0.0", ""),
("16.15.1", ""),
("17.0.0", "Volto version 17.0.0 is not supported by this template."),
("16.15.1", "Volto version 16.15.1 is not supported by this template."),
),
)
def test_validate_volto_version(version: str, expected: str):
Expand Down