Today we had a need to extend the CPSSharedCalendar a little bit in a
separate project. The functionality needed was not seen as generic enough to
go into the CPSSharedCalendar itself. Luckily, since it's written with Five,
this can be done easily, and without touching the original code, or monkey
patching, and with none of the standard problems of using portal_skins. So I
thought it might be interesting to show how this is done, as a way to
convert more people to Zope3 and Five.

Basically, the project needed to display a list of events from the users
calendar, but only the events from today, and with a custom formatting. Here
is the rough steps used, as an example to show to others how to do it:

  • Create a new product. A folder under Products and an empty is all that
    is needed.

  • Create a view class that has a method that performs the actions you need.
    Lets call the module, and the class

class CustomEventsView:
"View for returning a list of all events of today"

def getEvents(self):
events = self.context.getTheEventsWhichIwant()
return events

  • Create a template that calls the view class, and return the list of events as you want it,
    lets call it

<html metal:use-macro="context/@@standard_macros/page">
<metal:block fill-slot="body">
<ul tal:define="events view/getEvents">
<li tal:contents="event/title" />

  • Create a configure.zcml that connects the template to the view

<configure xmlns=""

This example, as you see, provides no great functionality. Only another,
custom view. But the point here is that this customization is completely
local, it does not require any modification of the original software, nor does it
monkeypatch it. At the same time, should you want to, the customization is
easy to move into the original product.

But, you say, this can be done by making a new skin in portal_skins! Sure,
but then you run into problems of the restricted code of python scripts.
This is all disk based, and has no such problems. Also, normally you would
have to set up a custom skin folder for these overrides, and they have to be
set up in the Zope site, while this type of Zope3/Five extension only needs
you to copy the product into the Products folder and restart Zope. You don't need
to run any installation scripts, or add any new skin folder to the list of
folders in all the skins.

That's the power of Zope3 and Five.

(Post originally written by Lennart Regebro on the old Nuxeo blogs.)