mirror of https://github.com/django/django.git
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):
|
||||
"Escapes a value for use in a URL"
|
||||
import urllib
|
||||
if not isinstance(value, basestring):
|
||||
value = str(value)
|
||||
return urllib.quote(value)
|
||||
|
||||
def urlize(value):
|
||||
|
|
|
@ -111,6 +111,8 @@ u'\xcb'
|
|||
|
||||
>>> urlencode('jack & jill')
|
||||
'jack%20%26%20jill'
|
||||
>>> urlencode(1)
|
||||
'1'
|
||||
|
||||
|
||||
>>> urlizetrunc('http://short.com/', 20)
|
||||
|
|
Loading…
Reference in New Issue