Skip to content

Commit 92d6d44

Browse files
author
Alejandro Casanovas
authored
Merge pull request googleapis#196 from FrostmourneHungers/patch-1
Correcting CalendarColors names
2 parents 0893020 + bb2dda0 commit 92d6d44

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

O365/calendar.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,18 @@ class EventShowAs(Enum):
5050

5151

5252
class CalendarColors(Enum):
53-
LightBlue = 0
54-
LightGreen = 1
55-
LightOrange = 2
56-
LightGray = 3
57-
LightYellow = 4
58-
LightTeal = 5
59-
LightPink = 6
60-
LightBrown = 7
61-
LightRed = 8
62-
MaxColor = 9
63-
Auto = -1
53+
LightBlue = 'lightBlue'
54+
LightGreen = 'lightGreen'
55+
LightOrange = 'lightOrange'
56+
LightGray = 'lightGray'
57+
LightYellow = 'lightYellow'
58+
LightTeal = 'lightTeal'
59+
LightPink = 'lightPink'
60+
LightBrown = 'lightBrown'
61+
LightRed = 'lightRed'
62+
MaxColor = 'maxColor'
63+
Auto = 'auto'
64+
6465

6566

6667
class EventType(Enum):
@@ -1494,11 +1495,11 @@ def __init__(self, *, parent=None, con=None, **kwargs):
14941495
self.calendar_id = cloud_data.get(self._cc('id'), None)
14951496
self.__owner = self._recipient_from_cloud(
14961497
cloud_data.get(self._cc('owner'), {}), field='owner')
1497-
color = cloud_data.get(self._cc('color'), -1)
1498-
if isinstance(color, str):
1499-
color = -1 if color == 'auto' else color
1500-
# TODO: other string colors?
1501-
self.color = CalendarColors(color)
1498+
color = cloud_data.get(self._cc('color'), 'auto')
1499+
try:
1500+
self.color = CalendarColors(color)
1501+
except:
1502+
self.color = CalendarColors('auto')
15021503
self.can_edit = cloud_data.get(self._cc('canEdit'), False)
15031504
self.can_share = cloud_data.get(self._cc('canShare'), False)
15041505
self.can_view_private_items = cloud_data.get(

0 commit comments

Comments
 (0)