mypy: Fix strict optional in zerver/views.

This commit is contained in:
umkay 2017-05-25 09:22:28 -07:00 committed by Tim Abbott
parent 55b4a3792d
commit 9ab0a8be6a
2 changed files with 3 additions and 2 deletions

View File

@ -85,7 +85,7 @@ def redirect_to_subdomain_login_url():
def login_or_register_remote_user(request, remote_username, user_profile, full_name='', def login_or_register_remote_user(request, remote_username, user_profile, full_name='',
invalid_subdomain=False, mobile_flow_otp=None, invalid_subdomain=False, mobile_flow_otp=None,
is_signup=False): is_signup=False):
# type: (HttpRequest, Optional[Text], Optional[UserProfile], Text, bool, Optional[str], bool) -> HttpResponse # type: (HttpRequest, Text, Optional[UserProfile], Text, bool, Optional[str], bool) -> HttpResponse
if invalid_subdomain: if invalid_subdomain:
# Show login page with an error message # Show login page with an error message
return redirect_to_subdomain_login_url() return redirect_to_subdomain_login_url()

View File

@ -81,7 +81,7 @@ def accounts_register(request):
# special URL with domain name so that REALM can be identified if multiple realms exist # special URL with domain name so that REALM can be identified if multiple realms exist
unique_open_realm = get_unique_open_realm() unique_open_realm = get_unique_open_realm()
if unique_open_realm is not None: if unique_open_realm is not None:
realm = unique_open_realm realm = unique_open_realm # type: Optional[Realm]
elif prereg_user.referred_by: elif prereg_user.referred_by:
# If someone invited you, you are joining their realm regardless # If someone invited you, you are joining their realm regardless
# of your e-mail address. # of your e-mail address.
@ -196,6 +196,7 @@ def accounts_register(request):
create_streams_with_welcome_messages(realm, stream_info) create_streams_with_welcome_messages(realm, stream_info)
set_default_streams(realm, stream_info) set_default_streams(realm, stream_info)
assert(realm is not None)
full_name = form.cleaned_data['full_name'] full_name = form.cleaned_data['full_name']
short_name = email_to_username(email) short_name = email_to_username(email)