Skip to content

Commit 3c3cca6

Browse files
ale-rtreinhardt
andauthoredJan 20, 2025
Performance improvements (#188)
* Pre-commit * Performance improvements See syslabcom/scrum#3067 which also shows how this is effective * Use the standard zc.recipe.testrunner See collective/collective.xmltestreport#28 --------- Co-authored-by: Manuel Reinhardt <reinhardt@syslab.com>
1 parent 19054fd commit 3c3cca6

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed
 

‎.pre-commit-config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
exclude: "^$|src/recensio/plone/browser/bundles"
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.4.0
4+
rev: v5.0.0
55
hooks:
66
- id: check-yaml
77
- id: end-of-file-fixer
88
- id: trailing-whitespace
99
- repo: https://github.com/asottile/pyupgrade
10-
rev: v3.4.0
10+
rev: v3.19.1
1111
hooks:
1212
- id: pyupgrade
1313
args: [--py38-plus]
1414
- repo: https://github.com/psf/black
15-
rev: 23.3.0
15+
rev: 24.10.0
1616
hooks:
1717
- id: black
1818
- repo: https://github.com/PyCQA/isort
19-
rev: 5.12.0
19+
rev: 5.13.2
2020
hooks:
2121
- id: isort
2222
- repo: https://github.com/PyCQA/flake8
23-
rev: 6.0.0
23+
rev: 7.1.1
2424
hooks:
2525
- id: flake8
2626
- repo: https://github.com/PyCQA/bandit
@@ -33,7 +33,7 @@ repos:
3333
- --confidence-level=medium
3434
- --skip=B608
3535
- repo: https://github.com/collective/zpretty
36-
rev: 3.1.0a2
36+
rev: 3.1.0
3737
hooks:
3838
- id: zpretty
3939
# - repo: https://github.com/PyCQA/docformatter

‎CHANGES.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ Changelog
55
1.0.4 (unreleased)
66
------------------
77

8-
- Nothing changed yet.
8+
- Performance improvements
9+
`#3067 <https://github.com/syslabcom/scrum/issues/3067>`_
10+
[ale-rt]
911

1012

1113
1.0.3 (2024-07-30)

‎buildout.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ auto-checkout =
1515

1616

1717
[test]
18-
recipe = collective.xmltestreport
18+
recipe = zc.recipe.testrunner
1919
defaults = ['--auto-color', '--auto-progress', '-s', 'recensio.plone']
2020
eggs =
2121
Products.CMFPlone

‎src/recensio/plone/mails/legacy.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Contains code migrated from the old recensio packages."""
2+
23
from plone import api
34
from Products.Five import BrowserView
45
from recensio.plone import _

‎src/recensio/plone/migration/import_pagePictures.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,19 @@ def handleApply(self, action):
7171
)
7272
with blob_path.open("rb") as f:
7373
pagePictures.append(
74-
NamedBlobImage(data=f.read(), filename=f"{blob_idx+1}.gif")
74+
NamedBlobImage(
75+
data=f.read(), filename=f"{blob_idx + 1}.gif"
76+
)
7577
)
7678
elif isinstance(blob_path, str):
7779
# Looks like, when export_page_pictures was called TTW, the
7880
# whole blob path was stored as string. No need to use
7981
# COLLECTIVE_EXPORTIMPORT_BLOB_HOME in that case.
8082
with open(blob_path, "rb") as f:
8183
pagePictures.append(
82-
NamedBlobImage(data=f.read(), filename=f"{blob_idx+1}.gif")
84+
NamedBlobImage(
85+
data=f.read(), filename=f"{blob_idx + 1}.gif"
86+
)
8387
)
8488

8589
obj.pagePictures = pagePictures

‎src/recensio/plone/viewlets/viewlets.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,9 @@ def _get_toggle_link(self, uid):
7979

8080
def _get_css_classes(self, obj):
8181
css_classes = []
82-
reviews = [
83-
obj
84-
for obj in obj.objectValues()
85-
if obj.portal_type in ("Review Monograph", "Review Journal")
86-
]
82+
reviews = api.content.find(
83+
context=obj, portal_type=["Review Monograph", "Review Journal"], depth=1
84+
)
8785
if len(reviews) > 0:
8886
css_classes.append("review_container")
8987
if self.is_expanded(obj.UID()):

0 commit comments

Comments
 (0)
Please sign in to comment.