Django

Code

Changeset 4099

Show
Ignore:
Timestamp:
11/24/06 12:24:49 (2 years ago)
Author:
ubernostrum
Message:

0.91-bugfixes: Backport [3820] to 0.91-bugfixes, refs #2745.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/0.91-bugfixes/django/core/handlers/wsgi.py

    r2639 r4099  
    5656    def __repr__(self): 
    5757        from pprint import pformat 
    58         return '<DjangoRequest\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \ 
    59             (pformat(self.GET), pformat(self.POST), pformat(self.COOKIES), 
    60             pformat(self.META)) 
     58        # Since this is called as part of error handling, we need to be very 
     59        # robust against potentially malformed input. 
     60        try: 
     61            get = pformat(self.GET) 
     62        except: 
     63            get = '<could not parse>' 
     64        try: 
     65            post = pformat(self.POST) 
     66        except: 
     67            post = '<could not parse>' 
     68        try: 
     69            cookies = pformat(self.COOKIES) 
     70        except: 
     71            cookies = '<could not parse>' 
     72        try: 
     73            meta = pformat(self.META) 
     74        except: 
     75            meta = '<could not parse>' 
     76        try: 
     77            user = self.user 
     78        except: 
     79            user = '<could not parse>' 
     80        return '<DjangoRequest\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s,\nuser:%s>' % \ 
     81               (self.path, get, post, cookies, meta, user) 
    6182 
    6283    def get_full_path(self):