Opened 17 years ago

Last modified 17 years ago

#4990 closed

HttpResponse.__unicode__ — at Initial Version

Reported by: Thomas Güttler <hv@…> Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

I got this exception:
UnicodeEncodeError at /.../
'ascii' codec can't encode character u'\xe4' in position 33614: ordinal not in range(128)

# /home/modarch/wfbauantraege/wfba/middleware.py in process_exception

# Send Debug Traceback as Email to us

  1. html=smart_unicode(django.views.debug.technical_500_response(request, *sys.exc_info()), errors="replace") ...

# /home/modarch/python/lib64/python2.4/site-packages/django/utils/encoding.py in smart_unicode

  1. return force_unicode(s, encoding, strings_only, errors) ...

# /home/modarch/python/lib64/python2.4/site-packages/django/utils/encoding.py in force_unicode

  1. return s
  2. if not isinstance(s, basestring,):
  3. if hasattr(s, 'unicode'):
  4. s = unicode(s)
  5. else:
  1. s = unicode(str(s), encoding, errors) ...

s is a django.http.HttpResponseServerError object.

This patch gives HttpResponse a unicode method.

Change History (1)

by Thomas Güttler <hv@…>, 17 years ago

Attachment: httpresponse-unicode.diff added
Note: See TracTickets for help on using tickets.
Back to Top