Developer documentation

The IEvent interface

All event types should implement the IEvent interface from plone.event.interfaces, in order that some functionality of can be used. For example, catalog searches for event objects ask for the IEvent interface in the object_provides index:

from plone.event.interfaces import IEvent

Custom event content types

Using Dexterity behaviors to build new content types with IEvent support

For Dexterity use the and optionally any other event related behavior from there.

You can just enable the behaviors you want to use for your custom content type in the FTI via GenericSetup or through the web. This types/Event.xml GenericSetup FTI configuration snippet from shows an example. The only behavior, which is definitely needed is the IEventBasic behavior. All other are optional:

<property name="behaviors">
    <element value=""/>
    <element value=""/>
    <element value=""/>
    <element value=""/>
    <element value=""/>
    <element value=""/>
    <element value=""/>
    <element value=""/>
    <element value=""/>
    <element value=""/>
    <element value=""/>
    <element value="" />

Of course, it’s also possible to create a new behavior which derives from’s one, like so:

from import IEventBasic
from import IEventLocation
from import IEventRecurrence
from import first_weekday_sun0
from import IDXEvent
from import IDXEventLocation
from import IDXEventRecurrence
from plone.autoform import directives as form
from plone.autoform.interfaces import IFormFieldProvider
from zope.interface import alsoProvides

class IEvent(IEventBasic, IEventRecurrence, IEventLocation,
             IDXEvent, IDXEventLocation, IDXEventRecurrence):
    """Custom Event behavior."""
    form.widget('start', first_day=first_weekday_sun0)
    form.widget('end', first_day=first_weekday_sun0)
alsoProvides(IEvent, IFormFieldProvider)


If you don’t register the behavior with a factory and a marker interface like it’s done in, the behavior is the marker interface itself (see’s documentation on behavior marker interfaces). In this case, the behavior should also derive from the marker interfaces defined in in order to let it use all of’s functionality (indexers, adapters and the like).


You have to reconfigure the start, end and recurrence fields’ widgets again. The widgets for the start and end fields have to be configured with the first_day parameter while the recurrence field widget has to be configured with the first_day and start_field parameters. Even if the start field is derived from another behavior, in this case the dotted-path includes the new behavior: IEvent.start.

Then register the behavior in ZCML:

    description="A Event"

And register it in your FTI via GenericSetup as usual.

Extending the Archetypes based class

For Archetypes, derive from

Here is an example from collective.folderishtypes:

from Products.Archetypes import atapi
from import content as event

type_schema = event.ATEventSchema.copy()  # Add your custom fields here
# Move location back to main schemata
type_schema.changeSchemataForField('location', 'default')
type_schema.moveField('location', before='attendees')

class CustomEvent(event.ATEvent):
    portal_type = 'Custom Event'
    _at_rename_after_creation = True
    schema = type_schema
atapi.registerType(CustomEvent, PROJECTNAME)

Register this type in the FTI via Generic Setup as usual.

None of the above

If you cannot use the above two methods, you can still implement the plone.event.interfaces.IEvent interface.

In any case you might need to provide an IEventAccessor adapter. For more information, see below.

Getting and setting properties

For Dexterity based types: Accessing properties behavior interface adaption

To use the functionality provided by the behaviors, get the behavior adapter first. For example, for setting or getting attributes of an event object, do:

from import IEventBasic
event = IEventBasic(obj)
event.start = datetime(2011,11,11,11,00)
event.end = datetime(2011,11,11,12,00)
event.timezone = 'CET'

import transaction

Alternatively, use the more convenient IEventAccessor pattern described below.

Accessing event objects via an unified accessor object

To make it easier to support Archetypes and Dexterity based objects, an adapter for content objects is provided, which allows unified interaction with event objects.

The interface definition can be found in plone.event.interfaces.IEventAccessor. Default accessors:

  • For IEvent (plone.event.interfaces.IEvent) implementing objects: plone.event.adapters.EventAccessor.
  • For IATEvent (
  • For IDXEvent (
  • For IOccurrence (plone.event.interfaces.IOccurrence):

Event objects implement the IEvent interface from plone.event.interfaces.

The objects can be accessed like so:

from plone.event.interfaces import IEventAccessor
acc = IEventAccessor(obj)
assert(isinstance(acc.start, datetime)==True)
assert(isinstance(acc.timezone, string)==True)
assert(isinstance(acc.recurrence, string)==True)

Set properties of the object via the accessor. Don’t forget to throw ObjectModifiedEvent after setting properties to call an event subscriber which does some timezone related post calculations:

from zope.event import notify
from zope.lifecycleevent import ObjectModifiedEvent
tz = pytz.timezone('Europe/Vienna')
acc.start = datetime(2012, 12, 12, 10, 10, tzinfo=tz)
acc.timezone = 'Europe/London'

You can also use the accessor edit method, which also throws the ObjectModifiedEvent event for you:

acc.edit(end=datetime(2012, 12, 12, 20, 0, tzinfo=tz))

For creating events, you can use the accessor’s create method, which again returns an accessor. E.g. if you want to create the Dexterity based event type:

from import EventAccessor
acc = EventAccessor.create(
    title=u'New Event'
    start=datetime(2013, 7, 1, 10, 0, tzinfo=tz),
    end=datetime(2013, 7, 1, 12, 0, tzinfo=tz),
acc.location = u"Graz, Austria"

Access the content object from an accessor like so:

obj = acc.context
from plone.event.interfaces import IEvent
assert(not IEvent.providedBy(acc))

Getting occurrences from IEventRecurrence implementing objects

Events with recurrence support should implement the IEventRecurrence (plone.event.interfaces.IEventRecurrence) interface.

An IRecurrenceSupport implementing adapter allows the calculation of all occurrences:

from plone.event.interfaces import IRecurrenceSupport
rec_support = IRecurrenceSupport(obj)

# All occurrences of the object

# All occurrences within a time range
start = datetime(2012,1,1)
end = datetime(2012,1,3)
rec_support.occurrences(range_start=start, range_end=end)

If you want to get all occurrences from any event within a timeframe, use the get_events function like so:

from import get_events, localized_now
occ = get_events(context, start=localized_now(), ret_mode=2, expand=True)

Reusing the @@event_summary view to list basic event information

The @@event_summary listing lists basic event information including microdata on the right hand side of the default event view. You can reuse this listing in custom views by calling the event_summary view on an IEvent providing context in page templates like so:

<tal:eventsummary replace="structure context/@@event_summary"/>

or in Python code like so:


There are cases where you might exclude some of this information. You can do that by overriding the excludes list of the view. Possible values are: