From f108157a8ae2098df93367246b688672988a3b12 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 18 Jun 2019 18:29:49 +0200 Subject: [PATCH] Fixed inconsistencies/warnings in calendar plugins --- platypush/plugins/calendar/__init__.py | 5 ++++- platypush/plugins/calendar/ical.py | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/platypush/plugins/calendar/__init__.py b/platypush/plugins/calendar/__init__.py index a5e9f4cf..d47e1dac 100644 --- a/platypush/plugins/calendar/__init__.py +++ b/platypush/plugins/calendar/__init__.py @@ -27,7 +27,7 @@ class CalendarPlugin(Plugin, CalendarInterface): * **dateutil** (``pip install python-dateutil``) """ - def __init__(self, calendars=[], *args, **kwargs): + def __init__(self, calendars=None, *args, **kwargs): """ :param calendars: List of calendars to be queried. Supported types so far: Google Calendar and iCal URLs. :type calendars: list @@ -49,6 +49,9 @@ class CalendarPlugin(Plugin, CalendarInterface): """ super().__init__(*args, **kwargs) + + if calendars is None: + calendars = [] self.calendars = [] for calendar in calendars: diff --git a/platypush/plugins/calendar/ical.py b/platypush/plugins/calendar/ical.py index 878324a1..459fb7b7 100644 --- a/platypush/plugins/calendar/ical.py +++ b/platypush/plugins/calendar/ical.py @@ -5,15 +5,14 @@ import datetime import dateutil.parser import requests -import pytz -from icalendar import Calendar, Event +from icalendar import Calendar from platypush.plugins import Plugin, action from platypush.plugins.calendar import CalendarInterface -class IcalCalendarPlugin(Plugin, CalendarInterface): +class CalendarIcalPlugin(Plugin, CalendarInterface): """ iCal calendars plugin. Interact with remote calendars in iCal format. @@ -68,6 +67,8 @@ class IcalCalendarPlugin(Plugin, CalendarInterface): :func:`~platypush.plugins.calendar.CalendarPlugin.get_upcoming_events`. """ + import pytz + events = [] try: response = requests.get(self.url)