mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #3155 -- Allow an integer to be passed to the urlencode filter. Patch
based on one from SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4496 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ffa0d27462
commit
a4ddecd15c
@ -141,6 +141,8 @@ def upper(value):
|
|||||||
def urlencode(value):
|
def urlencode(value):
|
||||||
"Escapes a value for use in a URL"
|
"Escapes a value for use in a URL"
|
||||||
import urllib
|
import urllib
|
||||||
|
if not isinstance(value, basestring):
|
||||||
|
value = str(value)
|
||||||
return urllib.quote(value)
|
return urllib.quote(value)
|
||||||
|
|
||||||
def urlize(value):
|
def urlize(value):
|
||||||
|
@ -111,6 +111,8 @@ u'\xcb'
|
|||||||
|
|
||||||
>>> urlencode('jack & jill')
|
>>> urlencode('jack & jill')
|
||||||
'jack%20%26%20jill'
|
'jack%20%26%20jill'
|
||||||
|
>>> urlencode(1)
|
||||||
|
'1'
|
||||||
|
|
||||||
|
|
||||||
>>> urlizetrunc('http://short.com/', 20)
|
>>> urlizetrunc('http://short.com/', 20)
|
||||||
|
Loading…
Reference in New Issue
Block a user