Russell Keith-Magee wrote:

> I'm not convinced that a single setting is the right approach for
> this. It almost seems like this is something that we should be using
> environment variables or a dot file (e.g., a .djangorc with system
> wide Django settings) - although this introduces a dependency on the
> environment. I'm open to other suggestions.
> 

I was going to suggest that people who don't like color at all for one
reason or another could do 'export TERM=xterm-mono', but turns out that
doesn't seem to work for the django ./manage.py case*  (separate issue
to configuring precise colors used in different situations, which might
be done through a DJANGO_COLORS env var akin to gnu ls's LS_COLORS,
or by some other means).

* It looks like  django.utils.termcolors  fires out ansi escapes and
hopes rather than using a terminal control abstraction layer
http://docs.python.org/library/curses.html
- note that you can use part of the python curses module just to access
the lowlevel terminfo functions (man terminfo), it's not just for
fullscreen mode curses applications - see also e.g.
http://nadiana.com/python-curses-terminal-controller

I'm on the clock and can't write a real patch, sorry, and I know
terminals can seem a bit arcane, but e.g. try the following under
TERM=xterm-256color vs. TERM=xterm-mono

#!/usr/bin/python
import curses  # might want to fallback if unavailable
curses.setupterm()
setaf = curses.tigetstr('setaf')
if setaf:
   magenta = curses.tparm(setaf, curses.COLOR_MAGENTA)
   print magenta + "MAGENTA ALERT"
else:
   print "MONO ALERT"











--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to