[Django] #23107: --no-color option won't work for output of runserver command

104 views
Skip to first unread message

Django

unread,
Jul 26, 2014, 11:45:51 AM7/26/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
--------------------------------------------+----------------------
Reporter: hirokiky | Owner: nobody
Type: Bug | Status: new
Component: Core (Management commands) | Version: 1.7-rc-1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------------+----------------------
The `--no-color` option won't work for output of runserver command.

{{{
python manage.py runserver --no-color
...

[26/Jul/2014 15:01:07] "GET / HTTP/1.1" 500 85001 # Colored
}}}

Ticket for `--no-color` feature did not include about WSGIServer
https://code.djangoproject.com/ticket/19877
And, output of the WSGIServer will be colorized.
(actually output of the management command won't be colorized).

--
Ticket URL: <https://code.djangoproject.com/ticket/23107>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 26, 2014, 12:06:44 PM7/26/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------

Reporter: hirokiky | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by hirokiky):

* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 1
* needs_docs: => 0


Comment:

Attached a patch to fix the behaviour.
I'll try to write tests and send PR (after Accepted).

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:1>

Django

unread,
Jul 26, 2014, 12:06:51 PM7/26/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: hirokiky
Type: Bug | Status: assigned

Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by hirokiky):

* owner: nobody => hirokiky
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:2>

Django

unread,
Jul 27, 2014, 2:36:06 PM7/27/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: hirokiky
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by areski):

I tried the patch to add a review and it didn't worked for me, so I made
the following pull request:
https://github.com/django/django/pull/2989

I think this need a more advanced Django dev to review it and maybe put us
in the right direction.

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:3>

Django

unread,
Jul 27, 2014, 2:37:43 PM7/27/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: hirokiky
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by areski):

* cc: areski@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:4>

Django

unread,
Jul 28, 2014, 12:46:17 PM7/28/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: hirokiky
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timo):

* cc: timo (added)
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:5>

Django

unread,
Jul 28, 2014, 2:46:58 PM7/28/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner:
Type: Bug | Status: new

Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by hirokiky):

* status: assigned => new
* cc: hirokiky@… (added)
* owner: hirokiky =>


Comment:

@areski Thanks for your patch. Your solution is direct and seems good. I
deassign from this patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:6>

Django

unread,
Jul 29, 2014, 8:33:11 AM7/29/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: areski
Type: Bug | Status: assigned

Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by areski):

* owner: => areski


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:7>

Django

unread,
Jul 29, 2014, 9:22:15 AM7/29/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: areski
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by areski):

I'm taking a much more simplistic approach to solve this, same as
mentioned in the original patch but with a correction.
https://github.com/django/django/pull/2998

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:8>

Django

unread,
Jul 30, 2014, 12:59:55 PM7/30/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: areski
Type: Bug | Status: closed

Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution: fixed

Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"67d7da5fb9498b811f0168f5df2308ad4743027f"]:
{{{
#!CommitTicketReference repository=""
revision="67d7da5fb9498b811f0168f5df2308ad4743027f"
Fixed #23107 -- Made runserver output respect --no-color.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:9>

Django

unread,
Jul 30, 2014, 1:00:17 PM7/30/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: areski
Type: Bug | Status: closed
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"7cb4a82eaf2c6b59a80699ae91b63180eb8a47ef"]:
{{{
#!CommitTicketReference repository=""
revision="7cb4a82eaf2c6b59a80699ae91b63180eb8a47ef"
[1.7.x] Fixed #23107 -- Made runserver output respect --no-color.

Backport of 67d7da5fb9 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:10>

Django

unread,
Jul 30, 2014, 4:19:07 PM7/30/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: areski
Type: Bug | Status: closed
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by hirokiky):

Thank you guys.
I think it's better to credit @timo and me on the commit log.
https://docs.djangoproject.com/en/1.7/internals/contributing/committing-
code/#committing-guidelines

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:11>

Django

unread,
Jul 30, 2014, 5:10:53 PM7/30/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: areski
Type: Bug | Status: closed
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by timo):

Sorry, I forgot to add that.

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:12>

Django

unread,
Oct 19, 2014, 3:15:11 PM10/19/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: areski
Type: Bug | Status: closed
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by loic):

I don't think modifying the environment is an appropriate fix, if you use
call_command(no_color=True), every other call_command() won't have color.
I'm in favor of a revert.

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:13>

Django

unread,
Oct 19, 2014, 4:06:58 PM10/19/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: areski
Type: Bug | Status: closed
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by loic):

Sadly it doesn't seem that we have any other ways than the environment to
reach `WSGIRequestHandler`. In https://github.com/django/django/pull/3391
I limit the change of environment to the `runserver` command which is IMO
acceptable considering this command runs forever.

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:14>

Django

unread,
Oct 21, 2014, 2:05:14 PM10/21/14
to django-...@googlegroups.com
#23107: --no-color option won't work for output of runserver command
-------------------------------------+-------------------------------------
Reporter: hirokiky | Owner: areski
Type: Bug | Status: closed
Component: Core (Management | Version: 1.7-rc-1
commands) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Loic Bistuer <loic.bistuer@…>):

In [changeset:"c34e13e17c664ea43b85572428bcf74c7509db3f"]:
{{{
#!CommitTicketReference repository=""
revision="c34e13e17c664ea43b85572428bcf74c7509db3f"


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

This commit reverts 67d7da5fb9498b811f0168f5df2308ad4743027f.

The previous fix changed the environment globally, which meant
that any call to `call_command(no_color=True)` prevented further
`call_command` with color.

This fix still relies on the environment because it's currently the only
way to reach WSGIRequestHandler, but it's now limited to the `runserver`
command. This seems an acceptable compromise considering `runserver` runs
indefinitely.

Thanks Tim Graham for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23107#comment:15>

Reply all
Reply to author
Forward
0 new messages