Commit be8a1f61 authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

Fixed #12849 -- Corrected the way strings are encoded for display by the...

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
parent 7471dab6
Loading
Loading
Loading
Loading
+23 −22
Original line number Diff line number Diff line
@@ -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):
+0 −1
Original line number Diff line number Diff line
@@ -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