1
0
mirror of https://github.com/django/django.git synced 2025-10-27 23:56:08 +00:00

unicode: Added iri_to_uri() utility function and use it in the databrowse app.

Should make getting this stuff right a bit easier.


git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5278 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2007-05-17 18:19:40 +00:00
parent 52b0051523
commit c0b451fcfa
3 changed files with 36 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
"""
# Tests for stuff in django.utils.text.
# coding: utf-8
r"""
# Tests for stuff in django.utils.text and other text munging util functions.
>>> from django.utils.text import *
@@ -8,10 +9,17 @@
[u'This', u'is', u'"a person"', u'test.']
>>> print list(smart_split(r'''This is "a person's" test.'''))[2]
"a person's"
>>> print list(smart_split(r'''This is "a person\\"s" test.'''))[2]
>>> print list(smart_split(r'''This is "a person\"s" test.'''))[2]
"a person"s"
>>> list(smart_split('''"a 'one'''))
[u'"a', u"'one"]
>>> print list(smart_split(r'''all friends' tests'''))[1]
friends'
### iri_to_uri ###########################################################
>>> from django.utils.encoding import iri_to_uri
>>> iri_to_uri(u'red%09ros\xe9#red')
'red%09ros%C3%A9#red'
>>> iri_to_uri(u'/blog/for/J\xfcrgen M\xfcnster/')
'/blog/for/J%C3%BCrgen%20M%C3%BCnster/'
"""