settings: remove option for custom backoffice base URL (#54212)
This commit is contained in:
parent
ceb49bd925
commit
c51c0f4c45
|
@ -167,7 +167,6 @@ def test_urls(pub):
|
|||
assert formdef.get_url() == 'http://example.net/foo/'
|
||||
assert formdef.get_url(backoffice=True) == 'http://example.net/backoffice/management/foo/'
|
||||
del pub.cfg['misc']['frontoffice-url']
|
||||
del pub.cfg['misc']['backoffice-url']
|
||||
assert formdef.get_url() == 'https://example.net/foo/'
|
||||
assert formdef.get_url(backoffice=True) == 'https://example.net/backoffice/management/foo/'
|
||||
|
||||
|
|
|
@ -127,7 +127,6 @@ def create_temporary_pub(sql_mode=False, templates_mode=False, lazy_mode=False):
|
|||
pub.cfg = {}
|
||||
pub.cfg['misc'] = {
|
||||
'charset': 'utf-8',
|
||||
'backoffice-url': 'http://example.net/backoffice',
|
||||
'frontoffice-url': 'http://example.net',
|
||||
}
|
||||
pub.cfg['language'] = {'language': 'en'}
|
||||
|
|
|
@ -1196,16 +1196,9 @@ class SettingsDirectory(QommonSettingsDirectory):
|
|||
StringWidget,
|
||||
'frontoffice-url',
|
||||
size=32,
|
||||
title=_('Frontoffice base URL'),
|
||||
title=_('Site base URL'),
|
||||
value=misc_cfg.get('frontoffice-url', ''),
|
||||
)
|
||||
form.add(
|
||||
StringWidget,
|
||||
'backoffice-url',
|
||||
size=32,
|
||||
title=_('Backoffice base URL'),
|
||||
value=misc_cfg.get('backoffice-url', ''),
|
||||
)
|
||||
form.add(
|
||||
StringWidget,
|
||||
'homepage-redirect-url',
|
||||
|
@ -1227,9 +1220,7 @@ class SettingsDirectory(QommonSettingsDirectory):
|
|||
r += form.render()
|
||||
return r.getvalue()
|
||||
else:
|
||||
cfg_submit(
|
||||
form, 'misc', ['sitename', 'frontoffice-url', 'backoffice-url', 'homepage-redirect-url']
|
||||
)
|
||||
cfg_submit(form, 'misc', ['sitename', 'frontoffice-url', 'homepage-redirect-url'])
|
||||
return redirect('.')
|
||||
|
||||
def sms(self):
|
||||
|
|
|
@ -131,17 +131,7 @@ class QommonPublisher(Publisher):
|
|||
return 'https://%s' % os.path.basename(get_publisher().app_dir)
|
||||
|
||||
def get_backoffice_url(self):
|
||||
backoffice_url = get_cfg('misc', {}).get('backoffice-url', None)
|
||||
if backoffice_url:
|
||||
return backoffice_url
|
||||
req = self.get_request()
|
||||
if req:
|
||||
return '%s://%s%s/backoffice' % (
|
||||
req.get_scheme(),
|
||||
req.get_server(),
|
||||
urllib.parse.quote(req.environ.get('SCRIPT_NAME')),
|
||||
)
|
||||
return 'https://%s/backoffice' % os.path.basename(self.app_dir)
|
||||
return urllib.parse.urljoin(self.get_frontoffice_url(), '/backoffice')
|
||||
|
||||
def get_global_eval_dict(self):
|
||||
from . import evalutils as utils
|
||||
|
|
Loading…
Reference in New Issue