Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit a4ddecd15c1ea38a7827426f73ddd997786d42cd 1 parent ffa0d27
@malcolmt malcolmt authored
View
2  django/template/defaultfilters.py
@@ -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
2  tests/regressiontests/defaultfilters/tests.py
@@ -111,6 +111,8 @@
>>> urlencode('jack & jill')
'jack%20%26%20jill'
+>>> urlencode(1)
+'1'
>>> urlizetrunc('http://short.com/', 20)

0 comments on commit a4ddecd

Please sign in to comment.
Something went wrong with that request. Please try again.