forms.HomepageForm: Rename subdomain to string_id.

No change to behavior.
This commit is contained in:
Rishi Gupta
2016-11-07 16:07:44 -08:00
committed by Tim Abbott
parent 38f1ab325c
commit b114690bd5
2 changed files with 10 additions and 10 deletions

View File

@@ -108,9 +108,9 @@ class HomepageForm(forms.Form):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
# type: (*Any, **Any) -> None # type: (*Any, **Any) -> None
self.subdomain = kwargs.get("subdomain") self.string_id = kwargs.get("string_id")
if "subdomain" in kwargs: if "string_id" in kwargs:
del kwargs["subdomain"] del kwargs["string_id"]
super(HomepageForm, self).__init__(*args, **kwargs) super(HomepageForm, self).__init__(*args, **kwargs)
def clean_email(self): def clean_email(self):
@@ -124,8 +124,8 @@ class HomepageForm(forms.Form):
# Otherwise, the user is trying to join a specific realm. # Otherwise, the user is trying to join a specific realm.
realm = None realm = None
if self.subdomain: if self.string_id:
realm = get_realm_by_string_id(self.subdomain) realm = get_realm_by_string_id(self.string_id)
elif not settings.REALMS_HAVE_SUBDOMAINS: elif not settings.REALMS_HAVE_SUBDOMAINS:
realm = get_realm(resolve_email_to_domain(email)) realm = get_realm(resolve_email_to_domain(email))

View File

@@ -319,19 +319,19 @@ 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
if settings.REALMS_HAVE_SUBDOMAINS: if settings.REALMS_HAVE_SUBDOMAINS:
subdomain = get_subdomain(request) string_id = get_subdomain(request)
else: else:
realm = get_realm(request.session.get("domain")) realm = get_realm(request.session.get("domain"))
if realm is not None: if realm is not None:
subdomain = realm.string_id string_id = realm.string_id
else: else:
subdomain = '' string_id = ''
if user_info: if user_info:
return HomepageForm(user_info, subdomain = subdomain) return HomepageForm(user_info, string_id = string_id)
# 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(subdomain = subdomain) return HomepageForm(string_id = string_id)
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