summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2018-03-27 11:09:00 +0200
committerGitHub <noreply@github.com>2018-03-27 11:09:00 +0200
commit067aaaaf0fe5e732f42c56714a4e9e83349d5364 (patch)
tree18e18db5b51599891e99d578290d98ba1ce2a3d6
parent5d533b1da2ec7095106b76219b59eda0a686175c (diff)
parente14aa5ff6066bdb2d547a328a65cb301ba699f74 (diff)
downloadcalendar-cli-067aaaaf0fe5e732f42c56714a4e9e83349d5364.zip
Merge pull request #42 from ymitsos/master
Ommit METHOD property if included in request
-rwxr-xr-xcalendar-cli.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/calendar-cli.py b/calendar-cli.py
index ec5784f..d3c444f 100755
--- a/calendar-cli.py
+++ b/calendar-cli.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python2
"""
calendar-cli.py - high-level cli against caldav servers
@@ -140,6 +140,9 @@ def _calendar_addics(caldav_conn, ics, uid, args):
return
c = find_calendar(caldav_conn, args)
+ if re.search(r'^METHOD:[A-Z]+[\r\n]+',ics,flags=re.MULTILINE) and args.ignoremethod:
+ ics = re.sub(r'^METHOD:[A-Z]+[\r\n]+', '', ics, flags=re.MULTILINE)
+ print ("METHOD property found and ignored")
c.add_event(ics)
def calendar_addics(caldav_conn, args):
@@ -749,6 +752,7 @@ def main():
parser.add_argument("--ssl-verify-cert", help="verification of the SSL cert - 'yes' to use the OS-provided CA-bundle, 'no' to trust any cert and the path to a CA-bundle")
parser.add_argument("--debug-logging", help="turn on debug logging", action="store_true")
parser.add_argument("--calendar-url", help="URL for calendar to be used (may be absolute or relative to caldav URL, or just the name of the calendar)")
+ parser.add_argument("--ignoremethod", help="Ignores METHOD property if exists in the request. This violates RFC4791 but is sometimes appended by some calendar servers", action="store_true")
## TODO: check sys.argv[0] to find command
## TODO: set up logging