Skip to content
Snippets Groups Projects
Commit f9f059d9 authored by Julian Rother's avatar Julian Rother
Browse files

Correct time zone in ro-importer

parent 8767a8cf
Branches
No related tags found
No related merge requests found
......@@ -41,9 +41,10 @@ Notwendig:
* git (zum Anzeigen der aktuellen Version)
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-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-coverage (Für Coverage Tests benötigt)
......
......@@ -132,6 +132,8 @@ def fetch_ro_course_ical(id):
def fetch_ro_course_events(item):
import icalendar
import pytz
localtz = pytz.timezone('Europe/Berlin')
# First fix crappy javascript fragment-Paths
url = urllib.parse.urlparse(item['url'].replace('#/', ''))
args = urllib.parse.parse_qs(url.query)
......@@ -150,7 +152,7 @@ def fetch_ro_course_events(item):
continue
e = {}
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['title'] = item['type']
events.append(e)
......@@ -171,7 +173,7 @@ def import_from(id):
else:
events += fetch_ro_course_events(i)
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
newevents = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment