subdomains: Simplify is_subdomain_root_or_alias.

This logic is equivalent, though it takes a couple of readings
to convince oneself of that.  This version should then be
easier to reason about.
This commit is contained in:
Greg Price 2017-10-19 20:10:32 -07:00 committed by Tim Abbott
parent 69e44a68fc
commit cc32634439

View File

@ -23,9 +23,7 @@ def get_subdomain(request):
def is_subdomain_root_or_alias(request):
# type: (HttpRequest) -> bool
subdomain = _extract_subdomain(request)
return (subdomain == Realm.SUBDOMAIN_FOR_ROOT_DOMAIN
or subdomain in settings.ROOT_SUBDOMAIN_ALIASES)
return get_subdomain(request) == Realm.SUBDOMAIN_FOR_ROOT_DOMAIN
def user_matches_subdomain(realm_subdomain, user_profile):
# type: (Optional[Text], UserProfile) -> bool