1
0
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:
Malcolm Tredinnick 2007-02-13 05:50:55 +00:00
parent ffa0d27462
commit a4ddecd15c
2 changed files with 4 additions and 0 deletions

View File

@ -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):

View File

@ -111,6 +111,8 @@ u'\xcb'
>>> urlencode('jack & jill')
'jack%20%26%20jill'
>>> urlencode(1)
'1'
>>> urlizetrunc('http://short.com/', 20)