[Vobject] Parsing question

Jeffrey Harris jeffrey at osafoundation.org
Sat Jan 9 18:11:16 CST 2010


Hi Dustin,

> I have the following two lines from a mac contacts vcard export:
> 
> item2.URL;type=pref:http\://sendoutcards.com
> item2.X-ABLabel:_$!<HomePage>!$_
>
> I can get the URL from vcard.url.value but it doesn't seem to
> automatically remove the escape character (\)

If this is VCARD 3.0, this is technically illegal, because colons aren't
backslash escaped according to RFC2426, only semi-colons.  There's a
patch that's been submitted to optionally treat this as an exception
rather than silently tolerating the un-escaped backslash.

In any case, removing the backslash probably isn't what vobject should do.

> Second questions is how do I get the label for the URL? ("Homepage")

There aren't any convenience functions for accessing related-by-group
content-lines, so you can do something like:

related_labels = [l for l in vcard.x_ablabel_list if l.group == 'item2']

> One other thing. I was wondering if you would consider putting this 
> email list in Google Groups or a forum so it is easier to search the 
> archives.

MarkMail is indexing the vobject mailing list, they have a very nice
interface for searching:

http://skyhouseconsulting.markmail.org/search/

Sincerely,
Jeffrey


More information about the VObject mailing list