Skip to content

Commit 1664ba1

Browse files
authored
[v2] Fix typo in Venue serializer (#303)
* Fix typo in Venue serializer that didn't return the right history version. * fix pipelines * remove bandit * fix build * fix build * test
1 parent b8f22b5 commit 1664ba1

File tree

9 files changed

+45
-23
lines changed

9 files changed

+45
-23
lines changed

.github/workflows/black.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
python-version: [3.9]
9+
python-version: [3.11]
1010

1111
steps:
1212
# git checkout
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414

1515
# python setup
1616
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v1
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python-version }}
2020

2121
# python cache
22-
- uses: actions/cache@v1
22+
- uses: actions/cache@v4
2323
with:
2424
path: ~/.cache/pip
2525
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

.github/workflows/flake8.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
python-version: [3.9]
9+
python-version: [3.11]
1010

1111
steps:
1212
# git checkout
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414

1515
# python setup
1616
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v1
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python-version }}
2020

2121
# python cache
22-
- uses: actions/cache@v1
22+
- uses: actions/cache@v4
2323
with:
2424
path: ~/.cache/pip
2525
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

.github/workflows/pyroma.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
python-version: [3.9]
9+
python-version: [3.11]
1010

1111
steps:
1212
# git checkout
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414

1515
# python setup
1616
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v1
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python-version }}
2020

2121
# python cache
22-
- uses: actions/cache@v1
22+
- uses: actions/cache@v4
2323
with:
2424
path: ~/.cache/pip
2525
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

.github/workflows/test.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@ jobs:
88
strategy:
99
max-parallel: 4
1010
matrix:
11-
python: ["3.9"]
11+
python: ["3.8"]
1212
plone: ["52"]
1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v4
1515
- name: Cache eggs
16-
uses: actions/cache@v1
16+
uses: actions/cache@v4
1717
with:
1818
path: eggs
1919
key: ${{ runner.OS }}-build-python${{ matrix.python }}-${{ matrix.plone }}
2020
- name: Set up Python ${{ matrix.python }}
21-
uses: actions/setup-python@v1
21+
uses: actions/setup-python@v5
2222
with:
2323
python-version: ${{ matrix.python }}
2424
- name: Install dependencies
2525
run: |
2626
pip install -r requirements.txt -c constraints_plone${{ matrix.plone }}.txt
27+
pip install zc.buildout==3.3
2728
sudo apt-get install libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev \
2829
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
2930
libharfbuzz-dev libfribidi-dev libxcb1-dev

.github/workflows/toc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Install doctoc
1212
run: |
1313
sudo npm install -g doctoc
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
- name: Generate full TOC
1616
run: |
1717
doctoc --github --notitle README.md

.github/workflows/zpretty.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
python-version: [3.9]
9+
python-version: [3.11]
1010

1111
steps:
1212
# git checkout
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414

1515
# python setup
1616
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v1
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python-version }}
2020

2121
# python cache
22-
- uses: actions/cache@v1
22+
- uses: actions/cache@v4
2323
with:
2424
path: ~/.cache/pip
2525
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

CHANGES.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Changelog
55
5.1.19 (unreleased)
66
-------------------
77

8-
- Nothing changed yet.
8+
- Fix typo in Venue serializer that didn't return the right history version.
9+
[cekk]
910

1011

1112
5.1.18 (2025-01-21)

src/design/plone/contenttypes/restapi/serializers/venue.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ def get_venue_offices(self, result):
6767

6868
def __call__(self, version=None, include_items=True):
6969
self.index = "news_venue"
70-
result = super(VenueSerializer, self).__call__(version=None, include_items=True)
70+
result = super(VenueSerializer, self).__call__(
71+
version=version, include_items=True
72+
)
7173
result["venue_services"] = self.get_venue_services(result)
7274
result["sede_di"] = self.get_venue_offices(result)
7375
return result

src/design/plone/contenttypes/tests/test_ct_luogo.py

+18
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
from transaction import commit
1515
from z3c.relationfield import RelationValue
1616
from zope.component import getUtility
17+
from zope.event import notify
1718
from zope.intid.interfaces import IIntIds
19+
from zope.lifecycleevent import ObjectModifiedEvent
1820

1921
import unittest
2022

@@ -171,3 +173,19 @@ def test_venue_news(self):
171173
res["related_news"][1]["@id"],
172174
self.news.absolute_url(),
173175
)
176+
177+
def test_venue_history_return_right_data(self):
178+
venue = api.content.create(container=self.portal, type="Venue", title="venue1")
179+
venue.description = "aaa"
180+
notify(ObjectModifiedEvent(venue))
181+
venue.description = "aaa bbb"
182+
notify(ObjectModifiedEvent(venue))
183+
commit()
184+
185+
response0 = self.api_session.get(f"{venue.absolute_url()}/@history/0").json()
186+
response1 = self.api_session.get(f"{venue.absolute_url()}/@history/1").json()
187+
response2 = self.api_session.get(f"{venue.absolute_url()}/@history/2").json()
188+
189+
self.assertEqual(response0["description"], "")
190+
self.assertEqual(response1["description"], "aaa")
191+
self.assertEqual(response2["description"], "aaa bbb")

0 commit comments

Comments
 (0)