Changeset 5338
- Timestamp:
- 05/25/07 02:25:34 (1 year ago)
- Files:
-
- django/branches/unicode/django/test/client.py (modified) (1 diff)
- django/branches/unicode/django/utils/html.py (modified) (1 diff)
- django/branches/unicode/django/utils/http.py (added)
- django/branches/unicode/docs/unicode.txt (modified) (2 diffs)
- django/branches/unicode/tests/modeltests/test_client/models.py (modified) (2 diffs)
- django/branches/unicode/tests/modeltests/test_client/views.py (modified) (1 diff)
- django/branches/unicode/tests/regressiontests/text/tests.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/unicode/django/test/client.py
r5242 r5338 11 11 from django.core.signals import got_request_exception 12 12 from django.dispatch import dispatcher 13 from django.http import urlencode,SimpleCookie, HttpRequest13 from django.http import SimpleCookie, HttpRequest 14 14 from django.test import signals 15 15 from django.utils.functional import curry 16 16 from django.utils.encoding import smart_str 17 from django.utils.http import urlencode 17 18 18 19 BOUNDARY = 'BoUnDaRyStRiNg' django/branches/unicode/django/utils/html.py
r5328 r5338 126 126 clean_html = allow_lazy(clean_html, unicode) 127 127 128 def urlquote(url, safe='/'):129 """130 A version of Python's urllib.quote() function that can operate on unicode131 strings. The url is first UTF-8 encoded before quoting. The returned string132 can safely be used as part of an argument to a subsequent iri_to_uri() call133 without double-quoting occurring.134 """135 return force_unicode(urllib.quote(smart_str(url)))136 urlquote = allow_lazy(urlquote, unicode)137 138 def urlquote_plus(url, safe=''):139 """140 A version of Python's urllib.quote_plus() function that can operate on141 unicode strings. The url is first UTF-8 encoded before quoting. The142 returned string can safely be used as part of an argument to a subsequent143 iri_to_uri() call without double-quoting occurring.144 """145 return force_unicode(urllib.quote_plus(smart_str(url), safe))146 urlquote_plus = allow_lazy(urlquote_plus, unicode)django/branches/unicode/docs/unicode.txt
r5334 r5338 150 150 conversion from IRI to URI as required by `the specification`_. 151 151 152 * The functions ``django.utils.ht ml.urlquote()`` and153 ``django.utils.ht ml.urlquote_plus()`` are versions of Python's standard152 * The functions ``django.utils.http.urlquote()`` and 153 ``django.utils.http.urlquote_plus()`` are versions of Python's standard 154 154 ``urllib.quote()`` and ``urllib.quote_plus()`` that work with non-ASCII 155 155 characters (the data is converted to UTF-8 prior to encoding). … … 236 236 237 237 from django.utils.encoding import iri_to_uri 238 from django.utils.ht mlimport urlquote238 from django.utils.http import urlquote 239 239 240 240 def get_absolute_url(self): django/branches/unicode/tests/modeltests/test_client/models.py
r5185 r5338 1 # coding: utf-8 1 2 """ 2 3 38. Testing using the Test Client … … 28 29 def test_get_view(self): 29 30 "GET a view" 30 response = self.client.get('/test_client/get_view/') 31 # The data is ignored, but let's check it doesn't crash the system 32 # anyway. 33 data = {'var': u'\xf2'} 34 response = self.client.get('/test_client/get_view/', data) 31 35 32 36 # Check some response details 33 37 self.assertContains(response, 'This is a test') 34 self.assertEqual(response.context['var'], 42)38 self.assertEqual(response.context['var'], u'\xf2') 35 39 self.assertEqual(response.template.name, 'GET Template') 36 40 django/branches/unicode/tests/modeltests/test_client/views.py
r5185 r5338 11 11 "A simple view that expects a GET request, and returns a rendered template" 12 12 t = Template('This is a test. {{ var }} is the value.', name='GET Template') 13 c = Context({'var': 42})13 c = Context({'var': request.GET.get('var', 42)}) 14 14 15 15 return HttpResponse(t.render(c)) django/branches/unicode/tests/regressiontests/text/tests.py
r5328 r5338 18 18 19 19 ### urlquote ############################################################# 20 >>> from django.utils.ht mlimport urlquote, urlquote_plus20 >>> from django.utils.http import urlquote, urlquote_plus 21 21 >>> urlquote(u'Paris & Orl\xe9ans') 22 22 u'Paris%20%26%20Orl%C3%A9ans'
