Developer Insights

iCal invitations with Plone

Posted in ical, Plone, Python, Zope by Ricardo Alves on May 31, 2009

I recently released the first beta of collective.eventinviter — sorry for the name, but couldn’t come up with a better one. It’s a simple add-on package that enables Plone to send an iCal invitation (email with an attached .ics file) to each event attendee. Something that may be desirable in collaboration/intranet environments.

The emails are sent based on the content of the attendees field. So it checks each value at the attendees field, and sends email messages if:

  • The value is the username of a registered user, and if that user has a valid email address.
  • The value is a valid email address.

Values that match none of the these conditions are simply ignored.

Although it is intended to work out-of-the-box for the most common use cases, it is also possible to adapt collective.eventinviter to other event content types, i.e. other than ATEvent. For example, if we have a custom content type ‘MyEvent’, to enable iCal invitations it just needs to implement the marker interface IInvitationAware:

from collective.eventinviter.interfaces import IInvitationAware
...
class MyEvent(...):
    ...
    implements(IInvitationAware)
...

If, for some reason, MyEvent holds information about attendees at different field(s), an adapter implementing IAttendeeEnumerator must retrieve such list of recipients properly, which should be pretty simple to implement:

from collective.eventinviter.interfaces import IInvitationAware
from collective.eventinviter.interfaces import IAttendeeEnumerator
...
class AttendeeEnumerator(object):
    implements(IAttendeeEnumerator)
    adapts(IMyEvent)

    def attendees(self):
        # return list of valid email recipients
        ...
...

Currently there are some changes that I would like to include, maybe after some discussion, before a final release:

  • Make it optional to invite attendees, using a global configuration (property) or a checkbox for each event edition.
  • Include more information at the email message sent. Currently, the message includes only the event title and an attached .ics file.
  • Should this feature be available as a content rule?

Feedback, suggestions and testing results would be very much appreciated.

Advertisements