From: Matthew Vernon Date: Fri, 19 Oct 2018 10:21:36 +0000 (+0100) Subject: add utility function to pop an event from the cache X-Git-Tag: v0.1~18 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~matthewv/git?a=commitdiff_plain;h=6443975aaa3facb98cae1e65914aa2eb52d8cc11;p=gooswapper add utility function to pop an event from the cache --- diff --git a/gooswapper.py b/gooswapper.py index a4029f0..b14a695 100644 --- a/gooswapper.py +++ b/gooswapper.py @@ -56,6 +56,14 @@ class ex_gcal_link(exchangelib.ExtendedProperty): exchangelib.CalendarItem.register('gcal_link',ex_gcal_link) +#useful if you want to replay an event +def drop_from_ex_cache(itemid): + with open(cachepath,"rb") as f: + cache = pickle.load(f) + cache.pop(itemid) + with open(cachepath,"wb") as f: + pickle.dump(cache,f) + def get_ex_event_by_itemid(calendar,itemid): return calendar.get(item_id=itemid)