Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Fix typo in Venue serializer #303

Merged
merged 6 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pyroma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ jobs:
strategy:
max-parallel: 4
matrix:
python: ["3.9"]
python: ["3.8"]
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
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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/zpretty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/design/plone/contenttypes/restapi/serializers/venue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions src/design/plone/contenttypes/tests/test_ct_luogo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")