Fixed inconsistencies/warnings in calendar plugins

This commit is contained in:
Fabio Manganiello 2019-06-18 18:29:49 +02:00
parent df355fb954
commit f108157a8a
2 changed files with 8 additions and 4 deletions

View file

@ -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:

View file

@ -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)