Open tribut opened 11 years ago
looks like vobject can't handle that vcard. I guess I'll wrap that function call and print failing vcards, so we might know what the problem is
could you check out pycarddav's develop branch, install it and try again? pycarddav should now print the vcard in case (and ignore it until next sync). You might want to paste the card (with all personal information redacted of course) or send it by email, so I can have a look at it.
I took a deeper look at the problem and it was a comma in an Organization field. I don't know if it's legal or not in VCARD, but the field gets split by commas and then the seriealizer is not expecting a list instead of a string. I sent an e-mail to the vobject mailing list about it but is waiting to be approved.
I believe ',' and ';' must be escaped with a backslash '\'
It would be nice if vobject would be a more forgiving. But since there seems to be hardly any development going on at vobject, I might switch to an icalendar based solution (if I find the time), since python 3 support would be awesome (which is not yet in icalendar, but they are working on it).
not correctly escaped ',' might be an issue with VCards set up with owncloud https://github.com/owncloud/contacts/issues/170
In model.py
at function vcard_from_string(vcard_string)
, when printing the vcard_string
, this is what I get for a contact that has a comma in the organization:
BEGIN:VCARD
VERSION:3.0
UID:87452b8b1e
PRODID:-//ownCloud//NONSGML Contacts 0.2.5//EN
REV:2013-09-17T21:11:21+00:00
FN:Test Man
N:Man;Test;;;
ORG:Test, Org
END:VCARD
I don't know if this is an owncloud problem or vobject (vobject doesn't seem to behave as it should anyway, it should handle malformed data with a graceful error, if owncloud is really sending wrong data).
the RFC specifies that commas MUST be escaped, but you are right, vobject should at least handle that error more graceful (perhaps it can be configured to do that, I'll have to look into this)
Hi.
Using pycarddav 0.5.1 from pip I get the following exception trying to sync an owncloud 5.0.10 installation:
I tried to re-add the except block removed in https://github.com/geier/pycarddav/commit/4176b09407971330d2da540e5b9a2c731bb6ae0d#L0L681 but only got another exception:
I'm using Python 2.7.3 from Debian wheezy.