python: Reformat with Black, except quotes.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-02-11 23:19:30 -08:00
committed by Tim Abbott
parent 5028c081cb
commit 11741543da
817 changed files with 44952 additions and 24860 deletions

View File

@@ -13,11 +13,17 @@ class Command(ZulipBaseCommand):
help = "Generate activation links for users and print them to stdout."
def add_arguments(self, parser: ArgumentParser) -> None:
parser.add_argument('--force',
action="store_true",
help='Override that the domain is restricted to external users.')
parser.add_argument('emails', metavar='<email>', nargs='*',
help='email of users to generate an activation link for')
parser.add_argument(
'--force',
action="store_true",
help='Override that the domain is restricted to external users.',
)
parser.add_argument(
'emails',
metavar='<email>',
nargs='*',
help='email of users to generate an activation link for',
)
self.add_realm_args(parser, True)
def handle(self, *args: Any, **options: Any) -> None:
@@ -46,11 +52,12 @@ class Command(ZulipBaseCommand):
email_allowed_for_realm(email, realm)
except DomainNotAllowedForRealmError:
if not options["force"]:
raise CommandError("You've asked to add an external user '{}' to a "
"closed realm '{}'.\nAre you sure? To do this, "
"pass --force.".format(email, realm.string_id))
raise CommandError(
"You've asked to add an external user '{}' to a "
"closed realm '{}'.\nAre you sure? To do this, "
"pass --force.".format(email, realm.string_id)
)
prereg_user = PreregistrationUser(email=email, realm=realm)
prereg_user.save()
print(email + ": " + create_confirmation_link(prereg_user,
Confirmation.INVITATION))
print(email + ": " + create_confirmation_link(prereg_user, Confirmation.INVITATION))