From b7027bf1200d61395f8c2ab99df3df08cf5f4ae9 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Wed, 19 Mar 2025 08:59:02 +0100 Subject: [PATCH 1/6] Fix typo in Venue serializer that didn't return the right history version. --- CHANGES.rst | 3 ++- .../contenttypes/restapi/serializers/venue.py | 4 +++- .../plone/contenttypes/tests/test_ct_luogo.py | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 95d8e61c..3003e539 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,8 @@ Changelog 5.1.19 (unreleased) ------------------- -- Nothing changed yet. +- Fix typo in Venue serializer that didn't return the right history version. + [cekk] 5.1.18 (2025-01-21) diff --git a/src/design/plone/contenttypes/restapi/serializers/venue.py b/src/design/plone/contenttypes/restapi/serializers/venue.py index 2f8e7ad8..52296ba4 100644 --- a/src/design/plone/contenttypes/restapi/serializers/venue.py +++ b/src/design/plone/contenttypes/restapi/serializers/venue.py @@ -67,7 +67,9 @@ def get_venue_offices(self, result): def __call__(self, version=None, include_items=True): self.index = "news_venue" - result = super(VenueSerializer, self).__call__(version=None, include_items=True) + result = super(VenueSerializer, self).__call__( + version=version, include_items=True + ) result["venue_services"] = self.get_venue_services(result) result["sede_di"] = self.get_venue_offices(result) return result diff --git a/src/design/plone/contenttypes/tests/test_ct_luogo.py b/src/design/plone/contenttypes/tests/test_ct_luogo.py index c8d02740..778109bb 100644 --- a/src/design/plone/contenttypes/tests/test_ct_luogo.py +++ b/src/design/plone/contenttypes/tests/test_ct_luogo.py @@ -14,7 +14,9 @@ from transaction import commit from z3c.relationfield import RelationValue from zope.component import getUtility +from zope.event import notify from zope.intid.interfaces import IIntIds +from zope.lifecycleevent import ObjectModifiedEvent import unittest @@ -171,3 +173,19 @@ def test_venue_news(self): res["related_news"][1]["@id"], self.news.absolute_url(), ) + + def test_venue_history_return_right_data(self): + venue = api.content.create(container=self.portal, type="Venue", title="venue1") + venue.description = "aaa" + notify(ObjectModifiedEvent(venue)) + venue.description = "aaa bbb" + notify(ObjectModifiedEvent(venue)) + commit() + + response0 = self.api_session.get(f"{venue.absolute_url()}/@history/0").json() + response1 = self.api_session.get(f"{venue.absolute_url()}/@history/1").json() + response2 = self.api_session.get(f"{venue.absolute_url()}/@history/2").json() + + self.assertEqual(response0["description"], "") + self.assertEqual(response1["description"], "aaa") + self.assertEqual(response2["description"], "aaa bbb") From 96bcf6d81d168d7d9d5f0776ca2152181bea8d23 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Wed, 19 Mar 2025 09:04:59 +0100 Subject: [PATCH 2/6] fix pipelines --- .github/workflows/bandit.yml | 24 ++++++++++++++++++++++++ .github/workflows/black.yml | 8 ++++---- .github/workflows/flake8.yml | 8 ++++---- .github/workflows/pyroma.yml | 8 ++++---- .github/workflows/test.yml | 6 +++--- .github/workflows/toc.yml | 2 +- .github/workflows/zpretty.yml | 8 ++++---- 7 files changed, 44 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/bandit.yml diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml new file mode 100644 index 00000000..06708054 --- /dev/null +++ b/.github/workflows/bandit.yml @@ -0,0 +1,24 @@ +name: Security check - Bandit + +on: push + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Security check - Bandit + uses: ioggstream/bandit-report-artifacts@v1.7.4 + with: + project_path: src + # ignore_failure: true + + # This is optional + #- name: Security check report artifacts + # uses: actions/upload-artifact@v4 + # with: + # name: Security report + # path: output/security_report.txt + diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 0403f207..f7ba8b97 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -6,20 +6,20 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.9] + python-version: [3.11] steps: # git checkout - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 # python setup - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 2baf1b7d..62645d07 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -6,20 +6,20 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.9] + python-version: [3.11] steps: # git checkout - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 # python setup - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/.github/workflows/pyroma.yml b/.github/workflows/pyroma.yml index d303c4e6..175b7d6b 100644 --- a/.github/workflows/pyroma.yml +++ b/.github/workflows/pyroma.yml @@ -6,20 +6,20 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.9] + python-version: [3.11] steps: # git checkout - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 # python setup - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b56e6ab8..049e324c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,14 +11,14 @@ jobs: python: ["3.9"] plone: ["52"] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Cache eggs - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: eggs key: ${{ runner.OS }}-build-python${{ matrix.python }}-${{ matrix.plone }} - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Install dependencies diff --git a/.github/workflows/toc.yml b/.github/workflows/toc.yml index e25b55d6..00a954c3 100644 --- a/.github/workflows/toc.yml +++ b/.github/workflows/toc.yml @@ -11,7 +11,7 @@ jobs: - name: Install doctoc run: | sudo npm install -g doctoc - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Generate full TOC run: | doctoc --github --notitle README.md diff --git a/.github/workflows/zpretty.yml b/.github/workflows/zpretty.yml index 1aecb2f0..49a04e3d 100644 --- a/.github/workflows/zpretty.yml +++ b/.github/workflows/zpretty.yml @@ -6,20 +6,20 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.9] + python-version: [3.11] steps: # git checkout - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 # python setup - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} From e35a6ccb5d9074c146559a7e7a95be01ece79c01 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Wed, 19 Mar 2025 09:10:17 +0100 Subject: [PATCH 3/6] remove bandit --- .github/workflows/bandit.yml | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 .github/workflows/bandit.yml diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml deleted file mode 100644 index 06708054..00000000 --- a/.github/workflows/bandit.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Security check - Bandit - -on: push - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Security check - Bandit - uses: ioggstream/bandit-report-artifacts@v1.7.4 - with: - project_path: src - # ignore_failure: true - - # This is optional - #- name: Security check report artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: Security report - # path: output/security_report.txt - From ed71683c0c29294f8b401c053143e428ab6745ed Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Wed, 19 Mar 2025 15:18:46 +0100 Subject: [PATCH 4/6] fix build --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 049e324c..ebaeae96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,7 @@ jobs: - name: Install dependencies run: | pip install -r requirements.txt -c constraints_plone${{ matrix.plone }}.txt + pip install zc.buildout=3.3 sudo apt-get install libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev \ libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \ libharfbuzz-dev libfribidi-dev libxcb1-dev From 4ab55a1655eb268ab503c1f6263dd8e46d1be7f7 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Wed, 19 Mar 2025 15:36:11 +0100 Subject: [PATCH 5/6] fix build --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebaeae96..c1b8a304 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | pip install -r requirements.txt -c constraints_plone${{ matrix.plone }}.txt - pip install zc.buildout=3.3 + pip install zc.buildout==3.3 sudo apt-get install libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev \ libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \ libharfbuzz-dev libfribidi-dev libxcb1-dev From dc6cd130699d3a2d920bd07964c5c68c5f56f9b9 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Thu, 20 Mar 2025 09:06:49 +0100 Subject: [PATCH 6/6] test --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1b8a304..a692281d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 4 matrix: - python: ["3.9"] + python: ["3.8"] plone: ["52"] steps: - uses: actions/checkout@v4