[Django] #29560: Add an option to django-admin to always colorize output

11 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Django

ungelesen,
11.07.2018, 06:10:2311.07.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas | Owner: nobody
Noé |
Type: | Status: new
Uncategorized |
Component: Core | Version: master
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
With Django management commands, it is currently possible disable colors
with the `--no-colors` flag.

What I'd like to have is basically the other side of the coin: a `--force-
colors` flag that instructs Django to output ANSI color sequences in cases
it would disable colors by default (typically, when the output is piped to
another command, as documented).

My real world use-case is the following one: I have a custom Django
command to import data. I run this command myself, and I'd like to send a
colored log (HTML seems perfect for this) to the data curators. I can use
the https://github.com/theZiz/aha utility for this, but that doesn't work
since Django disable colors when the output is piped.

Other *nix commands have a special flag for this exact use-case, for
example `$ ls --color=always`

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

Django

ungelesen,
12.07.2018, 04:38:5412.07.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: nobody
Type: New feature | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* cc: Carlton Gibson (added)
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted


Comment:

Hi Nicolas. I'm going to Accept this: it seems reasonable.

> …in cases it would disable colors by default (typically, when the output


is piped to another command, as documented).

Can I ask, where is this documented? I cannot seem to find it. Thanks.

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

Django

ungelesen,
12.07.2018, 04:44:1312.07.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: nobody
Type: New feature | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Nicolas Noé):

Thanks Carlton!

It is documented in https://docs.djangoproject.com/en/2.0/ref/django-admin
/#syntax-coloring:

''The django-admin / manage.py commands will use pretty color-coded output
if your terminal supports ANSI-colored output. It won’t use the color
codes if you’re piping the command’s output to another program.''

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

Django

ungelesen,
12.07.2018, 04:47:0612.07.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: nobody
Type: New feature | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Thanks Nicolas. I just found that. (I must have been blind: I even looked
in that exact location... sigh :-)

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

Django

ungelesen,
12.07.2018, 10:27:5512.07.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Nicolas
| Noé
Type: New feature | Status: assigned

Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nicolas Noé):

* owner: nobody => Nicolas Noé
* status: new => assigned


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

Django

ungelesen,
17.07.2018, 04:08:4517.07.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: (none)

Type: New feature | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nicolas Noé):

* status: assigned => new
* owner: Nicolas Noé => (none)


Comment:

I unfortunately can't find time in the short term to work on the
implementation...

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

Django

ungelesen,
22.07.2018, 14:13:4822.07.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani

Type: New feature | Status: assigned
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* owner: (none) => Hasan Ramezani


* status: new => assigned

* has_patch: 0 => 1


Comment:

PR[https://github.com/django/django/pull/10213]

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

Django

ungelesen,
23.07.2018, 10:10:0823.07.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1


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

Django

ungelesen,
07.09.2018, 04:55:2007.09.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


Comment:

This looks good to me. (I had a couple of tiny comment which I assume will
be addressed, so progressing.) Thanks Hasan.

Django

ungelesen,
11.09.2018, 11:47:0711.09.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani
Type: New feature | Status: closed

Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"5195b99e2c3804ec5f9c98d29e0cf76bf44b0cec" 5195b99e]:
{{{
#!CommitTicketReference repository=""
revision="5195b99e2c3804ec5f9c98d29e0cf76bf44b0cec"
Fixed #29560 -- Added --force-color management command option.
}}}

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

Django

ungelesen,
11.09.2018, 12:47:5311.09.18
an django-...@googlegroups.com
#29560: Add an option to django-admin to always colorize output
-------------------------------------+-------------------------------------
Reporter: Nicolas Noé | Owner: Hasan
| Ramezani
Type: New feature | Status: closed
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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

In [changeset:"a4d8e412e0295ac7d40bb87ee6e5f44649f97816" a4d8e412]:
{{{
#!CommitTicketReference repository=""
revision="a4d8e412e0295ac7d40bb87ee6e5f44649f97816"
Refs #29560 -- Fixed typo in django/core/management/base.py.
}}}

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

Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten