diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-05-02 01:31:56 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-05-02 01:31:56 +0000 |
| commit | f69cf70ed813a8cd7e1f963a14ae39103e8d5265 (patch) | |
| tree | d3b32e84cd66573b3833ddf662af020f8ef2f7a8 /django/core/xheaders.py | |
| parent | d5dbeaa9be359a4c794885c2e9f1b5a7e5e51fb8 (diff) | |
MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/xheaders.py')
| -rw-r--r-- | django/core/xheaders.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/django/core/xheaders.py b/django/core/xheaders.py index 98d2586b75..e173bcbca8 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) + from django.conf import settings + if request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: + response['X-Object-Type'] = "%s.%s" % (model._meta.app_label, model._meta.object_name.lower()) response['X-Object-Id'] = str(object_id) |
