summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-02-27 17:20:17 +0100
committerDan McGee <dan@archlinux.org>2010-02-27 20:36:58 +0100
commit1c073bea62ce854448d15bac05362ec8ecba763e (patch)
tree103edb4801b885c77eb3320327bff288d841e53b
parent8314777c5858b8f9dd954ef906e19de1322a61d0 (diff)
downloadarchweb-1c073bea62ce854448d15bac05362ec8ecba763e.tar.gz
archweb-1c073bea62ce854448d15bac05362ec8ecba763e.tar.xz
Ensure our cache is correct with AJAX requests
Since the same URLs serve two different responses based on the request being AJAX or not, we want to ensure we don't cache the wrong one and serve it up incorrectly. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/views.py2
-rw-r--r--todolists/views.py2
2 files changed, 4 insertions, 0 deletions
diff --git a/packages/views.py b/packages/views.py
index c5f8786..e95d4a2 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -7,6 +7,7 @@ from django.shortcuts import get_object_or_404
from django.contrib.auth.models import User
from django.contrib.auth.decorators import permission_required
from django.contrib.admin.widgets import AdminDateWidget
+from django.views.decorators.vary import vary_on_headers
from django.views.generic import list_detail
from django.db.models import Q
@@ -178,6 +179,7 @@ def search(request, page=None):
template_object_name="package",
extra_context=page_dict)
+@vary_on_headers('X-Requested-With')
def files(request, name='', repo='', arch=''):
pkg = get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
diff --git a/todolists/views.py b/todolists/views.py
index a38ec0d..8358e4c 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -5,6 +5,7 @@ from django.template import RequestContext
from django.core.mail import send_mail
from django.shortcuts import get_object_or_404, render_to_response
from django.contrib.auth.decorators import login_required, permission_required
+from django.views.decorators.vary import vary_on_headers
from django.views.generic.create_update import delete_object
from django.template import Context, loader
from django.utils import simplejson
@@ -31,6 +32,7 @@ class TodoListForm(forms.Form):
@login_required
+@vary_on_headers('X-Requested-With')
def flag(request, listid, pkgid):
list = get_object_or_404(Todolist, id=listid)
pkg = get_object_or_404(TodolistPkg, id=pkgid)