Changeset 3786
- Timestamp:
- 09/21/06 22:17:28 (2 years ago)
- Files:
-
- django/trunk/AUTHORS (modified) (1 diff)
- django/trunk/django/core/xheaders.py (modified) (1 diff)
- django/trunk/django/middleware/doc.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r3781 r3786 69 69 deric@monowerks.com 70 70 dne@mayonnaise.net 71 Maximillian Dornseif <md@hudora.de> 71 72 Jeremy Dunck <http://dunck.us/> 72 73 Andy Dustman <farcepest@gmail.com> django/trunk/django/core/xheaders.py
r2809 r3786 14 14 Adds the "X-Object-Type" and "X-Object-Id" headers to the given 15 15 HttpResponse according to the given model and object_id -- but only if the 16 given HttpRequest object has an IP address within the INTERNAL_IPS setting. 16 given HttpRequest object has an IP address within the INTERNAL_IPS setting 17 or if the request is from a logged in staff member. 17 18 """ 18 19 from django.conf import settings 19 if request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS :20 if request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or (request.user.is_authenticated() and request.user.is_staff): 20 21 response['X-Object-Type'] = "%s.%s" % (model._meta.app_label, model._meta.object_name.lower()) 21 22 response['X-Object-Id'] = str(object_id) django/trunk/django/middleware/doc.py
r3171 r3786 8 8 def process_view(self, request, view_func, view_args, view_kwargs): 9 9 """ 10 If the request method is HEAD and the IP is internal, quickly return 11 with an x-header indicating the view function. This is used by the 12 documentation module to lookup the view function for an arbitrary page. 10 If the request method is HEAD and either the IP is internal or the 11 user is a logged-in staff member, quickly return with an x-header 12 indicating the view function. This is used by the documentation module 13 to lookup the view function for an arbitrary page. 13 14 """ 14 if request.method == 'HEAD' and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS:15 if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or (request.user.is_authenticated() and request.user.is_staff)): 15 16 response = http.HttpResponse() 16 17 response['X-View'] = "%s.%s" % (view_func.__module__, view_func.__name__)
