« Blogging About Theming - At Last | Main | Reordering / Hiding Viewlets - Argh! »

Overriding portlets -- common stumbling blocks

Skinner's tip #2
------------

It's dumb, and it happens to me constantly, but there are a few things I occasionally forget when trying to override a portlet:

1) If you get an error like this:

File "/opt/zope/buildouts/otis/src/plonetheme.mytheme/plonetheme/mytheme/browser/configure.zcml", line 51.1, unbound prefix

Add the xmlns:plone="http://namespaces.plone.org/plone" namespace to the top of your browser/configure.zcml file.

2) Before your portlet override code, make sure you add this snippet:

‹include package="plone.app.portlets" /›

3) Watch your path back to plone.app.portlets.portlets (note the double mention of portlets). You're walking through a folder structure, and portlets are nested a little deeper than viewlets. As for the "navigation" bit in the portlet= assignment below, that refers to navigation.py (a file, not a folder), and INavigationPortlet is an interface defined in that file.

‹plone:portletRenderer
portlet="plone.app.portlets.portlets.navigation.INavigationPortlet"
template="navigation.pt"
layer=".interfaces.IThemeSpecific"
/›

4) Note also that we're using the portletRenderer directive for overriding portlets, rather than the portlet directive that you find in existing (Plone default) portlets.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)