cyruslib.py

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Fri May 24 20:54:42 CEST 2013


 cyruslib.py |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit f9c50355bd0be03b80d952325b4fa4d740ad4c19
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri May 24 20:54:12 2013 +0200

    Correct the parsing of the responses for metadata / annotatemore even better

diff --git a/cyruslib.py b/cyruslib.py
index b144156..85d7e63 100644
--- a/cyruslib.py
+++ b/cyruslib.py
@@ -673,15 +673,20 @@ class CYRUS:
                     continue
 
         for annotation in annotations:
-            folder = annotation.split('"')[1].replace('"','')
+            annotation = annotation.strip()
+
+            if not annotation[0] == '"':
+                folder = annotation.split('"')[0].replace('"','').strip()
+                key = annotation.split('"')[1].replace('"','').replace("'","").strip()
+                _annot = annotation.split('(')[1].split(')')[0].strip()
+            else:
+                folder = annotation.split('"')[1].replace('"','').strip()
+                key = annotation.split('"')[3].replace('"','').replace("'","").strip()
+                _annot = annotation.split('(')[1].split(')')[0].strip()
 
             if not ann.has_key(folder):
                 ann[folder] = {}
 
-            key = annotation.split('"')[3].replace('"','').replace("'","")
-
-            _annot = annotation.split('(')[1].split(')')[0]
-
             try:
                 value_priv = _annot[(_annot.index('"value.priv"')+len('"value.priv"')):_annot.index('"size.priv"')].strip()
             except ValueError, errmsg:





More information about the commits mailing list