From 1dfa887384047a28823660148fa44f7326324101 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Fri, 6 Jan 2012 19:01:52 +0100 Subject: [PATCH] Fix the GET and REPORT requests for vcards --- radicale/ical.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/radicale/ical.py b/radicale/ical.py index de14a49..6072bb2 100644 --- a/radicale/ical.py +++ b/radicale/ical.py @@ -53,11 +53,14 @@ def serialize(tag, headers=(), items=()): The collection has the given ``headers`` and ``items``. """ - lines = ["BEGIN:%s" % tag] - for part in (headers, items): - if part: - lines.append("\n".join(item.text for item in part)) - lines.append("END:%s\n" % tag) + if tag == "VCARD" or (tag == "VADDRESSBOOK" and items and len(items) == 1): + lines = [items[0].text] + else: + lines = ["BEGIN:%s" % 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)