def get_default_domain(request, get_name=True):
 domain_id = request.session.get('domain_context', None)
 domain_name = request.session.get('domain_context_name', None)
 if ((VERSIONS.active >= 3) and (domain_id is None)):
  domain_id = request.user.user_domain_id
  domain_name = request.user.user_domain_name
  if (get_name and (not request.user.is_federated)):
   try:
    domain = domain_get(request, domain_id)
    domain_name = domain.name
   except exceptions.NotAuthorized:
    LOG.debug(('Cannot retrieve domain information for user (%s) that does not have an admin role on project (%s)' % (request.user.username, request.user.project_name)))
   except Exception:
    LOG.warning(('Unable to retrieve Domain: %s' % domain_id))
 domain = base.APIDictWrapper({'id': domain_id, 'name': domain_name})
 return domain

def get_default_domain ( request , get_name = True ) : domain_id = request . session . get ( 'domain_context' , None ) domain_name = request . session . get ( 'domain_context_name' , None ) if ( ( VERSIONS . active >= 3 ) and ( domain_id is None ) ) : domain_id = request . user . user_domain_id domain_name = request . user . user_domain_name if ( get_name and ( not request . user . is_federated ) ) : try : domain = domain_get ( request , domain_id ) domain_name = domain . name except exceptions . NotAuthorized : LOG . debug ( ( 'Cannot retrieve domain information for user (%s) that does not have an admin role on project (%s)' % ( request . user . username , request . user . project_name ) ) ) except Exception : LOG . warning ( ( 'Unable to retrieve Domain: %s' % domain_id ) ) domain = base . APIDictWrapper ( { 'id' : domain_id , 'name' : domain_name } ) return domain
gets the default domain object to use when creating identity object .