Skip to content

Commit

Permalink
Fix missing default in PLONE_SITE_PREFIX_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Aug 9, 2024
1 parent 2f2bcbf commit cea7ec6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

2.1.2 (2024-08-09)
------------------

- Fix missing default in PLONE_SITE_PREFIX_PATH [jensens]

2.1.1 (2024-08-02)
------------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "collective.elastic.ingest"
version = "2.1.1"
version = "2.1.2"
description = "Ingestion service queue runner between Plone RestAPI and ElasticSearch or OpenSearch."
keywords = ["elasticsearch", "opensearch", "plone", "celery", "search", "indexer"]
readme = "README.rst"
Expand Down
6 changes: 3 additions & 3 deletions src/collective/elastic/ingest/plone.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ def _full_url(path):
return "/".join([plone_base_url, path])

if prefix_handling == "strip":
prefix_path = str(os.environ.get("PLONE_SITE_PREFIX_PATH")).strip("/")
prefix_path = str(os.environ.get("PLONE_SITE_PREFIX_PATH", "Plone")).strip("/")
path_parts = path.split("/")[len(prefix_path.split("/")) :]
return "/".join([plone_base_url] + path_parts)

raise ValueError(
f"PLONE_SITE_PREFIX_METHOD must be one of keep, strip or add, not {prefix_handling}"
f"PLONE_SITE_PREFIX_METHOD must be either 'keep' or 'strip', got '{prefix_handling}'"
)


def _schema_url():
"""return the url to fetch the schema from"""
url = [str(os.environ.get("PLONE_SERVICE"))]
if str(os.environ.get("PLONE_SITE_PREFIX_METHOD", "keep")).strip() == "keep":
url.append(str(os.environ.get("PLONE_SITE_PREFIX_PATH")))
url.append(str(os.environ.get("PLONE_SITE_PREFIX_PATH", "Plone")))
url.append("@cesp-schema")
return "/".join(url)

Expand Down

0 comments on commit cea7ec6

Please sign in to comment.