summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-07-20 14:48:51 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-07-22 09:29:54 +0200
commitbdca5ea345c548a82a80d198906818c9ccbef896 (patch)
tree5c3f5fe5ad2522175d67b96a1fce1ff1763ba125 /django/core
parent3cb2457f46b3e40ff6b6acffcb3fd44cbea091e5 (diff)
[py3] Replaced unicode/str by six.text_type/bytes.
Diffstat (limited to 'django/core')
-rw-r--r--django/core/management/commands/inspectdb.py3
-rw-r--r--django/core/management/validation.py4
-rw-r--r--django/core/urlresolvers.py2
3 files changed, 5 insertions, 4 deletions
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
index a524e64f65..7c868e4b60 100644
--- a/django/core/management/commands/inspectdb.py
+++ b/django/core/management/commands/inspectdb.py
@@ -3,6 +3,7 @@ from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
+from django.utils import six
class Command(NoArgsCommand):
help = "Introspects the database tables in the given database and outputs a Django model module."
@@ -115,7 +116,7 @@ class Command(NoArgsCommand):
if att_name[0].isdigit():
att_name = 'number_%s' % att_name
- extra_params['db_column'] = unicode(column_name)
+ extra_params['db_column'] = six.text_type(column_name)
comment_notes.append("Field renamed because it wasn't a "
"valid Python identifier.")
diff --git a/django/core/management/validation.py b/django/core/management/validation.py
index 51eeae4e91..274f98ee79 100644
--- a/django/core/management/validation.py
+++ b/django/core/management/validation.py
@@ -120,7 +120,7 @@ def get_validation_errors(outfile, app=None):
e.add(opts, "'%s' has a relation with model %s, which has either not been installed or is abstract." % (f.name, f.rel.to))
# it is a string and we could not find the model it refers to
# so skip the next section
- if isinstance(f.rel.to, (str, unicode)):
+ if isinstance(f.rel.to, six.string_types):
continue
# Make sure the related field specified by a ForeignKey is unique
@@ -162,7 +162,7 @@ def get_validation_errors(outfile, app=None):
e.add(opts, "'%s' has an m2m relation with model %s, which has either not been installed or is abstract." % (f.name, f.rel.to))
# it is a string and we could not find the model it refers to
# so skip the next section
- if isinstance(f.rel.to, (str, unicode)):
+ if isinstance(f.rel.to, six.string_types):
continue
# Check that the field is not set to unique. ManyToManyFields do not support unique.
diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
index e88975f849..7397cf3b3d 100644
--- a/django/core/urlresolvers.py
+++ b/django/core/urlresolvers.py
@@ -169,7 +169,7 @@ class LocaleRegexProvider(object):
except re.error as e:
raise ImproperlyConfigured(
'"%s" is not a valid regular expression: %s' %
- (regex, unicode(e)))
+ (regex, six.text_type(e)))
self._regex_dict[language_code] = compiled_regex
return self._regex_dict[language_code]