def token_create_scoped(request, tenant, token):
 if hasattr(request, '_keystone'):
  del request._keystone
 c = keystoneclient(request)
 raw_token = c.tokens.authenticate(tenant_id=tenant, token=token, return_raw=True)
 c.service_catalog = service_catalog.ServiceCatalog(raw_token)
 if request.user.is_superuser:
  c.management_url = c.service_catalog.url_for(service_type='identity', endpoint_type='adminURL')
 else:
  endpoint_type = getattr(settings, 'OPENSTACK_ENDPOINT_TYPE', 'internalURL')
  c.management_url = c.service_catalog.url_for(service_type='identity', endpoint_type=endpoint_type)
 scoped_token = tokens.Token(tokens.TokenManager, raw_token)
 return scoped_token

def token_create_scoped ( request , tenant , token ) : if hasattr ( request , '_keystone' ) : del request . _keystone c = keystoneclient ( request ) raw_token = c . tokens . authenticate ( tenant_id = tenant , token = token , return_raw = True ) c . service_catalog = service_catalog . ServiceCatalog ( raw_token ) if request . user . is_superuser : c . management_url = c . service_catalog . url_for ( service_type = 'identity' , endpoint_type = 'adminURL' ) else : endpoint_type = getattr ( settings , 'OPENSTACK_ENDPOINT_TYPE' , 'internalURL' ) c . management_url = c . service_catalog . url_for ( service_type = 'identity' , endpoint_type = endpoint_type ) scoped_token = tokens . Token ( tokens . TokenManager , raw_token ) return scoped_token
creates a scoped token using the tenant id and unscoped token; retrieves the service catalog for the given tenant .