diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a16446..39b78a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,26 +1,26 @@ exclude: "^$|src/recensio/plone/browser/bundles" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.4.0 + rev: v3.19.1 hooks: - id: pyupgrade args: [--py38-plus] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.10.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 7.1.1 hooks: - id: flake8 - repo: https://github.com/PyCQA/bandit @@ -33,7 +33,7 @@ repos: - --confidence-level=medium - --skip=B608 - repo: https://github.com/collective/zpretty - rev: 3.1.0a2 + rev: 3.1.0 hooks: - id: zpretty # - repo: https://github.com/PyCQA/docformatter diff --git a/CHANGES.rst b/CHANGES.rst index 7d00873..ee72478 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,9 @@ Changelog 1.0.4 (unreleased) ------------------ -- Nothing changed yet. +- Performance improvements + `#3067 `_ + [ale-rt] 1.0.3 (2024-07-30) diff --git a/buildout.cfg b/buildout.cfg index 1aaa8cf..bd58417 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -15,7 +15,7 @@ auto-checkout = [test] -recipe = collective.xmltestreport +recipe = zc.recipe.testrunner defaults = ['--auto-color', '--auto-progress', '-s', 'recensio.plone'] eggs = Products.CMFPlone diff --git a/src/recensio/plone/mails/legacy.py b/src/recensio/plone/mails/legacy.py index 555f6b6..243b213 100644 --- a/src/recensio/plone/mails/legacy.py +++ b/src/recensio/plone/mails/legacy.py @@ -1,4 +1,5 @@ """Contains code migrated from the old recensio packages.""" + from plone import api from Products.Five import BrowserView from recensio.plone import _ diff --git a/src/recensio/plone/migration/import_pagePictures.py b/src/recensio/plone/migration/import_pagePictures.py index 5724e50..7de3fae 100644 --- a/src/recensio/plone/migration/import_pagePictures.py +++ b/src/recensio/plone/migration/import_pagePictures.py @@ -71,7 +71,9 @@ def handleApply(self, action): ) with blob_path.open("rb") as f: pagePictures.append( - NamedBlobImage(data=f.read(), filename=f"{blob_idx+1}.gif") + NamedBlobImage( + data=f.read(), filename=f"{blob_idx + 1}.gif" + ) ) elif isinstance(blob_path, str): # Looks like, when export_page_pictures was called TTW, the @@ -79,7 +81,9 @@ def handleApply(self, action): # COLLECTIVE_EXPORTIMPORT_BLOB_HOME in that case. with open(blob_path, "rb") as f: pagePictures.append( - NamedBlobImage(data=f.read(), filename=f"{blob_idx+1}.gif") + NamedBlobImage( + data=f.read(), filename=f"{blob_idx + 1}.gif" + ) ) obj.pagePictures = pagePictures diff --git a/src/recensio/plone/viewlets/viewlets.py b/src/recensio/plone/viewlets/viewlets.py index bc61153..0261b04 100644 --- a/src/recensio/plone/viewlets/viewlets.py +++ b/src/recensio/plone/viewlets/viewlets.py @@ -79,11 +79,9 @@ def _get_toggle_link(self, uid): def _get_css_classes(self, obj): css_classes = [] - reviews = [ - obj - for obj in obj.objectValues() - if obj.portal_type in ("Review Monograph", "Review Journal") - ] + reviews = api.content.find( + context=obj, portal_type=["Review Monograph", "Review Journal"], depth=1 + ) if len(reviews) > 0: css_classes.append("review_container") if self.is_expanded(obj.UID()):