Fix the GET and REPORT requests for vcards

This commit is contained in:
Guillaume Ayoub 2012-01-06 19:01:52 +01:00
parent fd3eacfe01
commit 1dfa887384

View File

@ -53,11 +53,14 @@ def serialize(tag, headers=(), items=()):
The collection has the given ``headers`` and ``items``. The collection has the given ``headers`` and ``items``.
""" """
lines = ["BEGIN:%s" % tag] if tag == "VCARD" or (tag == "VADDRESSBOOK" and items and len(items) == 1):
for part in (headers, items): lines = [items[0].text]
if part: else:
lines.append("\n".join(item.text for item in part)) lines = ["BEGIN:%s" % tag]
lines.append("END:%s\n" % tag) for part in (headers, items):
if part:
lines.append("\n".join(item.text for item in part))
lines.append("END:%s\n" % tag)
return "\n".join(lines) return "\n".join(lines)