mypy: Update zerver directory to use Text

This commit is contained in:
Juan Verhook
2016-12-26 22:09:35 -08:00
committed by showell
parent 5639f21188
commit cfa9c2eaf2
9 changed files with 49 additions and 56 deletions

View File

@@ -22,8 +22,7 @@ import logging
import re
import DNS
from six import text_type
from typing import Any, Callable, Optional
from typing import Any, Callable, Optional, Text
MIT_VALIDATION_ERROR = u'That user does not exist at MIT or is a ' + \
u'<a href="https://ist.mit.edu/email-lists">mailing list</a>. ' + \
@@ -34,14 +33,14 @@ WRONG_SUBDOMAIN_ERROR = "Your Zulip account is not a member of the " + \
"Please contact %s with any questions!" % (settings.ZULIP_ADMINISTRATOR,)
def get_registration_string(domain):
# type: (text_type) -> text_type
# type: (Text) -> Text
register_url = reverse('register') + domain
register_account_string = _('The organization with the domain already exists. '
'Please register your account <a href=%(url)s>here</a>.') % {'url': register_url}
return register_account_string
def email_is_not_mit_mailing_list(email):
# type: (text_type) -> None
# type: (Text) -> None
"""Prevent MIT mailing lists from signing up for Zulip"""
if "@mit.edu" in email:
username = email.rsplit("@", 1)[0]
@@ -143,7 +142,7 @@ class HomepageForm(forms.Form):
return email
def email_is_not_disposable(email):
# type: (text_type) -> None
# type: (Text) -> None
if is_disposable_domain(email_to_domain(email)):
raise ValidationError(_("Please use your real email address."))