plone / plone.app.event

Event content type for Plone
https://pypi.python.org/pypi/plone.app.event
Other
17 stars 37 forks source link

portlet plone.app.event 5.1 render wrong event url's #387

Closed 1letter closed 7 months ago

1letter commented 1 year ago

Event Portlet in a Plone 6.0.7 render wrong event URL's

https://mysite.local/plone-site-id/Einrichtungen/...

normally it should be:

https://mysite.local/Einrichtungen/...

I have checked the following commands, it's reproducible:

bin/client1 fg

first call of a site with the event portlet: all is fine second call of a site with the event portlet: urls are wrong

bin/client1 start first call of a site with the event portlet: all is fine second call of a site with the event portlet: urls are wrong

if i downgrade the Package to 5.0.1, all is fine. Any Ideas?

Update if i disable the ram cache decorator in the portlet renderer # @ram.cache(_render_events_cachekey) all is fine.

Update if i enable the ram cache decorator in the portlet renderer @ram.cache(_render_events_cachekey) and purge the RAM Cache via caching-controlpanel, then the next request render the links correctly. but the second call render the links wrong.

Update if i use @instance.memoize instead of @ram.cache(_render_events_cachekey) then all is fine, but i don't know what are the side effects.

Update @instance.memoize is useless. the list of events is not hashable.

Update The eventlist values are changed in the ram cache. WTF? I debug plone.memoize.ram and set a breakpoint in the setter and in the getter method.

33] > /opt/development/collective/buildout.coredev/src/plone.memoize/plone/memoize/ram.py(79)__setitem__()
-> self.ramcache.set(value, self.globalkey, dict(key=self._make_key(key)))
(Pdb++) pp value[0].url
'http://site.local/testtermin'
(Pdb++) c
[52] > /opt/development/collective/buildout.coredev/src/plone.memoize/plone/memoize/ram.py(28)get()
-> return self.__getitem__(key)
(Pdb++) pp events[0].url
'http://site.local/testtermin'
(Pdb++) c
[33] > /opt/development/collective/buildout.coredev/src/plone.memoize/plone/memoize/ram.py(28)get()
-> return self.__getitem__(key)
(Pdb++) pp  events[0].url
'/plone/testtermin'

The event url switch from http://site.local/testtermin to /plone/testtermin. That's very strange.

@jensens Do you have experience with the behavior of the ram cache? My solution to fix this is to remove the cache decorator.

Update The event object is an instance of EventAccessor. The class provides the property url which construct the url via self.context.absolute_url() . Perhaps this is the problem. See comment in Traversable I will fix it in the EventAccessor.

petschki commented 7 months ago

Can you reproduce this on https://classic.demo.plone.org/en ... there the event portlet is always enabled with a test event.

petschki commented 7 months ago

Hm ... I see the URL of the Event on the Demo Site Event Portlet starts with /Plone which also isn't the expected result ...

petschki commented 7 months ago

fixed by #391