Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored July 07, 2007
4  django/contrib/syndication/feeds.py
@@ -2,14 +2,14 @@
2 2
 from django.template import Context, loader, Template, TemplateDoesNotExist
3 3
 from django.contrib.sites.models import Site
4 4
 from django.utils import feedgenerator
5  
-from django.utils.encoding import smart_unicode
  5
+from django.utils.encoding import smart_unicode, iri_to_uri
6 6
 from django.conf import settings
7 7
 
8 8
 def add_domain(domain, url):
9 9
     if not url.startswith('http://'):
10 10
         # 'url' must already be ASCII and URL-quoted, so no need for encoding
11 11
         # conversions here.
12  
-        url = u'http://%s%s' % (domain, url)
  12
+        url = iri_to_uri(u'http://%s%s' % (domain, url))
13 13
     return url
14 14
 
15 15
 class FeedDoesNotExist(ObjectDoesNotExist):
3  django/core/handlers/modpython.py
@@ -2,6 +2,7 @@
2 2
 from django.core import signals
3 3
 from django.dispatch import dispatcher
4 4
 from django.utils import datastructures
  5
+from django.utils.encoding import force_unicode
5 6
 from django import http
6 7
 from pprint import pformat
7 8
 import os
@@ -13,7 +14,7 @@
13 14
 class ModPythonRequest(http.HttpRequest):
14 15
     def __init__(self, req):
15 16
         self._req = req
16  
-        self.path = req.uri
  17
+        self.path = force_unicode(req.uri)
17 18
 
18 19
     def __repr__(self):
19 20
         # Since this is called as part of error handling, we need to be very
3  django/core/handlers/wsgi.py
@@ -2,6 +2,7 @@
2 2
 from django.core import signals
3 3
 from django.dispatch import dispatcher
4 4
 from django.utils import datastructures
  5
+from django.utils.encoding import force_unicode
5 6
 from django import http
6 7
 from pprint import pformat
7 8
 from shutil import copyfileobj
@@ -73,7 +74,7 @@ def safe_copyfileobj(fsrc, fdst, length=16*1024, size=0):
73 74
 class WSGIRequest(http.HttpRequest):
74 75
     def __init__(self, environ):
75 76
         self.environ = environ
76  
-        self.path = environ['PATH_INFO']
  77
+        self.path = force_unicode(environ['PATH_INFO'])
77 78
         self.META = environ
78 79
         self.method = environ['REQUEST_METHOD'].upper()
79 80
 

0 notes on commit fad7247

Please sign in to comment.
Something went wrong with that request. Please try again.