summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-07-07 17:15:54 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-07-07 17:15:54 +0000
commitfad72477151b7f77d7098cc3721aeaee47e735b6 (patch)
tree84c2ca15f92aebeceddc1f72723ea76f11a870a2
parent347704d2df12f83ef0bd7f0b54766c5b90cc90ad (diff)
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
-rw-r--r--django/contrib/syndication/feeds.py4
-rw-r--r--django/core/handlers/modpython.py3
-rw-r--r--django/core/handlers/wsgi.py3
3 files changed, 6 insertions, 4 deletions
diff --git a/django/contrib/syndication/feeds.py b/django/contrib/syndication/feeds.py
index 428767ae48..b1d0cf02c7 100644
--- a/django/contrib/syndication/feeds.py
+++ b/django/contrib/syndication/feeds.py
@@ -2,14 +2,14 @@ from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
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):
diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py
index e26f234fe5..7c4bbb3082 100644
--- a/django/core/handlers/modpython.py
+++ b/django/core/handlers/modpython.py
@@ -2,6 +2,7 @@ from django.core.handlers.base import BaseHandler
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 @@ import os
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
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py
index 49938e25dc..2db83fccfc 100644
--- a/django/core/handlers/wsgi.py
+++ b/django/core/handlers/wsgi.py
@@ -2,6 +2,7 @@ from django.core.handlers.base import BaseHandler
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()