From 17395206c241cb5dff3eedf62bb5c5aaf2ce52ee Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Mon, 2 May 2016 14:42:58 +0200 Subject: Revert "Use timezone in calendar script" This reverts commit 04f537fd010b95c2cd543bee9de64bba8271c01b. --- scripts/get_calendar.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/get_calendar.py b/scripts/get_calendar.py index 20a8b6f..89daf07 100644 --- a/scripts/get_calendar.py +++ b/scripts/get_calendar.py @@ -11,9 +11,6 @@ import os from dateutil.rrule import rrulestr import icalendar import subprocess -import pytz - -berlin = pytz.timezone('Europe/Berlin') def fetch_calendar(logger): """Fetches the calendar events and returns a icalendar.Calendar instance. @@ -84,10 +81,6 @@ def get_events(calendar, after, before): if end.hour == 0 and end.minute == 0 and end.second == 0: end -= timedelta(seconds=1) - if start.tzinfo is None: - start = berlin.localize(start) - if end.tzinfo is None: - end = berlin.localize(end) if 'rrule' in event: rrule = rrulestr(event['rrule'].to_ical(), dtstart=start) duration = end - start @@ -138,15 +131,15 @@ if __name__ == '__main__': logging.basicConfig(stream=sys.stderr, level=logging.ERROR) logger = logging.getLogger('calendar_feed') regen, calendar = fetch_calendar(logger) - now = berlin.localize(datetime.now()) + now = datetime.now() after = now - relativedelta(days=1) before = now + relativedelta(months=+1) - after_tab = berlin.localize(datetime(now.year,now.month,1)) + after_tab = datetime(now.year,now.month,1); if now.month + 2 > 12: - before_tab = berlin.localize(datetime(now.year+1,now.month + 10,1)) + before_tab = datetime(now.year+1,now.month + 10,1) else: - before_tab = berlin.localize(datetime(now.year,now.month+2,1)) + before_tab = datetime(now.year,now.month+2,1) changed = put_events(calendar, after, before, os.path.join(base_path, '../template/calendar.json')) -- cgit v1.2.1