[Vobject] reading vCard extracting type_param

Jeffrey Harris jeffrey at osafoundation.org
Fri Apr 11 16:25:01 CDT 2008


Hi Neil,

> In the actual vCard file I can see the tel: cell; 555-5555 lines as well 
> as the mobile, work, etc., but from every angle that I can see of the 
> vCard read via vObject, it doesn’t seem if that data has been derived.
> 
> In other words, I can reference each individual number of the tel 
> component, but cannot determine which it is.

Ah.  This is actually a subtle issue.

vCard 2.1 had the very bad idea of allowing vCard creators to omit the 
name of a parameter if they thought the meaning would be unambiguous. 
This makes life seriously painful for parsers.

Unfortunately these naked parameter values are used for things like 
quoted-printable encoding, too, so we can't just assume these are 
supposed to be a type.

For now, you can access these parameters via the singletonparams attribute:

 >>> t = vobject.base.textLineToContentLine("tel;cell:foo")
 >>> t.singletonparams
['cell']

These are all good questions, keep them coming!  I really need to write 
up vCard 2.1 documentation, having good questions makes that easier.

Sincerely,
Jeffrey


More information about the VObject mailing list