[Cosmo-dev] custom iCalendar data in an EIM world

Morgen Sagen morgen at osafoundation.org
Thu Dec 14 14:14:20 PST 2006


On Dec 13, 2006, at 4:46 PM, Jeffrey Harris wrote:

> Hi Folks,
>
> I'm working on bug 6702, get Chandler to stop throwing away iCalendar
> data it doesn't understand.
>
> On the surface, this is fairly easy, we can just keep the original
> iCalendar stream, when we serialize re-use anything we didn't change.
>
> I'm wondering how this will work in the EIM universe, though.  Seems
> like there are two parallel use cases we should look at together:
>
> Tom PUTs a VEVENT to Cosmo using iCal/CalDAV, with a bunch of X-APPLE
> properties, then Chandler downloads that event using EIM
>
> vs.
>
> Tom emails me a VEVENT using iCal, I put it up on Cosmo using EIM,  
> then
> Tom grabs the event back using using CalDAV, hoping not to have  
> lost all
> his spiffy custom X-APPLE properties
>
> Do we have a plan for harmonizing this stuff?

One way would be to add a (persistent) dictionary attribute to  
Chandler Event items which hold all non-standard icalendar  
properties.  (Non-Chandler devs, excuse my python):

	class EventStamp(Stamp):
		icalext = schema.Mapping(schema.Text)

	event.icalext = { 'X-APPLE-FOO' : 'xyzzy', 'X-APPLE-BAR' : 'plugh' }

Then we could define an "icalendar extension" EIM record type:

	class IcalExtensionRecord(sharing.Record):
		URI = "http://osafoundation.org/eimml/icalext"

		uuid = sharing.key(ItemRecord.uuid)
		name = sharing.key(sharing.TextType(size=256))
		value = sharing.field(sharing.TextType(size=1024))

An instance of such a record would hold a single name/value pair:

	icalExtensionRecord('8501de14-1dc9-40d4-a7d4-f289feff8214', 'X-APPLE- 
FOO', 'xyzzy')
	icalExtensionRecord('8501de14-1dc9-40d4-a7d4-f289feff8214', 'X-APPLE- 
BAR', 'plugh')

The import/export methods assigned to this record type would convert  
back and forth between these records and the icalext attribute.  In  
fact, if Chandler does start actually making use of one of these non- 
standard properties in the future, the EIM record types don't have to  
change.  For example, say that we decide to start using 'X-APPLE- 
FOO', we could add an attribute to the Chandler domain model:

	class EventStamp(Stamp):
		icalext = schema.Mapping(schema.Text)
		foo = schema.One(schema.Text)

	event.icalext = { 'X-APPLE-BAR' : 'plugh' }
	event.foo = 'xyzzy'

The new import/export callbacks for the icalExtension record type  
would now be responsible for taking the X-APPLE-FOO value and  
sticking into event.foo and vice-versa.

>
> On a related note, iCalendar models alarms as sub-objects of events,
> whereas Chandler models them as separate, linked items.  I'm not sure
> how that'll work for Cosmo's CalDAV implementation when we're  
> publishing
> items using EIM.

Yeah, reminders are something we haven't yet added to the EIM record  
types yet.  What information do you need to transport?  Can it simply  
be represented by one or two fields as part of the EventRecord ?  By  
the way, the record types we have defined are at http://tinyurl.com/ 
w4s9f .

~morgen




More information about the cosmo-dev mailing list