Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Roman Karwacik
website
Commits
f9f059d9
Commit
f9f059d9
authored
Nov 11, 2018
by
Julian Rother
Browse files
Correct time zone in ro-importer
parent
8767a8cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
f9f059d9
...
...
@@ -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)
...
...
importer.py
View file @
f9f059d9
...
...
@@ -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
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment