From 213cb40480f3776ec9fd2478bbcb0de2ff735de9 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Fri, 21 Aug 2015 20:08:56 +0200 Subject: [PATCH 1/2] Don't discard PROPPATCH on empty collections. --- radicale/storage/database.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/radicale/storage/database.py b/radicale/storage/database.py index 6a2c1ad3..0bdcd836 100644 --- a/radicale/storage/database.py +++ b/radicale/storage/database.py @@ -243,14 +243,12 @@ class Collection(ical.Collection): old_properties = properties.copy() yield properties # On exit - if self._db_collection and old_properties != properties: + if old_properties != properties: for prop in db_properties: self.session.delete(prop) for name, value in properties.items(): - prop = DBProperty() - prop.name = name - prop.value = value - prop.collection_path = self.path + prop = DBProperty(name=name, value=value, + collection_path=self.path) self.session.add(prop) @property From 57b1ccdea59835969489e5f515f4378e4fa57c0f Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Fri, 21 Aug 2015 20:11:44 +0200 Subject: [PATCH 2/2] Fix crash on empty values --- radicale/storage/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radicale/storage/database.py b/radicale/storage/database.py index 0bdcd836..dd2317ec 100644 --- a/radicale/storage/database.py +++ b/radicale/storage/database.py @@ -247,7 +247,7 @@ class Collection(ical.Collection): for prop in db_properties: self.session.delete(prop) for name, value in properties.items(): - prop = DBProperty(name=name, value=value, + prop = DBProperty(name=name, value=value or '', collection_path=self.path) self.session.add(prop)