#2489: Make everything Unicode
----------------------------+-----------------------------------------------
Reporter: adrian | Owner: adrian
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Core framework | Version:
Severity: normal | Resolution:
Keywords: |
----------------------------+-----------------------------------------------
Comment (by Alex Dedul):
After #2514 HttpResponse breaks with headers set from DB. With the
following view code
{{{
def profile_dl_pgp_key(request, user_id):
profile = get_object_or_404(UserProfile, user__pk=user_id)
response = HttpResponse(mimetype='text/plain')
response['Content-Disposition'] = 'attachment;
filename=%s_public_pgp_key.asc' % profile.user.username
response.write(profile.public_pgp_key)
return response
}}}
this error occurs
{{{
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
File "/usr/local/lib/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)
File "/usr/local/lib/python2.4/site-
packages/django/core/handlers/modpython.py", line 163, in handler
return ModPythonHandler()(req)
File "/usr/local/lib/python2.4/site-
packages/django/core/handlers/modpython.py", line 146, in __call__
populate_apache_request(response, req)
File "/usr/local/lib/python2.4/site-
packages/django/core/handlers/modpython.py", line 154, in
populate_apache_request
mod_python_req.headers_out[key] = value
TypeError: table values must be strings
}}}
Key in mod_python_req.headers_out[key] is a unicode string we got from
psycopg2, so it breaks.
As a fix patch below could be used.
--
Ticket URL: <http://code.djangoproject.com/ticket/2489>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---