summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-12-08 10:28:38 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-12-08 16:22:00 +0100
commite70b41bda98a3acca2fa5e6f922efccdb1d6a866 (patch)
tree517d2503c0574de9dda268e331837cebc94aaa39 /contrib
parent9fdb714aea93e7c0bcf15865f433d702ea94ba5b (diff)
downloadcalcurse-e70b41bda98a3acca2fa5e6f922efccdb1d6a866.zip
calcurse-caldav: Add debug output for sync DB operations
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/caldav/calcurse-caldav.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py
index 97125f5..35bc8cb 100755
--- a/contrib/caldav/calcurse-caldav.py
+++ b/contrib/caldav/calcurse-caldav.py
@@ -198,6 +198,18 @@ def get_syncdb(fn):
return syncdb
+def syncdb_add(syncdb, href, etag, objhash):
+ syncdb[href] = (etag, objhash)
+ if debug:
+ print('New sync database entry: {} {} {}'.format(href, etag, objhash))
+
+
+def syncdb_remove(syncdb, href):
+ syncdb.pop(href, None)
+ if debug:
+ print('Removing sync database entry: {}'.format(href))
+
+
def save_syncdb(fn, syncdb):
if verbose:
print('Saving synchronization database to ' + fn + '...')
@@ -243,7 +255,7 @@ def push_objects(conn, syncdb, etagdict):
continue
href, etag = push_object(conn, objhash)
- syncdb[href] = (etag, objhash)
+ syncdb_add(syncdb, href, etag, objhash)
added += 1
return added
@@ -274,7 +286,7 @@ def remove_remote_objects(conn, syncdb, etagdict):
'calendar. Keeping the modified version on the server. '
'Run the script again to import the modified '
'object.').format(objhash))
- syncdb.pop(href, None)
+ syncdb_remove(syncdb, href)
continue
if verbose:
@@ -283,7 +295,7 @@ def remove_remote_objects(conn, syncdb, etagdict):
continue
remove_remote_object(conn, etag, href)
- syncdb.pop(href, None)
+ syncdb_remove(syncdb, href)
deleted += 1
return deleted
@@ -346,7 +358,7 @@ def pull_objects(conn, syncdb, etagdict):
continue
objhash = calcurse_import(cdata)
- syncdb[href] = (etag, objhash)
+ syncdb_add(syncdb, href, etag, objhash)
added += 1
return added
@@ -366,7 +378,7 @@ def remove_local_objects(conn, syncdb, etagdict):
continue
calcurse_remove(objhash)
- syncdb.pop(href, None)
+ syncdb_remove(syncdb, href)
deleted += 1
return deleted