summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-05-18 08:05:48 -0700
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-05-18 08:05:48 -0700
commite73cb6391dd4f178e430c424eda6d9c97a70c7f6 (patch)
treecad8e142f73fcf8d96ee440fc94a3cf210b53cf3 /django
parentd5ce2ff5e485bf94fcade340bc803ba4671bd95a (diff)
parent64e11a68f19793d11915e83574b1bb693da3980e (diff)
Merge pull request #1122 from ambv/issue13285
Fixed #13285: populate_xheaders breaks caching
Diffstat (limited to 'django')
-rw-r--r--django/contrib/flatpages/views.py2
-rw-r--r--django/core/xheaders.py24
2 files changed, 0 insertions, 26 deletions
diff --git a/django/contrib/flatpages/views.py b/django/contrib/flatpages/views.py
index 497979e497..20e930f343 100644
--- a/django/contrib/flatpages/views.py
+++ b/django/contrib/flatpages/views.py
@@ -1,7 +1,6 @@
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import get_current_site
-from django.core.xheaders import populate_xheaders
from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.template import loader, RequestContext
@@ -70,5 +69,4 @@ def render_flatpage(request, f):
'flatpage': f,
})
response = HttpResponse(t.render(c))
- populate_xheaders(request, response, FlatPage, f.id)
return response
diff --git a/django/core/xheaders.py b/django/core/xheaders.py
deleted file mode 100644
index 3766628c98..0000000000
--- a/django/core/xheaders.py
+++ /dev/null
@@ -1,24 +0,0 @@
-"""
-Pages in Django can are served up with custom HTTP headers containing useful
-information about those pages -- namely, the content type and object ID.
-
-This module contains utility functions for retrieving and doing interesting
-things with these special "X-Headers" (so called because the HTTP spec demands
-that custom headers are prefixed with "X-").
-
-Next time you're at slashdot.org, watch out for X-Fry and X-Bender. :)
-"""
-
-def populate_xheaders(request, response, model, object_id):
- """
- Adds the "X-Object-Type" and "X-Object-Id" headers to the given
- HttpResponse according to the given model and object_id -- but only if the
- given HttpRequest object has an IP address within the INTERNAL_IPS setting
- or if the request is from a logged in staff member.
- """
- from django.conf import settings
- if (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS
- or (hasattr(request, 'user') and request.user.is_active
- and request.user.is_staff)):
- response['X-Object-Type'] = "%s.%s" % (model._meta.app_label, model._meta.model_name)
- response['X-Object-Id'] = str(object_id)