From 8d090b25883153cf98830f2645decd6f2b5db9e0 Mon Sep 17 00:00:00 2001 From: 1letter <1letter@gmx.de> Date: Wed, 3 Apr 2024 07:06:28 +0200 Subject: [PATCH] Update calculation of url by eventaccessor --- plone/app/event/dx/behaviors.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/plone/app/event/dx/behaviors.py b/plone/app/event/dx/behaviors.py index 885ba3ea..95de9aa3 100644 --- a/plone/app/event/dx/behaviors.py +++ b/plone/app/event/dx/behaviors.py @@ -32,7 +32,6 @@ from z3c.form.browser.textlines import TextLinesFieldWidget from zope import schema from zope.component import adapter -from zope.component.hooks import getSite from zope.globalrequest import getRequest from zope.interface import alsoProvides from zope.interface import implementer @@ -340,23 +339,12 @@ def uid(self): @property def url(self): - """calculate the path, is required as long the ram.cache is active in portlets renderer - the return value of self.context.absolute_url() differs - with ram cache: portal/testtermin - without ram cache: http://site.local/testevent + """need to lookup globalrequest in order to calculate + correct URL during cached lookup (eg. in event portlet renderer) """ - - portal = getSite() - portal_url = portal.absolute_url() - portal_path = list(portal.getPhysicalPath()) - event_path = list(self.context.getPhysicalPath()) - path_without_portal = "" - if len(portal_path) > 0: - path_without_portal = "/".join(event_path[len(portal_path) :]) - - url = f"{portal_url}/{path_without_portal}" - - return safe_text(url) + request = getRequest() + absolute_url = request.physicalPathToURL(self.context.getPhysicalPath()) + return absolute_url @property def created(self):