[Calypso] [PATCH] Catch and ValidateError, but still return the objects contents.

Jelmer Vernooij jelmer at jelmer.uk
Mon May 16 09:22:42 PDT 2016


From: Jelmer Vernooij <jelmer at jelmer.uk>

---
 calypso/webdav.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/calypso/webdav.py b/calypso/webdav.py
index d74ecd5..ef102fc 100644
--- a/calypso/webdav.py
+++ b/calypso/webdav.py
@@ -35,6 +35,7 @@ import tempfile
 import vobject
 import re
 import subprocess
+import vobject.base
 
 import ConfigParser
 
@@ -171,7 +172,11 @@ class Item(object):
         Text is the serialized form of the item.
 
         """
-        return self.object.serialize().decode('utf-8')
+        try:
+            return self.object.serialize().decode('utf-8')
+        except vobject.base.ValidateError, e:
+            self.log.warn('Validation error %s in %s', e, self.urlpath)
+            return self.object.serialize(validate=False).decode('utf-8')
 
     @property
     def length(self):
-- 
2.8.1



More information about the Calypso mailing list