Ticket #407: django.patch
File django.patch, 3.1 KB (added by , 19 years ago) |
---|
-
contrib/comments/views/comments.py
204 204 new_data = request.POST.copy() 205 205 new_data['content_type_id'] = content_type_id 206 206 new_data['object_id'] = object_id 207 new_data['ip_address'] = request.META ['REMOTE_ADDR']207 new_data['ip_address'] = request.META.get('REMOTE_ADDR') 208 208 new_data['is_public'] = comments.IS_PUBLIC in option_list 209 209 response = HttpResponse() 210 210 manipulator = PublicCommentManipulator(request.user, -
core/xheaders.py
17 17 within the INTERNAL_IPS setting. 18 18 """ 19 19 from django.conf.settings import INTERNAL_IPS 20 if request.META ['REMOTE_ADDR']in INTERNAL_IPS:20 if request.META.get('REMOTE_ADDR') in INTERNAL_IPS: 21 21 response['X-Object-Type'] = "%s.%s" % (package, python_module_name) 22 22 response['X-Object-Id'] = str(object_id) -
core/handlers/base.py
79 79 if DEBUG: 80 80 return self.get_technical_error_response() 81 81 else: 82 subject = 'Database error (%s IP)' % (request.META ['REMOTE_ADDR']in INTERNAL_IPS and 'internal' or 'EXTERNAL')82 subject = 'Database error (%s IP)' % (request.META.get('REMOTE_ADDR', '[UNKNOWN]') in INTERNAL_IPS and 'internal' or 'EXTERNAL') 83 83 message = "%s\n\n%s" % (self._get_traceback(), request) 84 84 mail_admins(subject, message, fail_silently=True) 85 85 return self.get_friendly_error_response(request, resolver) … … 89 89 if DEBUG: 90 90 return self.get_technical_error_response() 91 91 else: 92 subject = 'Coding error (%s IP)' % (request.META ['REMOTE_ADDR']in INTERNAL_IPS and 'internal' or 'EXTERNAL')92 subject = 'Coding error (%s IP)' % (request.META.get('REMOTE_ADDR', '[UNKNOWN]') in INTERNAL_IPS and 'internal' or 'EXTERNAL') 93 93 try: 94 94 request_repr = repr(request) 95 95 except: -
middleware/doc.py
12 12 with an x-header indicating the view function. This is used by the 13 13 documentation module to lookup the view function for an arbitrary page. 14 14 """ 15 if request.META['REQUEST_METHOD'] == 'HEAD' and request.META ['REMOTE_ADDR']in settings.INTERNAL_IPS:15 if request.META['REQUEST_METHOD'] == 'HEAD' and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: 16 16 response = httpwrappers.HttpResponse() 17 17 response['X-View'] = "%s.%s" % (view_func.__module__, view_func.__name__) 18 18 return response