aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorSi Yong Kim <zzandland@gmail.com>2019-09-23 23:01:11 -0700
committerLukas Fleischer <lfleischer@calcurse.org>2019-11-03 10:56:47 -0500
commitb293b1829d1380ad04c69510559d44fe300eb501 (patch)
tree14700e3b3c98798ce3c93f90a01e1e3bb419ac1f /contrib
parent35eaa4a7373f5eb1394f6a2f37903308af0b04c1 (diff)
downloadcalcurse-b293b1829d1380ad04c69510559d44fe300eb501.tar.gz
calcurse-b293b1829d1380ad04c69510559d44fe300eb501.zip
calcurse-caldav: handle objects with status code 404
Display a warning if any of the events reported by the server cannot be found instead of bailing out. Addresses GitHub issue #137 and #245. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/caldav/calcurse-caldav.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py
index 009a443..d247f80 100755
--- a/contrib/caldav/calcurse-caldav.py
+++ b/contrib/caldav/calcurse-caldav.py
@@ -442,6 +442,16 @@ def pull_objects(hrefs_missing, hrefs_modified, conn, syncdb, etagdict):
die_atnode('Missing href.', node)
href = hrefnode.text
+ statusnode = node.find("./D:status", namespaces=nsmap)
+ if statusnode is not None:
+ status = re.match(r'HTTP.*(\d\d\d)', statusnode.text)
+ if status is None:
+ die_atnode('Could not parse status.', node)
+ statuscode = status.group(1)
+ if statuscode == '404':
+ print('Skipping missing item: {}'.format(href))
+ continue
+
etagnode = node.find("./D:propstat/D:prop/D:getetag", namespaces=nsmap)
if etagnode is None:
die_atnode('Missing ETag.', node)