From f9c50355bd0be03b80d952325b4fa4d740ad4c19 Mon Sep 17 00:00:00 2001 From: "Jeroen van Meeuwen (Kolab Systems)" Date: Fri, 24 May 2013 20:54:12 +0200 Subject: Correct the parsing of the responses for metadata / annotatemore even better --- cyruslib.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cyruslib.py') 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: -- cgit v1.1