Changeset 7202
- Timestamp:
- 03/07/08 21:12:27 (9 months ago)
- Files:
-
- django/trunk/django/core/management/color.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/management/color.py
r6478 r7202 7 7 from django.utils import termcolors 8 8 9 def supports_color(): 10 """ 11 Returns True if the running system's terminal supports color, and False 12 otherwise. 13 """ 14 unsupported_platform = (sys.platform in ('win32', 'Pocket PC') 15 or sys.platform.startswith('java')) 16 # isatty is not always implemented, #6223. 17 is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() 18 if unsupported_platform or not is_a_tty: 19 return False 20 return True 21 9 22 def color_style(): 10 23 """Returns a Style object with the Django color scheme.""" 11 if (sys.platform == 'win32' or sys.platform == 'Pocket PC' 12 or sys.platform.startswith('java') or not sys.stdout.isatty()): 24 if not supports_color(): 13 25 return no_style() 14 26 class dummy: pass
