From c91ffdb6b2eaa3a0fb00e57c1ed61c9f4e4ba5d4 Mon Sep 17 00:00:00 2001 From: Luca Bellenghi Date: Thu, 7 Mar 2024 13:06:41 +0100 Subject: [PATCH] add adapter for rss event item --- src/redturtle/volto/adapters/configure.zcml | 7 +++++++ src/redturtle/volto/adapters/rss.py | 19 +++++++++++++++++++ ...Plone.browser.syndication.templates.RSS.pt | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/redturtle/volto/adapters/rss.py diff --git a/src/redturtle/volto/adapters/configure.zcml b/src/redturtle/volto/adapters/configure.zcml index 9d54aa3d..7887b463 100644 --- a/src/redturtle/volto/adapters/configure.zcml +++ b/src/redturtle/volto/adapters/configure.zcml @@ -37,4 +37,11 @@ provides="plone.restapi.interfaces.IBlockFieldLinkIntegrityRetriever" /> + + diff --git a/src/redturtle/volto/adapters/rss.py b/src/redturtle/volto/adapters/rss.py new file mode 100644 index 00000000..535570f5 --- /dev/null +++ b/src/redturtle/volto/adapters/rss.py @@ -0,0 +1,19 @@ +from plone.base.interfaces.syndication import IFeed +from plone.app.contenttypes.interfaces import IEvent +from Products.CMFPlone.browser.syndication.adapters import DexterityItem +from zope.component import adapter +from DateTime import DateTime + + +@adapter(IEvent, IFeed) +class EventItem(DexterityItem): + + @property + def startdate(self): + """ + Same format as other dates in + Products.CMFPlone.browser.syndication.adapters + """ + date = self.context.start.isoformat() + if date: + return DateTime(date) diff --git a/src/redturtle/volto/browser/overrides/Products.CMFPlone.browser.syndication.templates.RSS.pt b/src/redturtle/volto/browser/overrides/Products.CMFPlone.browser.syndication.templates.RSS.pt index b62afb5d..eb2bbdd3 100644 --- a/src/redturtle/volto/browser/overrides/Products.CMFPlone.browser.syndication.templates.RSS.pt +++ b/src/redturtle/volto/browser/overrides/Products.CMFPlone.browser.syndication.templates.RSS.pt @@ -56,7 +56,7 @@ Item - Published or last modified date if no published date + Published or last modified date if no published date Type