misc: always declare lingo_url if lingo is deployed (#86405)
gitea/hobo/pipeline/head This commit looks good
Details
gitea/hobo/pipeline/head This commit looks good
Details
This commit is contained in:
parent
2daa7b3170
commit
e6c0555f78
|
@ -152,6 +152,10 @@ class TemplateVars(FileBaseSettingsLoader):
|
|||
variables['idp_account_url'] = service.get('base_url') + 'accounts/'
|
||||
variables['idp_registration_url'] = service.get('base_url') + 'register/'
|
||||
|
||||
if service.get('service-id') == 'lingo' and not service.get('secondary'):
|
||||
# always add a trailing /
|
||||
variables['lingo_url'] = urllib.parse.urljoin(service.get('base_url'), '/')
|
||||
|
||||
if not service.get('this'):
|
||||
continue
|
||||
|
||||
|
|
|
@ -85,6 +85,13 @@ def make_tenant(tmp_path, transactional_db, settings, request):
|
|||
'template_name': '...portal-user...',
|
||||
'base_url': 'http://portal-user.example.net',
|
||||
},
|
||||
{
|
||||
'slug': 'payment',
|
||||
'title': 'Lingo',
|
||||
'service-id': 'lingo',
|
||||
'secret_key': '123456',
|
||||
'base_url': 'https://payment.example.net',
|
||||
},
|
||||
],
|
||||
},
|
||||
fd,
|
||||
|
|
|
@ -88,6 +88,7 @@ def test_tenant_template_vars(tenants, settings, client):
|
|||
assert (
|
||||
django.conf.settings.TEMPLATE_VARS['portal_user_url'] == 'http://portal-user.example.net'
|
||||
)
|
||||
assert django.conf.settings.TEMPLATE_VARS['lingo_url'] == 'https://payment.example.net/'
|
||||
|
||||
# check it's no longer defined after going back to the public schema
|
||||
with pytest.raises(AttributeError):
|
||||
|
|
Loading…
Reference in New Issue