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

Fix folder listing template when plone.eventlocation behavior is disabled #680

Merged
merged 2 commits into from
Mar 5, 2024
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
2 changes: 2 additions & 0 deletions news/679.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix folder listing template when `plone.eventlocation` behavior is disabled for Events.
[petschki]
2 changes: 1 addition & 1 deletion plone/app/contenttypes/browser/templates/listing.pt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

<tal:event condition="python:item_is_event">
<tal:date tal:replace="structure python:view.formatted_date(obj)" />
<span tal:condition="python:obj.location"
<span tal:condition="python:getattr(obj.aq_base, 'location', None)"
i18n:translate="label_event_byline_location"
>
&mdash;
Expand Down
25 changes: 25 additions & 0 deletions plone/app/contenttypes/tests/test_folder.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from datetime import datetime
from datetime import timedelta
from plone.app.contenttypes.browser.folder import FolderView
from plone.app.contenttypes.interfaces import IFolder
from plone.app.contenttypes.testing import ( # noqa
Expand Down Expand Up @@ -232,3 +234,26 @@ def test_list_item_wout_title(self):
# And also in tabular view
self.browser.open(self.folder_url + "/tabular_view")
self.assertIn("doc_wout_title", self.browser.contents)

def test_event_wout_location(self):
# deactivate "plone.eventlocation" from Event behaviors
event_fti = self.portal.portal_types.get("Event")
if not event_fti:
return
event_behaviors = list(event_fti.behaviors)
event_behaviors.remove("plone.eventlocation")
event_fti.behaviors = tuple(event_behaviors)

self.folder.invokeFactory(
"Event",
id="event_wout_location",
title="Event without location",
start=datetime.now() + timedelta(days=1),
)

import transaction

transaction.commit()

self.browser.open(self.folder_url + "/listing_view")
self.assertIn("Event without location", self.browser.contents)