RajatShukla / getpaid

Automatically exported from code.google.com/p/getpaid
0 stars 0 forks source link

restrict PloneGetPaid portlet availability for getpaid.formgen integration #236

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Comment by jonstahl,  Aug 05, 2008:

> Payable item needs to be not the form itself, otherwise the "buyable"
> portlet shows on the form. Perhaps this portlet could be suppressed?
> Otherwise we have to create "stub" payable objects.

I concur. I believe this could be handled by adding an "available" property
to the PloneGetPaid portlets. For example, in
Products/PloneGetPaid/browser/portlets/donate.py:

class Renderer(GetPaidRenderer):
...
    # The 'available' property is used to determine if the portlet should
    # be shown.
    @property
    def available(self):
        # Do not display on a Form Folder
        # if there's a GetpaidPFGAdapter in it.
        if self.context.portal_type == 'FormFolder':
            for key in self.context.keys():
                if self.context[key].portal_type == GetpaidPFGAdapter:
                    return False
        else:
            return self.marker.providedBy(self.context)

Original issue reported on code.google.com by mcgruff....@gmail.com on 5 Feb 2009 at 8:15