Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed HttpRequest.path to be a Unicode object. It has already been

URL-decoded by the time we see it anyway, so keeping it as a UTF-8 bytestring
was causing unnecessary problems.

Also added handling for non-ASCII URL fragments in feed creation (the portion
that was outside the control of the Feed class was messed up).



git-svn-id: http://code.djangoproject.com/svn/django/trunk@5629 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit fad72477151b7f77d7098cc3721aeaee47e735b6 1 parent 347704d
Malcolm Tredinnick malcolmt authored
4 django/contrib/syndication/feeds.py
View
@@ -2,14 +2,14 @@
from django.template import Context, loader, Template, TemplateDoesNotExist
from django.contrib.sites.models import Site
from django.utils import feedgenerator
-from django.utils.encoding import smart_unicode
+from django.utils.encoding import smart_unicode, iri_to_uri
from django.conf import settings
def add_domain(domain, url):
if not url.startswith('http://'):
# 'url' must already be ASCII and URL-quoted, so no need for encoding
# conversions here.
- url = u'http://%s%s' % (domain, url)
+ url = iri_to_uri(u'http://%s%s' % (domain, url))
return url
class FeedDoesNotExist(ObjectDoesNotExist):
3  django/core/handlers/modpython.py
View
@@ -2,6 +2,7 @@
from django.core import signals
from django.dispatch import dispatcher
from django.utils import datastructures
+from django.utils.encoding import force_unicode
from django import http
from pprint import pformat
import os
@@ -13,7 +14,7 @@
class ModPythonRequest(http.HttpRequest):
def __init__(self, req):
self._req = req
- self.path = req.uri
+ self.path = force_unicode(req.uri)
def __repr__(self):
# Since this is called as part of error handling, we need to be very
3  django/core/handlers/wsgi.py
View
@@ -2,6 +2,7 @@
from django.core import signals
from django.dispatch import dispatcher
from django.utils import datastructures
+from django.utils.encoding import force_unicode
from django import http
from pprint import pformat
from shutil import copyfileobj
@@ -73,7 +74,7 @@ def safe_copyfileobj(fsrc, fdst, length=16*1024, size=0):
class WSGIRequest(http.HttpRequest):
def __init__(self, environ):
self.environ = environ
- self.path = environ['PATH_INFO']
+ self.path = force_unicode(environ['PATH_INFO'])
self.META = environ
self.method = environ['REQUEST_METHOD'].upper()
Please sign in to comment.
Something went wrong with that request. Please try again.