Hallo,

I have made a custom portlet in Plone 3 that displays Cost Estimates/Quotes
in certain states under certain
circumstances.
The query is such that it wil sometimes return an empty list.
Just like Plone's Events portlet, it should not display when the list is
empty, i.e. when there are no quotes to display.
Also, since it is the only portlet in the right hand column, the whole
column should not display when the portlet is empty,
just like with the Events portlet.

I have tried using
@property
def available(self):
    return len(self._data())

but this causes an AttributeError on renderer.available in def
_lazyPortlets:

@memoize
def _lazyLoadPortlets(self, manager):
    retriever = getMultiAdapter((self.context, manager), IPortletRetriever)
    items = []
    for p in self.filter(retriever.getPortlets()):
        renderer = self._dataToPortlet(p['assignment'].data)
        try:
            isAvailable = renderer.available

Is this the right way to go about making sure the portlet and column does
not display when the portlet's data list is empty?
If so, how do I give my Renderer class the "available" property, so that I
don't get the AttributeError?

At the moment I have placed a condition around my portlet template, to check
whether there is data to display.
This hides the portlet, but doesn't get rid of the column with the "Manage
portlets" link.
(Also, I don't want to place conditions in the main_template.)
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to