-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
110 additions
and
106 deletions.
There are no files selected for viewing
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MSG_NOT_LOGGED_IN = "Du bist nicht eingeloggt!" | ||
MSG_SETTINGS_SAVED = "Die neuen Einstellungen wurden gespeichert." | ||
MSG_PASSWORDS_UNEQUAL = "Die eingegeben Passwörter stimmen nicht überein." | ||
MSG_OFM_PASSWORDS_UNEQUAL = "Die eingegeben OFM Passwörter stimmen nicht überein." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
from django.contrib import messages | ||
from django.shortcuts import redirect | ||
|
||
from core.localizations.messages import MSG_NOT_LOGGED_IN | ||
from core.managers.parser_manager import ParserManager | ||
from core.managers.site_manager import SiteManager | ||
|
||
|
||
def trigger_parsing(request): | ||
if request.user.is_authenticated(): | ||
site_manager = SiteManager(request.user) | ||
site_manager.login() | ||
|
||
pm = ParserManager() | ||
pm.parse_all_ofm_data(request, site_manager) | ||
|
||
remote_version = pm.parse_ofm_version(site_manager) | ||
try: | ||
with open('version', 'r') as version_file: | ||
own_version = version_file.read().replace('\n', '') | ||
if own_version != "null" and own_version != remote_version: | ||
messages.info(request, "Es ist eine neuere Version von OFM Helper verfügbar: %s. Du nutzt noch: %s." % ( | ||
remote_version, own_version)) | ||
except IOError: | ||
pass | ||
|
||
site_manager.kill() | ||
|
||
return redirect('core:ofm:player_statistics') | ||
else: | ||
messages.error(request, MSG_NOT_LOGGED_IN) | ||
return redirect('core:login') | ||
|
||
|
||
def trigger_single_parsing(request, parsing_function, redirect_to='core:account'): | ||
if request.user.is_authenticated(): | ||
site_manager = SiteManager(request.user) | ||
site_manager.login() | ||
parsing_function(request, site_manager) | ||
return redirect(redirect_to) | ||
else: | ||
messages.error(request, MSG_NOT_LOGGED_IN) | ||
return redirect('core:login') | ||
|
||
|
||
def trigger_matchday_parsing(request): | ||
pm = ParserManager() | ||
return trigger_single_parsing(request, pm.parse_matchday) | ||
|
||
|
||
def trigger_players_parsing(request): | ||
pm = ParserManager() | ||
redirect_to = 'core:ofm:player_statistics' | ||
return trigger_single_parsing(request, pm.parse_players, redirect_to) | ||
|
||
|
||
def trigger_player_statistics_parsing(request): | ||
pm = ParserManager() | ||
redirect_to = 'core:ofm:player_statistics' | ||
return trigger_single_parsing(request, pm.parse_player_statistics, redirect_to) | ||
|
||
|
||
def trigger_finances_parsing(request): | ||
pm = ParserManager() | ||
redirect_to = 'core:ofm:finance_overview' | ||
return trigger_single_parsing(request, pm.parse_finances, redirect_to) | ||
|
||
|
||
def trigger_match_parsing(request): | ||
pm = ParserManager() | ||
redirect_to = 'core:ofm:matches_overview' | ||
return trigger_single_parsing(request, pm.parse_all_matches, redirect_to) |
File renamed without changes.