From b530c87d268dd0d7d9993db01c4f20a2269cc932 Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Thu, 20 Jun 2019 17:27:56 +0530 Subject: [PATCH] create_user: Try to read password file only when param specified. The argument parser has default empty values set for the options `--password` and `--password-file`, and this causes the script to try and read a password file even when the argument was not provided. --- zerver/management/commands/create_user.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zerver/management/commands/create_user.py b/zerver/management/commands/create_user.py index e01f7d237a..1b6a2dacce 100644 --- a/zerver/management/commands/create_user.py +++ b/zerver/management/commands/create_user.py @@ -1,4 +1,3 @@ - import argparse import sys from typing import Any @@ -77,10 +76,10 @@ parameters, or specify no parameters for interactive user creation.""") full_name = input("Full name: ") try: - if 'password' in options: - pw = options['password'] - if 'password_file' in options: + if options['password_file']: pw = open(options['password_file'], 'r').read() + elif options['password']: + pw = options['password'] else: user_initial_password = initial_password(email) if user_initial_password is None: