From b7b75d697d4818e5c03e9f5ef4ef105041f06178 Mon Sep 17 00:00:00 2001 From: Daniel Klaffenbach Date: Tue, 28 Nov 2017 10:34:04 +0100 Subject: [PATCH] ldap_createsuperuser: Use input() for asking username This should improve Python3 compatibility --- fountain/management/commands/ldap_createsuperuser.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fountain/management/commands/ldap_createsuperuser.py b/fountain/management/commands/ldap_createsuperuser.py index 8025d95..2f9d940 100644 --- a/fountain/management/commands/ldap_createsuperuser.py +++ b/fountain/management/commands/ldap_createsuperuser.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals import getpass -import sys from django.core.management.base import BaseCommand from django.contrib.auth import get_user_model @@ -23,8 +22,7 @@ class Command(BaseCommand): username = options.get('username') if not username: current_user = getpass.getuser() - sys.stdout.write('Username [%s]: ' %current_user) - input_user = sys.stdin.readline().strip() + input_user = input('Username [{}]: '.format(current_user)) if not input_user: username = current_user else: @@ -46,3 +44,4 @@ class Command(BaseCommand): else: obj.save() self.stdout.write("Granted %s privileges to user %s." % (privilege, username)) + -- GitLab