changed yaml output
This commit is contained in:
parent
bfb64efdec
commit
4f9a39fd36
3 changed files with 13 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
||||||
import re
|
import re
|
||||||
import pyaml
|
import yaml
|
||||||
|
|
||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
@ -113,18 +113,18 @@ def generate_exoscale_marketplace_yaml(offering):
|
||||||
if offering.service.description:
|
if offering.service.description:
|
||||||
product_overview = markdownify(
|
product_overview = markdownify(
|
||||||
offering.service.description, heading_style="ATX"
|
offering.service.description, heading_style="ATX"
|
||||||
)
|
).strip()
|
||||||
|
|
||||||
# Generate highlights content from offering description and offer_description (convert HTML to Markdown)
|
# Generate highlights content from offering description and offer_description (convert HTML to Markdown)
|
||||||
highlights = ""
|
highlights = ""
|
||||||
if offering.description:
|
if offering.description:
|
||||||
highlights += markdownify(offering.description, heading_style="ATX")
|
highlights += markdownify(offering.description, heading_style="ATX").strip()
|
||||||
if offering.offer_description:
|
if offering.offer_description:
|
||||||
if highlights:
|
if highlights:
|
||||||
highlights += "\n\n"
|
highlights += "\n\n"
|
||||||
highlights += markdownify(
|
highlights += markdownify(
|
||||||
offering.offer_description.get_full_text(), heading_style="ATX"
|
offering.offer_description.get_full_text(), heading_style="ATX"
|
||||||
)
|
).strip()
|
||||||
|
|
||||||
# Build YAML structure
|
# Build YAML structure
|
||||||
yaml_structure = {
|
yaml_structure = {
|
||||||
|
@ -179,7 +179,15 @@ def generate_exoscale_marketplace_yaml(offering):
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate YAML response for browser display
|
# Generate YAML response for browser display
|
||||||
yaml_content = pyaml.dump(yaml_structure, sort_dicts=False)
|
yaml_content = yaml.dump(
|
||||||
|
yaml_structure,
|
||||||
|
default_flow_style=False,
|
||||||
|
allow_unicode=True,
|
||||||
|
indent=2,
|
||||||
|
width=120,
|
||||||
|
sort_keys=False,
|
||||||
|
default_style=None,
|
||||||
|
)
|
||||||
|
|
||||||
# Return as plain text for browser display
|
# Return as plain text for browser display
|
||||||
response = HttpResponse(yaml_content, content_type="text/plain")
|
response = HttpResponse(yaml_content, content_type="text/plain")
|
||||||
|
|
|
@ -17,7 +17,6 @@ dependencies = [
|
||||||
"markdownify>=1.1.0",
|
"markdownify>=1.1.0",
|
||||||
"odoorpc>=0.10.1",
|
"odoorpc>=0.10.1",
|
||||||
"pillow>=11.1.0",
|
"pillow>=11.1.0",
|
||||||
"pyaml>=25.5.0",
|
|
||||||
"pyyaml>=6.0.2",
|
"pyyaml>=6.0.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
14
uv.lock
generated
14
uv.lock
generated
|
@ -316,18 +316,6 @@ wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/cf/6c/41c21c6c8af92b9fea313aa47c75de49e2f9a467964ee33eb0135d47eb64/pillow-11.1.0-cp313-cp313t-win_arm64.whl", hash = "sha256:67cd427c68926108778a9005f2a04adbd5e67c442ed21d95389fe1d595458756", size = 2377651, upload-time = "2025-01-02T08:12:53.356Z" },
|
{ url = "https://files.pythonhosted.org/packages/cf/6c/41c21c6c8af92b9fea313aa47c75de49e2f9a467964ee33eb0135d47eb64/pillow-11.1.0-cp313-cp313t-win_arm64.whl", hash = "sha256:67cd427c68926108778a9005f2a04adbd5e67c442ed21d95389fe1d595458756", size = 2377651, upload-time = "2025-01-02T08:12:53.356Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pyaml"
|
|
||||||
version = "25.5.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "pyyaml" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/c1/40/94f10f32ab952c5cca713d9ac9d8b2fdc37392d90eea403823eeac674c24/pyaml-25.5.0.tar.gz", hash = "sha256:5799560c7b1c9daf35a7a4535f53e2c30323f74cbd7cb4f2e715b16dd681a58a", size = 29812, upload-time = "2025-05-29T05:34:05.292Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/aa/7d/1b5061beff826f902285827261485a058b943332eba8a5532a0164735205/pyaml-25.5.0-py3-none-any.whl", hash = "sha256:b9e0c4e58a5e8003f8f18e802db49fd0563ada587209b13e429bdcbefa87d035", size = 26422, upload-time = "2025-05-29T05:34:03.594Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "python-dotenv"
|
name = "python-dotenv"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
@ -380,7 +368,6 @@ dependencies = [
|
||||||
{ name = "markdownify" },
|
{ name = "markdownify" },
|
||||||
{ name = "odoorpc" },
|
{ name = "odoorpc" },
|
||||||
{ name = "pillow" },
|
{ name = "pillow" },
|
||||||
{ name = "pyaml" },
|
|
||||||
{ name = "pyyaml" },
|
{ name = "pyyaml" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -404,7 +391,6 @@ requires-dist = [
|
||||||
{ name = "markdownify", specifier = ">=1.1.0" },
|
{ name = "markdownify", specifier = ">=1.1.0" },
|
||||||
{ name = "odoorpc", specifier = ">=0.10.1" },
|
{ name = "odoorpc", specifier = ">=0.10.1" },
|
||||||
{ name = "pillow", specifier = ">=11.1.0" },
|
{ name = "pillow", specifier = ">=11.1.0" },
|
||||||
{ name = "pyaml", specifier = ">=25.5.0" },
|
|
||||||
{ name = "pyyaml", specifier = ">=6.0.2" },
|
{ name = "pyyaml", specifier = ">=6.0.2" },
|
||||||
]
|
]
|
||||||
provides-extras = ["dev"]
|
provides-extras = ["dev"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue