Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[py3] Replaced raw_input by input

The six addition has been borrowed from:
https://bitbucket.org/gutworth/six/changeset/733ef740
  • Loading branch information...
commit b8e49d70f2bbbb9008dbbf9d8b0dee46dcf25fa6 1 parent b1517a3
@claudep claudep authored
View
5 django/contrib/auth/management/__init__.py
@@ -9,6 +9,7 @@
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)
View
5 django/contrib/auth/management/commands/createsuperuser.py
@@ -12,6 +12,7 @@
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 @@ def handle(self, *args, **options):
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 @@ def handle(self, *args, **options):
# 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:
View
3  django/contrib/contenttypes/management.py
@@ -2,6 +2,7 @@
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
View
3  django/contrib/staticfiles/management/commands/collectstatic.py
@@ -8,6 +8,7 @@
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 @@ def handle_noargs(self, **options):
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
View
3  django/core/management/commands/flush.py
@@ -7,6 +7,7 @@
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 @@ def handle_noargs(self, **options):
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?
View
3  django/db/backends/creation.py
@@ -3,6 +3,7 @@
from django.conf import settings
from django.db.utils import load_backend
+from django.utils.six.moves import input
# The prefix to put on the default database name when creating
# the test database.
@@ -330,7 +331,7 @@ def _create_test_db(self, verbosity, autoclobber):
sys.stderr.write(
"Got an error creating the test database: %s\n" % e)
if not autoclobber:
- confirm = raw_input(
+ confirm = input(
"Type 'yes' if you would like to try deleting the test "
"database '%s', or 'no' to cancel: " % test_database_name)
if autoclobber or confirm == 'yes':
View
5 django/db/backends/oracle/creation.py
@@ -1,6 +1,7 @@
import sys
import time
from django.db.backends.creation import BaseDatabaseCreation
+from django.utils.six.moves import input
TEST_DATABASE_PREFIX = 'test_'
PASSWORD = 'Im_a_lumberjack'
@@ -65,7 +66,7 @@ def _create_test_db(self, verbosity=1, autoclobber=False):
except Exception as e:
sys.stderr.write("Got an error creating the test database: %s\n" % e)
if not autoclobber:
- confirm = raw_input("It appears the test database, %s, already exists. Type 'yes' to delete it, or 'no' to cancel: " % TEST_NAME)
+ confirm = input("It appears the test database, %s, already exists. Type 'yes' to delete it, or 'no' to cancel: " % TEST_NAME)
if autoclobber or confirm == 'yes':
try:
if verbosity >= 1:
@@ -87,7 +88,7 @@ def _create_test_db(self, verbosity=1, autoclobber=False):
except Exception as e:
sys.stderr.write("Got an error creating the test user: %s\n" % e)
if not autoclobber:
- confirm = raw_input("It appears the test user, %s, already exists. Type 'yes' to delete it, or 'no' to cancel: " % TEST_USER)
+ confirm = input("It appears the test user, %s, already exists. Type 'yes' to delete it, or 'no' to cancel: " % TEST_USER)
if autoclobber or confirm == 'yes':
try:
if verbosity >= 1:
View
3  django/db/backends/sqlite3/creation.py
@@ -1,6 +1,7 @@
import os
import sys
from django.db.backends.creation import BaseDatabaseCreation
+from django.utils.six.moves import input
class DatabaseCreation(BaseDatabaseCreation):
# SQLite doesn't actually support most of these types, but it "does the right
@@ -53,7 +54,7 @@ def _create_test_db(self, verbosity, autoclobber):
print("Destroying old test database '%s'..." % self.connection.alias)
if os.access(test_database_name, os.F_OK):
if not autoclobber:
- confirm = raw_input("Type 'yes' if you would like to try deleting the test database '%s', or 'no' to cancel: " % test_database_name)
+ confirm = input("Type 'yes' if you would like to try deleting the test database '%s', or 'no' to cancel: " % test_database_name)
if autoclobber or confirm == 'yes':
try:
os.remove(test_database_name)
View
1  django/utils/six.py
@@ -113,6 +113,7 @@ class _MovedItems(types.ModuleType):
_moved_attributes = [
MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"),
MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"),
+ MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"),
MovedAttribute("map", "itertools", "builtins", "imap", "map"),
MovedAttribute("reload_module", "__builtin__", "imp", "reload"),
MovedAttribute("reduce", "__builtin__", "functools"),
Please sign in to comment.
Something went wrong with that request. Please try again.