Django

Code

Changeset 580

Show
Ignore:
Timestamp:
08/31/05 11:27:59 (3 years ago)
Author:
adrian
Message:

Fixed #407 -- Code no longer assumes request.METAREMOTE_ADDR? exists. Thanks, sune.kirkeby@gmail.com

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/comments/views/comments.py

    r549 r580  
    205205    new_data['content_type_id'] = content_type_id 
    206206    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') 
    208208    new_data['is_public'] = comments.IS_PUBLIC in option_list 
    209209    response = HttpResponse() 
  • django/trunk/django/core/handlers/base.py

    r548 r580  
    8080                return self.get_technical_error_response() 
    8181            else: 
    82                 subject = 'Database error (%s IP): %s' % ((request.META['REMOTE_ADDR'] in INTERNAL_IPS and 'internal' or 'EXTERNAL'), getattr(request, 'path', '')) 
     82                subject = 'Database error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in INTERNAL_IPS and 'internal' or 'EXTERNAL'), getattr(request, 'path', '')) 
    8383                message = "%s\n\n%s" % (self._get_traceback(), request) 
    8484                mail_admins(subject, message, fail_silently=True) 
     
    9090                return self.get_technical_error_response() 
    9191            else: 
    92                 subject = 'Coding error (%s IP): %s' % ((request.META['REMOTE_ADDR'] in INTERNAL_IPS and 'internal' or 'EXTERNAL'), getattr(request, 'path', '')) 
     92                subject = 'Coding error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in INTERNAL_IPS and 'internal' or 'EXTERNAL'), getattr(request, 'path', '')) 
    9393                try: 
    9494                    request_repr = repr(request) 
  • django/trunk/django/core/xheaders.py

    r55 r580  
    1818    """ 
    1919    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: 
    2121        response['X-Object-Type'] = "%s.%s" % (package, python_module_name) 
    2222        response['X-Object-Id'] = str(object_id) 
  • django/trunk/django/middleware/doc.py

    r3 r580  
    1313        documentation module to lookup the view function for an arbitrary page. 
    1414        """ 
    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: 
    1616            response = httpwrappers.HttpResponse() 
    1717            response['X-View'] = "%s.%s" % (view_func.__module__, view_func.__name__)