I have a themefragment that retrieves news items from a folder and displays them in a slideshow. It works fine on Plone 5.2 but gives an error in Plone 6.0.0b2.
Here it is:
<form>
<tal:block tal:define="
mtool portal/portal_membership;
can_edit python:mtool.checkPermission('Modify portal content', context);"
>
<div class="my-hero-block">
<div class="my-slider-header">
<div data-animation="slide" data-duration="500" data-infinite="1" class="slider w-slider">
<div class="w-slider-mask">
<metal:block tal:repeat="slide python:portal['slider'].restrictedTraverse('@@contentlisting')(portal_type='News Item')">
<tal:block tal:define="has_link python:getattr(slide,'link',None)">
<div class="my-slide-padding w-slide" style="transform: translateX(0px); opacity: 1;">
<metal:status tal:condition="can_edit">
<a href="${slide/getURL}/edit"
class="my-slider-state
state-${slide/review_state}" style="color:black;z-index: 3000">${slide/review_state} [edit]</a>
</metal:status>
<metal:withoutlink tal:condition="not:has_link">
<span class="my-slider-box w-inline-block">
<h1 class="heading-3">${slide/title}</h1>
<h4 class="my-slider-subheading">${slide/description}</h4>
</span>
</metal:withoutlink>
<metal:withlink tal:condition="has_link">
<a href="${slide/link}" class="my-slider-box w-inline-block">
<h1 class="heading-3">${slide/title}</h1>
<h4 class="my-slider-subheading">${slide/description}</h4>
</a>
</metal:withlink>
</div>
</tal:block>
</metal:block>
</div>
<div class="w-slider-arrow-left">
<div class="my-nav-arrow w-icon-slider-left"></div>
</div>
<div class="w-slider-arrow-right">
<div class="my-nav-arrow w-icon-slider-right"></div>
</div>
</div>
</div>
</div>
</tal:block>
</form>
Here's the error on Plone 6:
We’re sorry, but there seems to be an error…
Exception
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 167, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 376, in publish_module
Module ZPublisher.WSGIPublisher, line 271, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 68, in call_object
Module collective.themefragments.traversal, line 176, in __call__
Exception: zExceptions.NotFound: getURL
- Expression: "slide/getURL"
- Filename: slider
- Location: (line 16: col 54)
- Arguments: template: <ZopePageTemplate at /Plone/slider>
here: <PloneSite at /Plone>
context: <PloneSite at /Plone>
container: <PloneSite at /Plone>
nothing: None
options: {'args': ()}
root: <Application at >
request: <WSGIRequest, URL=https://8080-...138c7hn3z.ws-us65.gitpod.io/@@theme-fragment/slider>
modules: <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter object at 0x7f0b4aeee880>
view: <collective.themefragments.traversal.FragmentView object at 0x7f0b41d4de20>
portal_url: ...
portal: <PloneSite at /Plone>
user: <PropertiedUser 'admin'>
default: <DEFAULT>
repeat: <Products.PageTemplates.engine.RepeatDictWrapper object at 0x7f0b44a35d80>
loop: {'slide': <Products.PageTemplates.engine.RepeatItem object at 0x7f0b41d77e80>}
target_language: None
translate: <function BaseTemplate.render.<locals>.translate at 0x7f0b41aaa160>
attrs: {'href': '${slide/getURL}/edit', 'class': 'txbl-slider-state\n state-${slide/review_state}', 'style': 'color:black;z-index: 3000'}
mtool: <MembershipTool at /Plone/portal_membership>
can_edit: 1
slide: <plone.app.contentlisting.catalog.CatalogContentListingObject instance at /Plone/slider/test-news-item>
has_link: None