Merge "Allow region override for url_for"
This commit is contained in:
commit
9c08d883ea
@ -247,7 +247,7 @@ def get_url_for_service(service, region, endpoint_type):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def url_for(request, service_type, endpoint_type=None):
|
def url_for(request, service_type, endpoint_type=None, region=None):
|
||||||
endpoint_type = endpoint_type or getattr(settings,
|
endpoint_type = endpoint_type or getattr(settings,
|
||||||
'OPENSTACK_ENDPOINT_TYPE',
|
'OPENSTACK_ENDPOINT_TYPE',
|
||||||
'publicURL')
|
'publicURL')
|
||||||
@ -256,12 +256,14 @@ def url_for(request, service_type, endpoint_type=None):
|
|||||||
catalog = request.user.service_catalog
|
catalog = request.user.service_catalog
|
||||||
service = get_service_from_catalog(catalog, service_type)
|
service = get_service_from_catalog(catalog, service_type)
|
||||||
if service:
|
if service:
|
||||||
|
if not region:
|
||||||
|
region = request.user.services_region
|
||||||
url = get_url_for_service(service,
|
url = get_url_for_service(service,
|
||||||
request.user.services_region,
|
region,
|
||||||
endpoint_type)
|
endpoint_type)
|
||||||
if not url and fallback_endpoint_type:
|
if not url and fallback_endpoint_type:
|
||||||
url = get_url_for_service(service,
|
url = get_url_for_service(service,
|
||||||
request.user.services_region,
|
region,
|
||||||
fallback_endpoint_type)
|
fallback_endpoint_type)
|
||||||
if url:
|
if url:
|
||||||
return url
|
return url
|
||||||
|
Loading…
Reference in New Issue
Block a user