Skip to content

Commit dfcf674

Browse files
authored
Fix typo in Venue serializer that didn't return the right history version. (#302)
1 parent e58dd8f commit dfcf674

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

CHANGES.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Changelog
1111
[lucabel]
1212
- Add upgrade-step to add missing metadata for image captions.
1313
[cekk]
14-
14+
- Fix typo in Venue serializer that didn't return the right history version.
15+
[cekk]
1516

1617
6.3.4 (2025-03-07)
1718
------------------

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def get_venue_offices(self, result):
6868

6969
def __call__(self, version=None, include_items=True):
7070
self.index = "news_venue"
71-
result = super(VenueSerializer, self).__call__(version=None, include_items=True)
71+
result = super().__call__(version=version, include_items=include_items)
7272
result["venue_services"] = self.get_venue_services(result)
7373
result["sede_di"] = self.get_venue_offices(result)
7474
return result

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

+18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
from z3c.relationfield import RelationValue
1717
from zope.component import getUtility
1818
from zope.intid.interfaces import IIntIds
19+
from zope.lifecycleevent import ObjectModifiedEvent
20+
from zope.event import notify
1921

2022
import unittest
2123

@@ -432,3 +434,19 @@ def test_venue_serializers(self):
432434
if item["id"] in ["venue1", "venue2"]:
433435
self.assertEqual(item["geolocation"]["latitude"], 44.35)
434436
self.assertEqual(item["geolocation"]["longitude"], 11.7)
437+
438+
def test_venue_history_return_right_data(self):
439+
venue = api.content.create(container=self.portal, type="Venue", title="venue1")
440+
venue.description = "aaa"
441+
notify(ObjectModifiedEvent(venue))
442+
venue.description = "aaa bbb"
443+
notify(ObjectModifiedEvent(venue))
444+
commit()
445+
446+
response0 = self.api_session.get(f"{venue.absolute_url()}/@history/0").json()
447+
response1 = self.api_session.get(f"{venue.absolute_url()}/@history/1").json()
448+
response2 = self.api_session.get(f"{venue.absolute_url()}/@history/2").json()
449+
450+
self.assertEqual(response0["description"], "")
451+
self.assertEqual(response1["description"], "aaa")
452+
self.assertEqual(response2["description"], "aaa bbb")

0 commit comments

Comments
 (0)