From c41881a92041c56f2369908c280e4038fb2dedfc Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:33:30 +0200 Subject: [PATCH 01/12] changelog formatting --- CHANGES.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 87a7d3c..9528c13 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,21 +1,21 @@ -2.0 (unreleased) +Changelog +========= +2.0 (unreleased) +---------------- Breaking changes ----------------- +~~~~~~~~~~~~~~~~ - Remove Plone 5.2 and Python 3.7/3.8 as unsupported. @erral ([#2](https://github.com/codesyntax/cs.srcset/pull/2)) New features ------------- +~~~~~~~~~~~~ - Add a @@image-helper view to create image URLs from catalog metadata @erral ([#2](https://github.com/codesyntax/cs.srcset/pull/2)) -Changelog -========= - 1.2 (unreleased) ---------------- From 4f9d9d70ff27db286562f09b5e1beb77fe364fbb Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:33:48 +0200 Subject: [PATCH 02/12] towncrier --- news/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 news/.gitkeep diff --git a/news/.gitkeep b/news/.gitkeep new file mode 100644 index 0000000..e69de29 From ef9a333e1a64146486c785f88176bec5bfd60ba3 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:34:04 +0200 Subject: [PATCH 03/12] changelog --- news/+brown.internal | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/+brown.internal diff --git a/news/+brown.internal b/news/+brown.internal new file mode 100644 index 0000000..e67daa4 --- /dev/null +++ b/news/+brown.internal @@ -0,0 +1 @@ +Format changelog @erral From 32170d4bfe4fd4c706c7e95cfd2d8c649e859c8d Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:35:14 +0200 Subject: [PATCH 04/12] format --- news/.changelog_template.jinja | 15 ++++++++++++ pyproject.toml | 45 +++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 news/.changelog_template.jinja diff --git a/news/.changelog_template.jinja b/news/.changelog_template.jinja new file mode 100644 index 0000000..0cf429a --- /dev/null +++ b/news/.changelog_template.jinja @@ -0,0 +1,15 @@ +{% if sections[""] %} +{% for category, val in definitions.items() if category in sections[""] %} + +### {{ definitions[category]['name'] }} + +{% for text, values in sections[""][category].items() %} +- {{ text }} {{ values|join(', ') }} +{% endfor %} + +{% endfor %} +{% else %} +No significant changes. + + +{% endif %} diff --git a/pyproject.toml b/pyproject.toml index a8a4f06..182f20e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,12 +4,39 @@ build-backend = "setuptools.build_meta" [tool.towncrier] directory = "news/" -filename = "CHANGES.rst" -title_format = "{version} (unreleased)" -underlines = ["", "-"] -issue_format = "[#{issue}](https://github.com/codesyntax/cs.srcset/pull/{issue})" -type = [ - { directory = "breaking", name = "Breaking changes", showcontent = true }, - { directory = "feature", name = "New features", showcontent = true }, - { directory = "bugfix", name = "Bug fixes", showcontent = true }, -] +filename = "CHANGELOG.md" +start_string = "\n" +title_format = "## {version} ({project_date})" +template = "news/.changelog_template.jinja" +issue_format = "[#{issue}](https://github.com/codesyntax/cs_dynamicpages/issues/{issue})" +underlines = ["", "", ""] + +[[tool.towncrier.type]] +directory = "breaking" +name = "Breaking changes:" +showcontent = true + +[[tool.towncrier.type]] +directory = "feature" +name = "New features:" +showcontent = true + +[[tool.towncrier.type]] +directory = "bugfix" +name = "Bug fixes:" +showcontent = true + +[[tool.towncrier.type]] +directory = "internal" +name = "Internal:" +showcontent = true + +[[tool.towncrier.type]] +directory = "documentation" +name = "Documentation:" +showcontent = true + +[[tool.towncrier.type]] +directory = "tests" +name = "Tests" +showcontent = true From f2c7cc2009d2d67d580b3ee5357be352b3c4438a Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:35:37 +0200 Subject: [PATCH 05/12] format --- news/.changelog_template.jinja | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/news/.changelog_template.jinja b/news/.changelog_template.jinja index 0cf429a..f9042ca 100644 --- a/news/.changelog_template.jinja +++ b/news/.changelog_template.jinja @@ -1,7 +1,7 @@ {% if sections[""] %} {% for category, val in definitions.items() if category in sections[""] %} -### {{ definitions[category]['name'] }} +{{ definitions[category]['name'] }} {% for text, values in sections[""][category].items() %} - {{ text }} {{ values|join(', ') }} diff --git a/pyproject.toml b/pyproject.toml index 182f20e..a4342d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [tool.towncrier] directory = "news/" -filename = "CHANGELOG.md" +filename = "CHANGES.rst" start_string = "\n" title_format = "## {version} ({project_date})" template = "news/.changelog_template.jinja" From 035e41dc8186aa9a3a7b927bdab84647e50e5ffa Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:36:14 +0200 Subject: [PATCH 06/12] format --- CHANGES.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 9528c13..ec29d73 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,13 +5,11 @@ Changelog ---------------- Breaking changes -~~~~~~~~~~~~~~~~ - Remove Plone 5.2 and Python 3.7/3.8 as unsupported. @erral ([#2](https://github.com/codesyntax/cs.srcset/pull/2)) New features -~~~~~~~~~~~~ - Add a @@image-helper view to create image URLs from catalog metadata @erral ([#2](https://github.com/codesyntax/cs.srcset/pull/2)) From d3795ce879b89fee3c61e58bdf5f6ddf7ea9a4c3 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:37:16 +0200 Subject: [PATCH 07/12] format --- pyproject.toml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a4342d9..75c72fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,8 @@ build-backend = "setuptools.build_meta" [tool.towncrier] directory = "news/" filename = "CHANGES.rst" -start_string = "\n" -title_format = "## {version} ({project_date})" -template = "news/.changelog_template.jinja" -issue_format = "[#{issue}](https://github.com/codesyntax/cs_dynamicpages/issues/{issue})" -underlines = ["", "", ""] +title_format = "{version} ({project_date})" +underlines = ["-", ""] [[tool.towncrier.type]] directory = "breaking" @@ -38,5 +35,5 @@ showcontent = true [[tool.towncrier.type]] directory = "tests" -name = "Tests" +name = "Tests:" showcontent = true From 0a5b02afb589e6b77d74ebb367a65f5cde388591 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:38:11 +0200 Subject: [PATCH 08/12] format --- README.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.rst b/README.rst index a1c54e7..d8f20e0 100644 --- a/README.rst +++ b/README.rst @@ -40,7 +40,6 @@ Documentation ------------- @@images-srcset -~~~~~~~~~~~~~~~ You should use this view like this :: @@ -65,7 +64,6 @@ The meaning of each parameter is the following: @@image_helper -~~~~~~~~~~~~~~ This view is designed for high-performance listings in Plone 6. It attempts to generate the ```` tag using only catalog metadata (``image_scales`` attribute in brains), avoiding expensive ``getObject()`` calls. From 319799e19a5b9c84c6822192926e7fa254d1f72f Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:38:25 +0200 Subject: [PATCH 09/12] Preparing release 2.0.1 [ci skip] --- CHANGES.rst | 9 +++++++++ news/+brown.internal | 1 - setup.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) delete mode 100644 news/+brown.internal diff --git a/CHANGES.rst b/CHANGES.rst index ec29d73..ae6fa7f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +2.0.1 (2026-07-28) +------------------ + +Internal: + + +- Format changelog @erral + + Changelog ========= diff --git a/news/+brown.internal b/news/+brown.internal deleted file mode 100644 index e67daa4..0000000 --- a/news/+brown.internal +++ /dev/null @@ -1 +0,0 @@ -Format changelog @erral diff --git a/setup.py b/setup.py index f0dcc74..4271d5b 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name="cs.srcset", - version="2.1.dev0", + version="2.0.1", description="An add-on for Plone", long_description=long_description, # Get more from https://pypi.org/classifiers/ From f6162783dadc6798e4112600cbafa213e908d0ce Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:38:45 +0200 Subject: [PATCH 10/12] Back to development: 2.0.2 [ci skip] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4271d5b..ea0b4fd 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name="cs.srcset", - version="2.0.1", + version="2.0.2.dev0", description="An add-on for Plone", long_description=long_description, # Get more from https://pypi.org/classifiers/ From ca094c734a836bfea7bd6f814f0cfdb5e133c7f7 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:41:24 +0200 Subject: [PATCH 11/12] Plone 6.2 only --- .github/workflows/plone-package.yml | 18 +- .long-description.html | 537 ++++++++++++++++++++++++++++ constraints_plone60.txt | 16 - constraints_plone61.txt | 16 - requirements_plone60.txt | 3 - requirements_plone61.txt | 3 - setup.py | 8 +- src/cs/__init__.py | 2 - test_plone60.cfg | 12 - test_plone61.cfg | 12 - 10 files changed, 539 insertions(+), 88 deletions(-) create mode 100644 .long-description.html delete mode 100644 constraints_plone60.txt delete mode 100644 constraints_plone61.txt delete mode 100644 requirements_plone60.txt delete mode 100644 requirements_plone61.txt delete mode 100644 src/cs/__init__.py delete mode 100644 test_plone60.cfg delete mode 100644 test_plone61.cfg diff --git a/.github/workflows/plone-package.yml b/.github/workflows/plone-package.yml index 7577f41..04f8e44 100644 --- a/.github/workflows/plone-package.yml +++ b/.github/workflows/plone-package.yml @@ -16,24 +16,8 @@ jobs: fail-fast: false matrix: plone-version: - - "Plone60" - - "Plone61" - "Plone62" - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] - - exclude: - - plone-version: "Plone60" - python-version: "3.12" - - plone-version: "Plone60" - python-version: "3.13" - - plone-version: "Plone60" - python-version: "3.14" - - plone-version: "Plone61" - python-version: "3.9" - - plone-version: "Plone61" - python-version: "3.14" - - plone-version: "Plone62" - python-version: "3.9" + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/setup-python@v4 diff --git a/.long-description.html b/.long-description.html new file mode 100644 index 0000000..f728e9b --- /dev/null +++ b/.long-description.html @@ -0,0 +1,537 @@ + + + + + +<string> + + + +
+ + + + +https://github.com/codesyntax/cs.srcset/actions/workflows/plone-package.yml/badge.svg + + +Latest Version + + +Egg Status + +https://img.shields.io/pypi/pyversions/cs.srcset.svg?style=plastic:alt:Supported-PythonVersions + +License + +
+

cs.srcset

+

Backport of the srcset method added to the @@images view in plone.namedfile 7.1.0 to be able to use it in older Plone versions. +It also includes an optimized @@image_helper view for Plone 6+ that uses catalog metadata to avoid N+1 performance issues in listings.

+
+

Features

+
    +
  • Adds a view called @@images-srcset for older Plone versions (backport).
  • +
  • Adds a view called @@image_helper optimized for Plone 6+ catalog metadata.
  • +
+

Read more about responsive images and its use in the MDN documentation

+
+
+

Documentation

+

@@images-srcset

+

You should use this view like this

+
+<img tal:define="images context/@@images-srcset;"
+ tal:replace="structure python:images.srcset(
+                             fieldname='image',
+                             scale_in_src='huge',
+                             sizes='(min-width: 570px) 550px,90vw',
+                             css_class='mini w-100 h-100 responsive-3-2',
+                             alt=context.Title(),
+                             title=context.Title(),
+                             loading='lazy')"
+/>
+
+

The meaning of each parameter is the following:

+
    +
  • fieldname: name of the field where the image is stored
  • +
  • scale_in_src: name of the scale that will be used to render the src attribute
  • +
  • sizes: the value of the sizes attribute in the output tag
  • +
  • css_class: CSS classes added to the img tag
  • +
  • additional attributes: any aditional attribute that will be rendered in the img tag, useful to add the title, alt, loading, fetchpriority, id, and other attributes.
  • +
+

@@image_helper

+

This view is designed for high-performance listings in Plone 6. +It attempts to generate the <img> tag using only catalog metadata (image_scales attribute in brains), avoiding expensive getObject() calls. +If metadata is missing, it gracefully falls back to the standard @@images view logic.

+

You should use this view like this

+
+<tal:block tal:define="helper context/@@image_helper">
+    <div tal:replace="structure python:helper.srcset(item, fieldname='image', sizes='25vw', css_class='my-img')" />
+</tal:block>
+
+

Available methods:

+
    +
  • srcset(item, fieldname='image', **kwargs): Returns a responsive <img> tag with the srcset attribute.
  • +
  • tag(item, fieldname='image', scale=None, **kwargs): Returns a fixed <img> tag (optionally for a specific scale).
  • +
+

Parameters:

+
    +
  • item: Either a catalog brain (recommended for performance) or a Plone object.
  • +
  • fieldname: The name of the image field (default: image).
  • +
  • scale_in_src: (Only for the srcset method) The name of the scale to use for the src attribute (default: huge).
  • +
  • scale: (Only for the tag method) The name of the scale to use for the src.
  • +
  • **kwargs: Any other HTML attributes (alt, title, loading, css_class, etc.).
  • +
+

Note: Unlike standard Plone views, this helper does not provide default values for alt or loading attributes. +Developers must provide them explicitly in the template if needed. +However, it does automatically provide width and height based on the rendered scale to prevent layout shifts.

+
+
+

Installation

+

Install cs.srcset by adding it to your buildout:

+
+[buildout]
+
+...
+
+eggs =
+    cs.srcset
+
+

and then running bin/buildout

+

NOTE: You do not need to install the product in the Plone add-ons controlpanel, there is nothing to be installed.

+
+ +
+

Support

+

If you are having issues, please let us know.

+
+
+

License

+

The project is licensed under the GPLv2.

+
+

Contributors

+ +
+
+

Changelog

+
+
+
+

2.0 (unreleased)

+

Breaking changes

+ +

New features

+ +
+
+

1.2 (unreleased)

+
    +
  • Nothing changed yet.
  • +
+
+
+

1.1 (2025-10-14)

+
    +
  • Add default width and heigth attributes if none provided when using the srcset method +[erral]
  • +
+
+
+

1.0 (2025-09-24)

+
    +
  • Initial release. +[codesyntax]
  • +
+
+
+
+ + diff --git a/constraints_plone60.txt b/constraints_plone60.txt deleted file mode 100644 index 54e0ec1..0000000 --- a/constraints_plone60.txt +++ /dev/null @@ -1,16 +0,0 @@ --c https://dist.plone.org/release/6.0-latest/constraints.txt - -#setuptools==54.0.0 -#zc.buildout==3.0.0b2 -#pip==21.0.1 -# -## Windows specific down here (has to be installed here, fails in buildout) -## Dependency of zope.sendmail: -#pywin32 ; platform_system == 'Windows' -# -## SSL Certs on windows, because Python is missing them otherwise: -#certifi ; platform_system == 'Windows' -tox==4.11.3 -isort>=5.12.0 -black>=24.4.2 -flake8>=7.0.0 diff --git a/constraints_plone61.txt b/constraints_plone61.txt deleted file mode 100644 index 61920c5..0000000 --- a/constraints_plone61.txt +++ /dev/null @@ -1,16 +0,0 @@ --c https://dist.plone.org/release/6.1-latest/constraints.txt - -#setuptools==54.0.0 -#zc.buildout==3.0.0b2 -#pip==21.0.1 -# -## Windows specific down here (has to be installed here, fails in buildout) -## Dependency of zope.sendmail: -#pywin32 ; platform_system == 'Windows' -# -## SSL Certs on windows, because Python is missing them otherwise: -#certifi ; platform_system == 'Windows' -tox==4.11.3 -isort>=5.12.0 -black>=24.4.2 -flake8>=7.0.0 diff --git a/requirements_plone60.txt b/requirements_plone60.txt deleted file mode 100644 index cab798d..0000000 --- a/requirements_plone60.txt +++ /dev/null @@ -1,3 +0,0 @@ --c constraints_plone60.txt -setuptools -zc.buildout diff --git a/requirements_plone61.txt b/requirements_plone61.txt deleted file mode 100644 index 8e34f42..0000000 --- a/requirements_plone61.txt +++ /dev/null @@ -1,3 +0,0 @@ --c constraints_plone61.txt -setuptools -zc.buildout diff --git a/setup.py b/setup.py index ea0b4fd..4e198e2 100644 --- a/setup.py +++ b/setup.py @@ -23,11 +23,8 @@ "Environment :: Web Environment", "Framework :: Plone", "Framework :: Plone :: Addon", - "Framework :: Plone :: 6.0", - "Framework :: Plone :: 6.1", "Framework :: Plone :: 6.2", "Programming Language :: Python", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -47,12 +44,9 @@ # 'Documentation': 'https://cs.srcset.readthedocs.io/en/latest/', }, license="GPL version 2", - packages=find_packages("src", exclude=["ez_setup"]), - namespace_packages=["cs"], - package_dir={"": "src"}, include_package_data=True, zip_safe=False, - python_requires=">=3.9", + python_requires=">=3.10", install_requires=[ "setuptools", # -*- Extra requirements: -*- diff --git a/src/cs/__init__.py b/src/cs/__init__.py deleted file mode 100644 index 03d08ff..0000000 --- a/src/cs/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# -*- coding: utf-8 -*- -__import__("pkg_resources").declare_namespace(__name__) diff --git a/test_plone60.cfg b/test_plone60.cfg deleted file mode 100644 index d56cb6d..0000000 --- a/test_plone60.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[buildout] - -extends = - https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-6.0.x.cfg - https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg - base.cfg - -update-versions-file = test_plone60.cfg - -[versions] -createcoverage = 1.5 -watchdog = 2.1.6 diff --git a/test_plone61.cfg b/test_plone61.cfg deleted file mode 100644 index 2e28ca3..0000000 --- a/test_plone61.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[buildout] - -extends = - https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-6.1.x.cfg - https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg - base.cfg - -update-versions-file = test_plone61.cfg - -[versions] -createcoverage = 1.5 -watchdog = 2.1.6 From edf025fb47e7907345c0af5a5e0c6124b40a7c4e Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Tue, 28 Jul 2026 07:42:06 +0200 Subject: [PATCH 12/12] changelog --- news/3.breaking | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/3.breaking diff --git a/news/3.breaking b/news/3.breaking new file mode 100644 index 0000000..ef1e014 --- /dev/null +++ b/news/3.breaking @@ -0,0 +1 @@ +Support Plone 6.2 only @erral