Skip to content

Commit

Permalink
Added color configuration for HTTP 304, since it doesn't require as m…
Browse files Browse the repository at this point in the history
…uch attention as other 3XX codes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12281 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed Jan 23, 2010
1 parent 3df1a16 commit e71b10e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions django/core/servers/basehttp.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -619,6 +619,8 @@ def log_message(self, format, *args):
msg = self.style.HTTP_SUCCESS(msg) msg = self.style.HTTP_SUCCESS(msg)
elif args[1][0] == '1': elif args[1][0] == '1':
msg = self.style.HTTP_INFO(msg) msg = self.style.HTTP_INFO(msg)
elif args[1] == '304':
msg = self.style.HTTP_NOT_MODIFIED(msg)
elif args[1][0] == '3': elif args[1][0] == '3':
msg = self.style.HTTP_REDIRECT(msg) msg = self.style.HTTP_REDIRECT(msg)
elif args[1] == '404': elif args[1] == '404':
Expand Down
3 changes: 3 additions & 0 deletions django/utils/termcolors.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def make_style(opts=(), **kwargs):
'HTTP_INFO': {}, 'HTTP_INFO': {},
'HTTP_SUCCESS': {}, 'HTTP_SUCCESS': {},
'HTTP_REDIRECT': {}, 'HTTP_REDIRECT': {},
'HTTP_NOT_MODIFIED': {},
'HTTP_BAD_REQUEST': {}, 'HTTP_BAD_REQUEST': {},
'HTTP_NOT_FOUND': {}, 'HTTP_NOT_FOUND': {},
'HTTP_SERVER_ERROR': {}, 'HTTP_SERVER_ERROR': {},
Expand All @@ -95,6 +96,7 @@ def make_style(opts=(), **kwargs):
'HTTP_INFO': { 'opts': ('bold',) }, 'HTTP_INFO': { 'opts': ('bold',) },
'HTTP_SUCCESS': { }, 'HTTP_SUCCESS': { },
'HTTP_REDIRECT': { 'fg': 'green' }, 'HTTP_REDIRECT': { 'fg': 'green' },
'HTTP_NOT_MODIFIED': { 'fg': 'cyan' },
'HTTP_BAD_REQUEST': { 'fg': 'red', 'opts': ('bold',) }, 'HTTP_BAD_REQUEST': { 'fg': 'red', 'opts': ('bold',) },
'HTTP_NOT_FOUND': { 'fg': 'yellow' }, 'HTTP_NOT_FOUND': { 'fg': 'yellow' },
'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) }, 'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) },
Expand All @@ -109,6 +111,7 @@ def make_style(opts=(), **kwargs):
'HTTP_INFO': { 'opts': ('bold',) }, 'HTTP_INFO': { 'opts': ('bold',) },
'HTTP_SUCCESS': { }, 'HTTP_SUCCESS': { },
'HTTP_REDIRECT': { 'fg': 'green', 'opts': ('bold',) }, 'HTTP_REDIRECT': { 'fg': 'green', 'opts': ('bold',) },
'HTTP_NOT_MODIFIED': { 'fg': 'green' },
'HTTP_BAD_REQUEST': { 'fg': 'red', 'opts': ('bold',) }, 'HTTP_BAD_REQUEST': { 'fg': 'red', 'opts': ('bold',) },
'HTTP_NOT_FOUND': { 'fg': 'red' }, 'HTTP_NOT_FOUND': { 'fg': 'red' },
'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) }, 'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) },
Expand Down
3 changes: 2 additions & 1 deletion docs/ref/django-admin.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1028,7 +1028,8 @@ number of roles in which color is used:
* ``sql_table`` - The name of a model in SQL. * ``sql_table`` - The name of a model in SQL.
* ``http_info`` - A 1XX HTTP Informational server response. * ``http_info`` - A 1XX HTTP Informational server response.
* ``http_success`` - A 2XX HTTP Success server response. * ``http_success`` - A 2XX HTTP Success server response.
* ``http_redirect`` - A 3XX HTTP Redirect server response. * ``http_not_modified`` - A 304 HTTP Not Modified server response.
* ``http_redirect`` - A 3XX HTTP Redirect server response other than 304.
* ``http_not_found`` - A 404 HTTP Not Found server response. * ``http_not_found`` - A 404 HTTP Not Found server response.
* ``http_bad_request`` - A 4XX HTTP Bad Request server response other than 404. * ``http_bad_request`` - A 4XX HTTP Bad Request server response other than 404.
* ``http_server_error`` - A 5XX HTTP Server Error response. * ``http_server_error`` - A 5XX HTTP Server Error response.
Expand Down

0 comments on commit e71b10e

Please sign in to comment.