Skip to content

mxm, IT's mad science

Sections
Personal tools
You are here: Home » Products » Open Source » mxm Ical Tool
Downloads
You can download mxm products here.

Due to it's technical and international nature, this section is in english.

Max M Has a blog too.

og er glad for mad

 

mxm Ical Tool

A tool for importing and exporting iCalender (.ics) files. to/from standard events in a Plone site.

If you want to publish one or more Plone events as an iCalendar file, you can use this tool.

You can publish events via the catalog, from a single folder, from a branch of the site, or even single events using this tool. You can also import events from and iCalender file to a Plone Folder.

Rumor has it that "Mozilla Calendar", "Apple iCal", "Ximian Evolution", "KOrganizer" and more, can read iCalendar files. I have mostly tested it with the Mozilla Calendar, and have published my Plone events to it.

I also use it in an customer tool to syncronize to GroupWise calendars.

It should follow the RFC 2445 (iCalender v.2.0) 100%, but I would love to hear success/failue stories.

Usage (python scripts in the skin)

Exporting

To export an iCalendar file of all your published events, you should use the "events.ical" python method:

            http://www.example.com/events.ical

To create a file from published events in a member folder and down:

            http://www.example.com/members/maxm/events.ical

There is a method called "catalogued_events.ics" which uses only catalogued data, so it should be faster. It has the disadvantage of only publishing the catalogued data, so it's a bit lossy.

To publish the events from a single folder, use the "event_folder.ics" method, which uses the event objects in the folder:

            http://www.example.com/members/maxm/my_events/event_folder.ics

To publish a single event, use the "as_ical" method. It converts a single Plone event to an iCalendar file:

            http://www.example.com/someevent/as_ical

Importing

You can import events from an iCalendar with the import_ical_form form. It is a very simple form and looks like this:

Import form

After the import, the events will be in the folder the form is used upon.

API (the tool itself)

iCalendar files are text files with a special format. The tool has a very simple API to convert to and from these "iCalendar string". Just 2 methods.

The first method converts from a list of events to an iCalendar string:

        to_ical(events, adapter='Event')

The second method converts an iCalendar string to a list of events, and store them in a Plone folder:

        from_ical(ical_string='', folder=None, adapter='Event')

For examples you can check out the python script in the skin.

The real magic happens in the "adapter" parameter.

It can be a named adapter, which is a string naming one of the default adapters that is defined in the tool. so far there is "Event", "Brain" and "VEvent".

It can also be an adapter that is defined in an external method or 3. party product.

An adapter is a class special class that can convert to and from iCalandar values. (More info and examples in the "adapters.py" file.) It's pretty straightforward to create your own adapters. This should make it easy to import/export special objects like ATEvent's etc.

If you make new adapters, please let me know, and I will include them in the tool.

Requirements

You need the iCalendar package for this to work. You can get the latest version from here

You should install it somewhere in the Python path of your Zope server. If you are in doubt, install it in "INSTANCE_HOME/lib/python/" so the complete path to the package will be "INSTANCE_HOME/lib/python/iCalendar"

Contact

maxm@mxm.dk

License

GPL

Download

Get it from here

Created by maxm
Last modified 2005-02-08 04:20 PM

Don't use that iCal download link

Posted by Anonymous User at 2006-04-20 01:55 AM
Since iCal has now been moved to a new site - I assume the link to the old version download is out of date? This is untested, but I suspect we should be downloading iCal from http://codespeak.net/icalendar/.

IndexError: list index out of range

Posted by Anonymous User at 2006-07-09 06:58 PM

WHAT DID I DO WRONG

Traceback (innermost last):
Module ZPublisher.Publish, line 113, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 40, in call_object
Module Products.mxmContacts.mxmContacts, line 326, in importCSV
IndexError: list index out of range

doesn't work

Posted by Anonymous User at 2006-09-13 12:36 PM
I always get the following traceback when I access events.ics. I tried with both, iCalendar-0.10 and iCalendar 0.11.

2006-09-13 13:32:38 ERROR Zope.SiteErrorLog http://kybwiki.kyb.local:9080/plone/events.ics
Traceback (innermost last):
Module ZPublisher.Publish, line 115, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.CMFCore.FSPythonScript, line 108, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 37, in events.ics
- <FSPythonScript at /plone/events.ics>
- Line 37
Module Products.mxm_icaltool.mxm_icaltool, line 64, in to_ical
Module Products.mxm_icaltool.adapters, line 41, in update_from
Module Products.mxm_icaltool.adapters, line 369, in get_dtstart
Module Products.mxm_icaltool.adapters, line 173, in DT2dt
TypeError: 'UTC' object is not callable