From df36b25d65d5fd5bffb113b805fcbce2a20ec6c6 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 13 Jan 2006 03:34:55 +0000 Subject: [PATCH] magic-removal: Changed django.core.xheaders to take 'model' parameter instead of 'package' and 'python_module_name' git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1934 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/xheaders.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/django/core/xheaders.py b/django/core/xheaders.py index 98d2586b75..354463b5a8 100644 --- a/django/core/xheaders.py +++ b/django/core/xheaders.py @@ -9,14 +9,13 @@ that custom headers are prefxed with "X-"). Next time you're at slashdot.org, watch out for X-Fry and X-Bender. :) """ -def populate_xheaders(request, response, package, python_module_name, object_id): +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 package, python_module_name and - object_id -- but only if the given HttpRequest object has an IP address - within the INTERNAL_IPS setting. + 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. """ from django.conf.settings import INTERNAL_IPS if request.META.get('REMOTE_ADDR') in INTERNAL_IPS: - response['X-Object-Type'] = "%s.%s" % (package, python_module_name) + response['X-Object-Type'] = "%s.%s" % (model._meta.app_label, model._meta.object_name.lower()) response['X-Object-Id'] = str(object_id)