espenmn
(Espen)
May 13, 2016, 3:43pm
1
I am making a (slideshow) portlet for Plone 5.
How can I search the catalog 'from the portlet?
I have given it quite a few tries, and used syntaxes that I think worked in Plone 4:
Is the 'renderer' the right place to define things ?
( https://github.com/espenmn/spacetheme/blob/master/medialog.spacetectheme/src/medialog/spacetectheme/portlets/sliderportlet.py#L88 )
jensens
(Jens W. Klein)
May 13, 2016, 3:51pm
2
There is no difference between Plone 4 and 5 if it comes to portlets.
Renderer is perfectly fine.
Just don't pass non-existing query keys, like sorton
and sortorder
(missing underscore) otherwise result is empty.
Edit: And don't kill the performance by doing image.getObject() for all results,
1 Like
davilima6
(Davi Lima)
May 14, 2016, 10:56am
3
You may look at how the news portlet does it:
@property
def title(self):
return _(u"News")
class Renderer(base.Renderer):
_template = ViewPageTemplateFile('news.pt')
def __init__(self, *args):
base.Renderer.__init__(self, *args)
@ram.cache(render_cachekey)
def render(self):
return xhtml_compress(self._template())
@property
def available(self):
return self.data.count > 0 and len(self._data())
def published_news_items(self):
espenmn
(Espen)
May 15, 2016, 7:00pm
4
thans a lot (it's up and running )
I noticed that some 'portlet products' use syntax like
def getitems(self):
and some use 'data', as the news portlet
Does this matter
(except from using view/data/something in portlet.pt instead of view/something)
davilima6
(Davi Lima)
May 15, 2016, 10:25pm
5
The attributes from data
come from the Assignment class, which in turn implements the portlet schema as defined by its Interface (INewsPortlet). So, data
gives you the fields editable by the end user.