1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

[py3] Replaced unicode/str by six.text_type/bytes.

This commit is contained in:
Aymeric Augustin
2012-07-20 14:48:51 +02:00
parent 3cb2457f46
commit bdca5ea345
96 changed files with 376 additions and 294 deletions

View File

@@ -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.")

View File

@@ -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.

View File

@@ -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]