#207: Allow Custom Portlet Managers
Change GenericSetup handling of portlet managers to allow for custom portlet managers, not only portlet managers that use the default class.
- Proposed by
- George Lee
- Proposal type
- Architecture
- Assigned to release
- Repository branch
- plip207-custom-portlet-managers
- State
- completed
Motivation
When the current GenericSetup import handler for portlets.xml registers a new portlet manager, it automatically creates one of class PortletManager from plone/portlets/manager.py.
This PortletManager class has a method getAddablePortletTypes which a developer may want to override. Specifically, with the current code, if a portlet type is not registered with any column interface, then it can be added to any portlet manager. A developer may want to create a portlet manager that blocks some of the standard portlets (such as Events or News) from being added to a portlet column. Currently, there is no way of specifying an alternative portlet manager class to use in order to allow different getAddablePortletTypes behavior like this.
By allowing a custom portlet manager class, we also allow developers to define portlet managers with additional methods, attributes, etc. on the class that might be useful for their use cases.
Proposal
Add support for an optional "manager" variable in the portlets.xml declaration of a portlet manager, equal to the dotted name of an alternative portlet manager class to use. If no name is specified, the default PortletManager class will still be used.
In addition, the export handling will export the dotted name of a portlet manager's class if it is different from the default.
Implementation
Example XML from portlets.xml using the new implementation:
Register a portlet manager that provides a custom interface IColumn and whose class is a custom type FooPortletManager:
<portletmanager name="plone.foo_column" type="plone.app.portlets.interfaces.IColumn" class="plone.app.portlets.tests.utils.FooPortletManager" />
Deliverables
- The new code!
- Modified or new test coverage
Progress log
Code completed!

