fix: prefer wuttaweb config for "home redirect to login" feature
This commit is contained in:
parent
1def26a35b
commit
b6a8e508bf
|
@ -25,6 +25,7 @@ Various common views
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import warnings
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from rattail.batch import consume_batch_id
|
from rattail.batch import consume_batch_id
|
||||||
|
@ -50,9 +51,21 @@ class CommonView(View):
|
||||||
Home page view.
|
Home page view.
|
||||||
"""
|
"""
|
||||||
app = self.get_rattail_app()
|
app = self.get_rattail_app()
|
||||||
|
|
||||||
|
# maybe auto-redirect anons to login
|
||||||
if not self.request.user:
|
if not self.request.user:
|
||||||
if self.rattail_config.getbool('tailbone', 'login_is_home', default=True):
|
redirect = self.config.get_bool('wuttaweb.home_redirect_to_login')
|
||||||
raise self.redirect(self.request.route_url('login'))
|
if redirect is None:
|
||||||
|
redirect = self.config.get_bool('tailbone.login_is_home')
|
||||||
|
if redirect is not None:
|
||||||
|
warnings.warn("tailbone.login_is_home setting is deprecated; "
|
||||||
|
"please set wuttaweb.home_redirect_to_login instead",
|
||||||
|
DeprecationWarning)
|
||||||
|
else:
|
||||||
|
# TODO: this is opposite of upstream default, should change
|
||||||
|
redirect = True
|
||||||
|
if redirect:
|
||||||
|
return self.redirect(self.request.route_url('login'))
|
||||||
|
|
||||||
image_url = self.rattail_config.get(
|
image_url = self.rattail_config.get(
|
||||||
'tailbone', 'main_image_url',
|
'tailbone', 'main_image_url',
|
||||||
|
|
Loading…
Reference in a new issue