#207: Allow Custom Portlet Managers

Contents
  1. Motivation
  2. Proposal
  3. Implementation
  4. Deliverables
  5. Progress log
by George Lee last modified Feb 24, 2008 04:49 PM

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

  1. The new code!
  2. Modified or new test coverage

Progress log

Code completed!

Framework team vote

Posted by Martijn Pieters at Dec 14, 2007 02:00 PM
+1

Framework team vote

Posted by Andreas Zeidler at Dec 14, 2007 02:30 PM

Framework team vote

Posted by Raphael Ritz at Dec 17, 2007 01:22 PM
+1

Framework team vote

Posted by Tom Lazar at Dec 20, 2007 01:08 PM
+1

Framework team vote

Posted by Danny Bloemendaal at Dec 22, 2007 05:45 PM
+1