summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2020-05-05 14:02:13 +0200
committerTobias Brox <tobias@redpill-linpro.com>2020-05-05 14:02:13 +0200
commit0999f2cf3df5279428cac6bc2d6c9ee37a43dc12 (patch)
treed8299b5c9e0d4a1bdfa5df9aa6c03eca20b0af51
parentdbb8a51ee3591b2898d68ce2a68ccc8241c44f57 (diff)
downloadcalendar-cli-0999f2cf3df5279428cac6bc2d6c9ee37a43dc12.zip
remove untested nonworking code for deleting events by timestamp, fixes https://github.com/tobixen/calendar-cli/issues/62 - deletion by timestamp will be reintroduced as part of https://github.com/tobixen/calendar-cli/issues/12
-rwxr-xr-xcalendar-cli.py17
1 files changed, 1 insertions, 16 deletions
diff --git a/calendar-cli.py b/calendar-cli.py
index 2c2452f..b08eb19 100755
--- a/calendar-cli.py
+++ b/calendar-cli.py
@@ -372,22 +372,8 @@ def calendar_delete(caldav_conn, args):
event = cal.event_by_uid(args.event_uid)
elif args.event_url:
event = cal.event_by_url(args.event_url)
- elif args.event_timestamp:
- raise NotImplementedError("this hasn't been implemented yet - see code comments")
- ## It seems that at least DAViCal requires the end of the
- ## search to be beyond the event dtend, which makes deletion
- ## by event_timestamp a bit more complex to implement.
- dtstart = dateutil.parser.parse(args.event_timestamp)
- #dtend = dtstart + timedelta(1,0,0,1)
- events = cal.date_search(dtstart, dtend)
- if len(events)>1:
- raise NotImplementedError("Several events found with that timestamp; cowardly refusing to delete anything")
- elif not len(events):
- raise caldav.lib.error.NotFoundError("Couldn't find any event at %s" % dtstart)
- else:
- event = events[0]
else:
- raise ValueError("Event deletion failed: either uid, url or timestamp is needed")
+ raise ValueError("Event deletion failed: either uid or url is needed")
event.delete()
def journal_add(caldav_conn, args):
@@ -922,7 +908,6 @@ def main():
calendar_delete_parser = calendar_subparsers.add_parser('delete')
calendar_delete_parser.add_argument('--event-uid')
calendar_delete_parser.add_argument('--event-url')
- calendar_delete_parser.add_argument('--event-timestamp')
calendar_delete_parser.set_defaults(func=calendar_delete)
args = parser.parse_args(remaining_argv)