[Vobject] difference between handling of 2.1 and 3.0

Jeffrey Harris jeffrey at osafoundation.org
Thu Jan 8 14:31:28 CST 2009


Hi Jonathan,

> I noticed something odd. I have the following code:
> 
> data = """BEGIN:VCARD
> VERSION:3.0
> FN:John Smith
> N:Smith;John;;;
> END:VCARD"""
> 
> vcards = vobject.readComponents( data, allowQP=True )
> v = vcards.next()
> print type(v.n.value)
> print v.n.value
> 
> The output I see is:
> 
> <class 'vobject.vcard.Name'>
>  John  Smith
> 
> Which is what I expect. However, if I change the version to 2.1, I see:
> 
> <type 'unicode'>
> Smith;John;;;
> 
> Why is the return value for the "N" component different between 2.1 and 3.0?
> I am currently using version 0.6.6 of vobject.

There's a tree of behaviors that get assigned to objects when they get
parsed, depending on what component/version you're using (so iCalendar
has its set of behaviors, and vCard another).

The system *ought* to fall back to VCARD 3.0 if no behavior is found for
VCARD 2.1, but it looks like that isn't working, I'm not sure why.
Thanks for pointing it out.  I'm not sure when I'll get around to fixing
that, but as usual, Patches Welcome :)

Sincerely,
Jeffrey


More information about the VObject mailing list