Fixed #12849 -- Corrected the way strings are encoded for display by the colorizer so that they work with unicode. Thanks to jype for the report, and frasern for his work on the issue.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2010-03-18 13:24:11 +00:00
parent 7471dab660
commit be8a1f612d
2 changed files with 23 additions and 23 deletions

View File

@ -11,6 +11,7 @@ from optparse import make_option, OptionParser
import django
from django.core.exceptions import ImproperlyConfigured
from django.core.management.color import color_style
from django.utils.encoding import smart_str
try:
set
@ -214,7 +215,7 @@ class BaseCommand(object):
except ImportError, e:
# If settings should be available, but aren't,
# raise the error and quit.
sys.stderr.write(self.style.ERROR(str('Error: %s\n' % e)))
sys.stderr.write(smart_str(self.style.ERROR('Error: %s\n' % e)))
sys.exit(1)
try:
if self.requires_model_validation:
@ -230,7 +231,7 @@ class BaseCommand(object):
if self.output_transaction:
print self.style.SQL_KEYWORD("COMMIT;")
except CommandError, e:
sys.stderr.write(self.style.ERROR(str('Error: %s\n' % e)))
sys.stderr.write(smart_str(self.style.ERROR('Error: %s\n' % e)))
sys.exit(1)
def validate(self, app=None, display_num_errors=False):

View File

@ -38,7 +38,6 @@ def colorize(text='', opts=(), **kwargs):
print colorize('and so should this')
print 'this should not be red'
"""
text = str(text)
code_list = []
if text == '' and len(opts) == 1 and opts[0] == 'reset':
return '\x1b[%sm' % RESET