Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
protokollsystem
proto3
Commits
7879d04d
Commit
7879d04d
authored
Mar 27, 2018
by
Robin Sonnabend
Browse files
Move back.py to common-web
parent
94007c20
Changes
6
Hide whitespace changes
Inline
Side-by-side
.gitmodules
View file @
7879d04d
[submodule "
auth
"]
[submodule "
common
"]
path = common
url = git@git.fsmpi.rwth-aachen.de:protokollsystem/common-web.git
back.py
deleted
100644 → 0
View file @
94007c20
# This snippet is in public domain.
# However, please retain this link in your sources:
# http://flask.pocoo.org/snippets/120/
# Danya Alexeyevsky
import
functools
from
flask
import
session
,
request
,
redirect
as
flask_redirect
,
url_for
import
config
cookie
=
getattr
(
config
,
"REDIRECT_BACK_COOKIE"
,
"back"
)
default_view
=
getattr
(
config
,
"REDIRECT_BACK_DEFAULT"
,
"index"
)
def
anchor
(
func
,
cookie
=
cookie
):
@
functools
.
wraps
(
func
)
def
result
(
*
args
,
**
kwargs
):
session
[
cookie
]
=
request
.
url
return
func
(
*
args
,
**
kwargs
)
return
result
def
default_url
(
default
,
**
url_args
):
return
url_for
(
default
,
**
url_args
)
def
url
(
default
=
default_view
,
cookie
=
cookie
,
**
url_args
):
return
session
.
get
(
cookie
,
default_url
(
default
,
**
url_args
))
def
redirect
(
default
=
default_view
,
cookie
=
cookie
,
**
url_args
):
print
(
request
.
url
,
request
.
url_rule
,
default
,
session
.
get
(
cookie
))
target
=
url
(
default
,
cookie
,
**
url_args
)
if
target
==
request
.
url
:
target
=
default_url
(
default
,
**
url_args
)
return
flask_redirect
(
target
)
common
@
3dfc2b71
Compare
f9dbd00f
...
3dfc2b71
Subproject commit
f9dbd00f0a1e413e000e42b968de0f6a0a44
558
f
Subproject commit
3dfc2b71eb6a7e0746fe8794854f739c330
558
7b
decorators.py
View file @
7879d04d
...
...
@@ -6,7 +6,7 @@ from hmac import compare_digest
from
models.database
import
ALL_MODELS
from
shared
import
current_user
from
utils
import
get_csrf_token
import
back
from
common
import
back
ID_KEY
=
"id"
KEY_NOT_PRESENT_MESSAGE
=
"Missing {}_id."
...
...
server.py
View file @
7879d04d
...
...
@@ -55,7 +55,7 @@ from views.tables import (
TodosTable
,
DocumentsTable
,
DecisionsTable
,
TodoTable
,
ErrorTable
,
TodoMailsTable
,
DefaultMetasTable
,
DecisionCategoriesTable
)
from
legacy
import
import_old_todos
,
import_old_protocols
,
import_old_todomails
import
back
from
common
import
back
app
=
Flask
(
__name__
)
app
.
config
.
from_object
(
config
)
...
...
shared.py
View file @
7879d04d
...
...
@@ -5,7 +5,7 @@ import re
from
functools
import
wraps
from
enum
import
Enum
import
back
from
common
import
back
import
config
...
...
Write
Preview
Supports
Markdown
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