Commit f9f059d9 authored by Julian Rother's avatar Julian Rother
Browse files

Correct time zone in ro-importer

parent 8767a8cf
...@@ -41,9 +41,10 @@ Notwendig: ...@@ -41,9 +41,10 @@ Notwendig:
* git (zum Anzeigen der aktuellen Version) * git (zum Anzeigen der aktuellen Version)
Optional (wird für einzelne Features benötigt): Optional (wird für einzelne Features benötigt):
* python-lxml (Campus Import) * python-lxml (Campus- und RO-Import)
* python-pytz (RO-Import)
* python-ldap (Login mit Fachschaftsaccount) * python-ldap (Login mit Fachschaftsaccount)
* python-icalendar (SoGo-Kalenderimport für Sitzungsankündigungen) * python-icalendar (RO-Import, Kalenderimport für Sitzungsankündigungen)
* python-mysql-connector (wenn MySQL als Datenbank verwendet werden soll) * python-mysql-connector (wenn MySQL als Datenbank verwendet werden soll)
* python-coverage (Für Coverage Tests benötigt) * python-coverage (Für Coverage Tests benötigt)
......
...@@ -132,6 +132,8 @@ def fetch_ro_course_ical(id): ...@@ -132,6 +132,8 @@ def fetch_ro_course_ical(id):
def fetch_ro_course_events(item): def fetch_ro_course_events(item):
import icalendar import icalendar
import pytz
localtz = pytz.timezone('Europe/Berlin')
# First fix crappy javascript fragment-Paths # First fix crappy javascript fragment-Paths
url = urllib.parse.urlparse(item['url'].replace('#/', '')) url = urllib.parse.urlparse(item['url'].replace('#/', ''))
args = urllib.parse.parse_qs(url.query) args = urllib.parse.parse_qs(url.query)
...@@ -150,7 +152,7 @@ def fetch_ro_course_events(item): ...@@ -150,7 +152,7 @@ def fetch_ro_course_events(item):
continue continue
e = {} e = {}
e['place'] = str(comp.get('LOCATION', '')) e['place'] = str(comp.get('LOCATION', ''))
e['time'] = comp['DTSTART'].dt # TODO: tz e['time'] = comp['DTSTART'].dt.astimezone(localtz).replace(tzinfo=None)
e['duration'] = int((comp['DTEND'].dt - comp['DTSTART'].dt).seconds/60) e['duration'] = int((comp['DTEND'].dt - comp['DTSTART'].dt).seconds/60)
e['title'] = item['type'] e['title'] = item['type']
events.append(e) events.append(e)
...@@ -171,7 +173,7 @@ def import_from(id): ...@@ -171,7 +173,7 @@ def import_from(id):
else: else:
events += fetch_ro_course_events(i) events += fetch_ro_course_events(i)
except ImportError: except ImportError:
flash('python-lxml not found, campus import will not work.') flash('python-lxml or python-pytz not found, campus and ro import will not work!')
# events to add # events to add
newevents = [] newevents = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment