forms.HomepageForm: No longer take a domain argument.

domain was unused. No change to behavior.
This commit is contained in:
Rishi Gupta 2016-11-07 12:35:55 -08:00 committed by Tim Abbott
parent ff2fe0cf92
commit 38f1ab325c
2 changed files with 5 additions and 12 deletions

View File

@ -108,10 +108,7 @@ class HomepageForm(forms.Form):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
# type: (*Any, **Any) -> None # type: (*Any, **Any) -> None
self.domain = kwargs.get("domain")
self.subdomain = kwargs.get("subdomain") self.subdomain = kwargs.get("subdomain")
if "domain" in kwargs:
del kwargs["domain"]
if "subdomain" in kwargs: if "subdomain" in kwargs:
del kwargs["subdomain"] del kwargs["subdomain"]
super(HomepageForm, self).__init__(*args, **kwargs) super(HomepageForm, self).__init__(*args, **kwargs)

View File

@ -318,24 +318,20 @@ def accounts_accept_terms(request):
def create_homepage_form(request, user_info=None): def create_homepage_form(request, user_info=None):
# type: (HttpRequest, Optional[Dict[str, Any]]) -> HomepageForm # type: (HttpRequest, Optional[Dict[str, Any]]) -> HomepageForm
subdomain = u''
domain = u''
if settings.REALMS_HAVE_SUBDOMAINS: if settings.REALMS_HAVE_SUBDOMAINS:
subdomain = get_subdomain(request) subdomain = get_subdomain(request)
realm = get_realm_by_string_id(subdomain)
if realm is not None:
domain = realm.domain
else: else:
domain = request.session.get("domain") realm = get_realm(request.session.get("domain"))
realm = get_realm(domain)
if realm is not None: if realm is not None:
subdomain = realm.string_id subdomain = realm.string_id
else:
subdomain = ''
if user_info: if user_info:
return HomepageForm(user_info, domain=domain, subdomain=subdomain) return HomepageForm(user_info, subdomain = subdomain)
# An empty fields dict is not treated the same way as not # An empty fields dict is not treated the same way as not
# providing it. # providing it.
return HomepageForm(domain=domain, subdomain=subdomain) return HomepageForm(subdomain = subdomain)
def create_preregistration_user(email, request, realm_creation=False): def create_preregistration_user(email, request, realm_creation=False):
# type: (text_type, HttpRequest, bool) -> HttpResponse # type: (text_type, HttpRequest, bool) -> HttpResponse