Skip to content
Snippets Groups Projects
Commit 50505662 authored by Jan Čermák's avatar Jan Čermák
Browse files

updated deprecated ConfigDict's API usage - closes #3536

parent 924489ab
Branches
Tags
No related merge requests found
......@@ -296,13 +296,13 @@ def prepare_main_app(args):
app.mount("/uci", uci.app)
if args.noauth:
logger.warning("authentication disabled")
app.config.no_auth = True
app.config["no_auth"] = True
# set custom app attributes for main app and all mounted apps
init_foris_app(app)
for route in app.routes:
if route.config.get("mountpoint"):
mounted = route.config['mountpoint']['target']
mounted = route.config['mountpoint.target']
init_foris_app(mounted)
# read language saved in Uci
......
......@@ -31,7 +31,7 @@ def is_user_authenticated():
def redirect_unauthenticated(redirect_url=None):
redirect_url = redirect_url or "/"
no_auth = bottle.default_app().config.no_auth
no_auth = bottle.default_app().config.get("no_auth", False)
if not no_auth and not is_user_authenticated():
# "raise" bottle redirect
bottle.redirect("%s?next=%s" % (redirect_url, bottle.request.fullpath))
......
......@@ -26,10 +26,10 @@ def reverse(name, **kargs):
except bottle.RouteBuildError:
for route in bottle.app().routes:
if route.config.get("mountpoint"):
mountpoint = route.config['mountpoint']
config = route.config
try:
return "%s%s" % (mountpoint['prefix'].rstrip("/"),
mountpoint['target'].router.build(name, **kargs))
return "%s%s" % (config['mountpoint.prefix'].rstrip("/"),
config['mountpoint.target'].router.build(name, **kargs))
except bottle.RouteBuildError as e:
if str(e).startswith("Missing URL"):
raise e
......
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