Exemplo n.º 1
0
def get_realm_from_request(request):
    # type: (HttpRequest) -> Optional[Realm]
    if hasattr(request, "user") and hasattr(request.user, "realm"):
        return request.user.realm
    elif settings.REALMS_HAVE_SUBDOMAINS:
        subdomain = get_subdomain(request)
        return get_realm(subdomain)
    # This will return None if there is no unique, open realm.
    return get_unique_non_system_realm()
Exemplo n.º 2
0
def get_realm_from_request(request):
    # type: (HttpRequest) -> Optional[Realm]
    if hasattr(request, "user") and hasattr(request.user, "realm"):
        return request.user.realm
    elif settings.REALMS_HAVE_SUBDOMAINS:
        subdomain = get_subdomain(request)
        return get_realm(subdomain)
    # This will return None if there is no unique, open realm.
    return get_unique_non_system_realm()