r2 - 21 Oct 2004 - 12:28:14 - JeffreyHarrisYou are here: OSAF >  Jungle Web  > VObject

Creating a Python VObject module

vCard, vCalendar 1.0, and vCalendar 2.0 (iCalendar) are widely used for storing contact and calendar information (see http://www.imc.org/pdi/ and http://www.imc.org/ietf-calendar/index.html). These file formats are syntactically very similar.

There are various free vCard and vCalendar parsers, there's even one written in Python (see http://savannah.nongnu.org/projects/python-pdi), but there isn't a standard Python vCard and vCalendar parser. It would surely be a boon for Python to have a standard module for parsing and outputting such files. Because the Python-pdi code is licensed GPL, it won't become part of the standard Python distribution.

If OSAF was willing to license a VObject module using the PSF license, perhaps it would be a useful contribution to the Python community and could potentially become part of the main Python distribution.

Update - VObject now lives at http://vobject.skyhouseconsulting.com

Rough outline of requirements for a VObject module

Define various VObjects (representing vCard 3.0, vCalendar 1.0, vCalendar 2.0) and provide an API for parsing text into such objects, adding and removing attributes from the objects, validating objects against the standards, and serializing the objects.

Parsing VObjects

  • Throw an exception or ignore invalid lines, depending on a processing flag
  • Warn or fail if required parameters are missing
  • unfold folded lines, decode encoded parameters (base64, and backslash character escapings, quoted printable if we want to implement vCard 2.1)
  • Deal smoothly with unicode
  • Interpret non-UTC timezones (if a timezone database is available, if not, then what?)

Modifying VObjects

  • Add/modify/remove contentline
  • Add/modify/remove parameter from a contentline
  • Add/modify/remove PRODID

  • Throw an exception if a parameter tries to be set to something invalid depending on a processing flag

Validating VObjects

  • Define VStandard objects (optional objects to be associated with specific VObjects?) that can be used to determine if a given VObject (or a piece of a VObject) is valid

Serializing VObjects

  • Deal smoothly with unicode
  • Output times in UTC
  • optionally define some arbitrary canonical form for serialization (length of lines, order of contentlines and parameters of each contentline) to make testing equality easier

Existing Python code

Dan Connolly has written fromIcal.py and toIcal.py to convert iCalendar files to/from RDF, this code is licensed under a W3C license, which is very liberal.

-- JeffreyHarris - 14 Jul 2004

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.