diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-04-21 02:23:40 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-04-21 02:23:40 -0400 |
commit | 8ff271216f421594970631eec1ba156a8a35e561 (patch) | |
tree | e56af4f242621c0e0a20a30d9fe881edbc307feb /main/utils.py | |
parent | 03fa7e4f27bdb39a8f8f5ed91a87d18bf8357b47 (diff) | |
parent | bb18fa3323a0494a2774ea61911572b089d04b6d (diff) |
Merge branch 'archweb' into archweb-generic2
Diffstat (limited to 'main/utils.py')
-rw-r--r-- | main/utils.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/main/utils.py b/main/utils.py index cdd4ff71..9ee8db58 100644 --- a/main/utils.py +++ b/main/utils.py @@ -3,11 +3,11 @@ try: except ImportError: import pickle -from datetime import datetime import hashlib from django.core.cache import cache from django.db import connections, router +from django.http import HttpResponse from django.utils.timezone import now from django.template.defaultfilters import slugify @@ -55,6 +55,14 @@ def clear_cache_function(func, args, kwargs): cache.delete(key) +def empty_response(): + empty = HttpResponse('') + # designating response as 'streaming' forces ConditionalGetMiddleware to + # not add a 'Content-Length: 0' header + empty.streaming = True + return empty + + def format_http_headers(request): headers = sorted((k, v) for k, v in request.META.items() if k.startswith('HTTP_')) |