Commit b8e49d70 authored by Claude Paroz's avatar Claude Paroz
Browse files

[py3] Replaced raw_input by input

The six addition has been borrowed from:
https://bitbucket.org/gutworth/six/changeset/733ef740
parent b1517a31
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import unicodedata
from django.contrib.auth import models as auth_app
from django.db.models import get_models, signals
from django.contrib.auth.models import User
from django.utils.six.moves import input


def _get_permission_codename(action, opts):
@@ -66,10 +67,10 @@ def create_superuser(app, created_models, verbosity, db, **kwargs):
        msg = ("\nYou just installed Django's auth system, which means you "
            "don't have any superusers defined.\nWould you like to create one "
            "now? (yes/no): ")
        confirm = raw_input(msg)
        confirm = input(msg)
        while 1:
            if confirm not in ('yes', 'no'):
                confirm = raw_input('Please enter either "yes" or "no": ')
                confirm = input('Please enter either "yes" or "no": ')
                continue
            if confirm == 'yes':
                call_command("createsuperuser", interactive=True, database=db)
+3 −2
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ from django.contrib.auth.management import get_default_username
from django.core import exceptions
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS
from django.utils.six.moves import input
from django.utils.translation import ugettext as _

RE_VALID_USERNAME = re.compile('[\w.@+-]+$')
@@ -76,7 +77,7 @@ class Command(BaseCommand):
                        input_msg = 'Username'
                        if default_username:
                            input_msg += ' (leave blank to use %r)' % default_username
                        username = raw_input(input_msg + ': ')
                        username = input(input_msg + ': ')
                    if default_username and username == '':
                        username = default_username
                    if not RE_VALID_USERNAME.match(username):
@@ -94,7 +95,7 @@ class Command(BaseCommand):
                # Get an email
                while 1:
                    if not email:
                        email = raw_input('E-mail address: ')
                        email = input('E-mail address: ')
                    try:
                        is_valid_email(email)
                    except exceptions.ValidationError:
+2 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ from django.contrib.contenttypes.models import ContentType
from django.db.models import get_apps, get_models, signals
from django.utils.encoding import smart_text
from django.utils import six
from django.utils.six.moves import input

def update_contenttypes(app, created_models, verbosity=2, **kwargs):
    """
@@ -49,7 +50,7 @@ def update_contenttypes(app, created_models, verbosity=2, **kwargs):
                '    %s | %s' % (ct.app_label, ct.model)
                for ct in to_remove
            ])
            ok_to_delete = raw_input("""The following content types are stale and need to be deleted:
            ok_to_delete = input("""The following content types are stale and need to be deleted:

%s

+2 −1
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ from django.core.files.storage import FileSystemStorage
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.encoding import smart_text
from django.utils.datastructures import SortedDict
from django.utils.six.moves import input

from django.contrib.staticfiles import finders, storage

@@ -148,7 +149,7 @@ class Command(NoArgsCommand):
            clear_display = 'This will overwrite existing files!'

        if self.interactive:
            confirm = raw_input("""
            confirm = input("""
You have requested to collect static files at the destination
location as specified in your settings%s

+2 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ from django.core.management.base import NoArgsCommand, CommandError
from django.core.management.color import no_style
from django.core.management.sql import sql_flush, emit_post_sync_signal
from django.utils.importlib import import_module
from django.utils.six.moves import input


class Command(NoArgsCommand):
@@ -45,7 +46,7 @@ class Command(NoArgsCommand):
        sql_list = sql_flush(self.style, connection, only_django=True, reset_sequences=reset_sequences)

        if interactive:
            confirm = raw_input("""You have requested a flush of the database.
            confirm = input("""You have requested a flush of the database.
This will IRREVERSIBLY DESTROY all data currently in the %r database,
and return each table to the state it was in after syncdb.
Are you sure you want to do this?
Loading