Commit 08a206ee authored by Sriram Karra's avatar Sriram Karra

Implement a del_folder() method for pimdb_cd to clear our entries from a given folder

parent 81e2a495
......@@ -742,7 +742,7 @@ class Asynk:
# real older sync is sort of called for.
conf.set_last_sync_start(pname, val=startt_old)
conf.set_last_sync_stop(pname, val=stopt_old)
logging.debug('Rest last sync timestamps to real values')
logging.debug('Reset last sync timestamps to real values')
else:
try:
startt = conf.get_curr_time()
......
......@@ -83,7 +83,17 @@ class CDPIMDB(PIMDB):
def del_folder (self, itemid, store=None):
"""Get rid of the specified folder."""
raise NotImplementedError
sess = self.session()
path = URL(url=itemid)
logging.info('Deleting all the contained items. Will not remove folder')
items = sess.getPropertiesOnHierarchy(path, (davxml.getetag,))
hrefs = [x for x in items.keys() if x != path.toString().strip()]
for href in hrefs:
sess.deleteResource(URL(url=href))
logging.info('Deleted file %s...', href)
def set_folders (self):
"""See the documentation in class PIMDB"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment