Kaydet (Commit) 67d7da5f authored tarafından areski's avatar areski Kaydeden (comit) Tim Graham

Fixed #23107 -- Made runserver output respect --no-color.

üst 7fcfefbc
...@@ -380,6 +380,7 @@ class BaseCommand(object): ...@@ -380,6 +380,7 @@ class BaseCommand(object):
if options.get('no_color'): if options.get('no_color'):
self.style = no_style() self.style = no_style()
self.stderr = OutputWrapper(options.get('stderr', sys.stderr)) self.stderr = OutputWrapper(options.get('stderr', sys.stderr))
os.environ["DJANGO_COLORS"] = "nocolor"
else: else:
self.stderr = OutputWrapper(options.get('stderr', sys.stderr), self.style.ERROR) self.stderr = OutputWrapper(options.get('stderr', sys.stderr), self.style.ERROR)
......
...@@ -1385,6 +1385,7 @@ class CommandTypes(AdminScriptTestCase): ...@@ -1385,6 +1385,7 @@ class CommandTypes(AdminScriptTestCase):
out = StringIO() out = StringIO()
call_command('color_command', no_color=True, stdout=out) call_command('color_command', no_color=True, stdout=out)
self.assertEqual(os.environ.get('DJANGO_COLORS', ''), 'nocolor')
self.assertEqual(out.getvalue(), 'BEGIN\n') self.assertEqual(out.getvalue(), 'BEGIN\n')
def test_base_command(self): def test_base_command(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment