icalcli 1.1.4__tar.gz → 1.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {icalcli-1.1.4 → icalcli-1.1.6}/PKG-INFO +1 -1
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/__init__.py +1 -1
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/etesync_backend/etebase_interface.py +14 -2
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/etesync_backend/etesync_interface.py +14 -4
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli.egg-info/PKG-INFO +1 -1
- {icalcli-1.1.4 → icalcli-1.1.6}/pyproject.toml +1 -1
- {icalcli-1.1.4 → icalcli-1.1.6}/LICENSE +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/README.md +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/argparsers.py +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/etesync_backend/__init__.py +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/etesync_backend/etebase_crud.py +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/etesync_backend/etesync_crud.py +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/file_backend/__init__.py +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/file_backend/ics_interface.py +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/icalcli.py +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/printer.py +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli/utils.py +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli.egg-info/SOURCES.txt +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli.egg-info/dependency_links.txt +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli.egg-info/entry_points.txt +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli.egg-info/requires.txt +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/icalcli.egg-info/top_level.txt +0 -0
- {icalcli-1.1.4 → icalcli-1.1.6}/setup.cfg +0 -0
|
@@ -33,6 +33,18 @@ from icalendar import Calendar
|
|
|
33
33
|
# No exception handling is done. That is left to the calling program.
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
def decode_if_bytes(string_or_bytes):
|
|
37
|
+
# Version 7 of iCalendar made a breaking change
|
|
38
|
+
# The return type of text properties was changed from bytes to string
|
|
39
|
+
# To work with both old and new versions of iCalendar and to guard
|
|
40
|
+
# against any future change in the return value of calendar.to_ical()
|
|
41
|
+
# which still returns bytes, we apply decode only after confirming that
|
|
42
|
+
# the value is bytes
|
|
43
|
+
if isinstance(string_or_bytes, bytes):
|
|
44
|
+
return string_or_bytes.decode()
|
|
45
|
+
return string_or_bytes
|
|
46
|
+
|
|
47
|
+
|
|
36
48
|
class EtebaseInterface (EtebaseCRUD):
|
|
37
49
|
def __init__(self, user, server_url, password, calendar_uid,
|
|
38
50
|
cache_file=None, silent=True):
|
|
@@ -63,7 +75,7 @@ class EtebaseInterface (EtebaseCRUD):
|
|
|
63
75
|
event : event to be added (iCalendar object)
|
|
64
76
|
"""
|
|
65
77
|
ics = self.event_to_ics(event, vtimezone)
|
|
66
|
-
uid = event.decoded('uid')
|
|
78
|
+
uid = decode_if_bytes(event.decoded('uid'))
|
|
67
79
|
EtebaseCRUD.create_event(self, ics, uid)
|
|
68
80
|
|
|
69
81
|
def update_event(self, event, vtimezone=None):
|
|
@@ -73,7 +85,7 @@ class EtebaseInterface (EtebaseCRUD):
|
|
|
73
85
|
----------
|
|
74
86
|
event : event to be added (iCalendar object)
|
|
75
87
|
"""
|
|
76
|
-
uid = event.decoded('uid')
|
|
88
|
+
uid = decode_if_bytes(event.decoded('uid'))
|
|
77
89
|
ics = self.event_to_ics(event, vtimezone)
|
|
78
90
|
EtebaseCRUD.update_event(self, ics, uid)
|
|
79
91
|
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
from icalcli.etesync_backend.etesync_crud import EtesyncCRUD
|
|
7
7
|
from icalendar import Calendar
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
# The EtesyncInterface class is basically a wrapper around the
|
|
11
10
|
# EtesyncCRUD class from which it is derived
|
|
12
11
|
# The CRUD operations (Create, Retrieve, Update and Delete)
|
|
@@ -37,6 +36,18 @@ from icalendar import Calendar
|
|
|
37
36
|
# No exception handling is done. That is left to the calling program.
|
|
38
37
|
|
|
39
38
|
|
|
39
|
+
def decode_if_bytes(string_or_bytes):
|
|
40
|
+
# Version 7 of iCalendar made a breaking change
|
|
41
|
+
# The return type of text properties was changed from bytes to string
|
|
42
|
+
# To work with both old and new versions of iCalendar and to guard
|
|
43
|
+
# against any future change in the return value of calendar.to_ical()
|
|
44
|
+
# which still returns bytes, we apply decode only after confirming that
|
|
45
|
+
# the value is bytes
|
|
46
|
+
if isinstance(string_or_bytes, bytes):
|
|
47
|
+
return string_or_bytes.decode()
|
|
48
|
+
return string_or_bytes
|
|
49
|
+
|
|
50
|
+
|
|
40
51
|
class EtesyncInterface (EtesyncCRUD):
|
|
41
52
|
def __init__(self, email, userPassword, remoteUrl, uid, authToken,
|
|
42
53
|
cipher_key=None, silent=True):
|
|
@@ -76,7 +87,7 @@ class EtesyncInterface (EtesyncCRUD):
|
|
|
76
87
|
----------
|
|
77
88
|
event : event to be added (iCalendar object)
|
|
78
89
|
"""
|
|
79
|
-
uid = event.decoded('uid')
|
|
90
|
+
uid = decode_if_bytes(event.decoded('uid'))
|
|
80
91
|
ics = self.event_to_ics(event, vtimezone)
|
|
81
92
|
EtesyncCRUD.update_event(self, ics, uid)
|
|
82
93
|
|
|
@@ -91,7 +102,7 @@ class EtesyncInterface (EtesyncCRUD):
|
|
|
91
102
|
cal.add_component(event)
|
|
92
103
|
if vtimezone:
|
|
93
104
|
cal.add_component(vtimezone)
|
|
94
|
-
ics = cal.to_ical()
|
|
105
|
+
ics = decode_if_bytes(cal.to_ical())
|
|
95
106
|
return ics
|
|
96
107
|
|
|
97
108
|
def sync(self, vtimezone=None):
|
|
@@ -99,4 +110,3 @@ class EtesyncInterface (EtesyncCRUD):
|
|
|
99
110
|
"""
|
|
100
111
|
EtesyncCRUD.sync(self)
|
|
101
112
|
self.all_events()
|
|
102
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|