forked from platypush/platypush
Fixed inconsistencies/warnings in calendar plugins
This commit is contained in:
parent
df355fb954
commit
f108157a8a
2 changed files with 8 additions and 4 deletions
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue