Comment (by ramiro):
IMHO we should try hard no not keep adding code to Django that deals with
platforms limitations/particularities.
Contributor buriy has done a good work enumerating the options in
comment:3. Other options available are:
6. Use the colorama lib (https://pypi.python.org/pypi/colorama)
7. Rely on the user having installed the ANSICON external app
(http://adoxa.hostmyway.net/ansicon/). The code modification is
essentially a one-liner:
{{{
diff --git a/django/core/management/color.py
b/django/core/management/color.py
index c322614..4276c7d 100644
--- a/django/core/management/color.py
+++ b/django/core/management/color.py
@@ -14,10 +14,10 @@ def supports_color():
otherwise.
"""
plat = sys.platform
- unsupported_platform = plat == 'Pocket PC' or plat == 'win32' and
'ANSICON' not in os.environ
+ supported_platform = plat != 'Pocket PC' and (plat != 'win32' or
'ANSICON' in os.environ)
# isatty is not always implemented, #6223.
is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
- if unsupported_platform or not is_a_tty:
+ if not supported_platform or not is_a_tty:
return False
return True
}}}
Googling shows there are other open source projects that have chosen this
path (Cucumber, RSpec).
6, just like the options that involve dependency on pyreadline, imply
adding a soft third party Python module dependency and/or code to deal
with the issue.
I'm ready to either simply close this ticket or to commit the above patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/13476#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by ramiro):
Replying to [comment:13 ramiro]:
> IMHO we should try hard to not keep adding code to Django that deals
with platforms limitations/particularities.
I meant: Try hard to not keep adding code to Django that deals with
platforms limitations/particularities for non essential functionality like
e.g. the dev server and its reloading mechanism and trhis one: management
commands color output.
--
Ticket URL: <https://code.djangoproject.com/ticket/13476#comment:14>
Comment (by claudep):
+1 for you proposal (7), with docs of course.
--
Ticket URL: <https://code.djangoproject.com/ticket/13476#comment:15>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"12615dab78cb6fc7d8c74b7b65a4136b0feeb33f"]:
{{{
#!CommitTicketReference repository=""
revision="12615dab78cb6fc7d8c74b7b65a4136b0feeb33f"
Fixed #13476 -- Added support for color in console output under Windows.
Detect and use the services of the ANSICON third-party tool if it's
available.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13476#comment:16>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/13476#comment:17>