[Vobject] Mac OS X AddressBook and vobject

Lars Immisch lars at ibp.de
Mon Jan 16 16:27:58 CST 2006


Dear all,

I'm totally new to vobject; I downloaded it today.

I'm glad it exists, I've been avoiding to write one for myself for years.

And it does work!

I just hit a minor snag with data that was exported from the Mac OS X 
Address Book.

vCards from AB looks like:

BEGIN:VCARD
VERSION:3.0
N:Immisch;Lars;;;
FN:Lars Immisch
TEL;type=HOME;type=pref:040-3172542
item1.ADR;type=HOME;type=pref:;;Reeperbahn 116;Hamburg;;22767;
item1.X-ABADR:de
item2.X-ABRELATEDNAMES;type=pref:Claudia Daboul
item2.X-ABLabel:_$!<Partner>!$_
END:VCARD

I believe this is valid according to RFC 2426.

Attached is an ad-hoc patch that allows me to read my AB-generated 
vCards. The difference is the optional group before the name.

Index: vobject.py
===================================================================
--- vobject.py  (revision 104)
+++ vobject.py  (working copy)
@@ -466,9 +466,9 @@

  # get a full content line, break it up into name, parameters, and value
  patterns['line'] = r"""
-^ (?P<name> %(name)s )               # name group
-  (?P<params> (?: %(param)s )* )     # params group (may be empty)
-: (?P<value> .* )$                   # value group
+^ (?P<group> %(name)s\.)?(?P<name> %(name)s ) # name group
+  (?P<params> (?: %(param)s )* )              # params group (may be empty)
+: (?P<value> .* )$                            # value group
  """ % patterns

  ' "%(qsafe_char)s*" | %(safe_char)s* '

Kind regards,

Lars Immisch


More information about the VObject mailing list