Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Revert [13850], this was a new feature not a bugfix.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14316 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 7f404e26289e4676478f9096a61b7bc2cf56cdf2 1 parent 0df4c1c
Chris Beaven authored October 21, 2010
16  django/template/defaultfilters.py
@@ -291,20 +291,10 @@ def upper(value):
291 291
 upper.is_safe = False
292 292
 upper = stringfilter(upper)
293 293
 
294  
-def urlencode(value, safe=None):
295  
-    """
296  
-    Escapes a value for use in a URL.
297  
-
298  
-    Takes an optional ``safe`` parameter used to determine the characters which
299  
-    should not be escaped by Django's ``urlquote`` method. If not provided, the
300  
-    default safe characters will be used (but an empty string can be provided
301  
-    when *all* characters should be escaped).
302  
-    """
  294
+def urlencode(value):
  295
+    """Escapes a value for use in a URL."""
303 296
     from django.utils.http import urlquote
304  
-    kwargs = {}
305  
-    if safe is not None:
306  
-        kwargs['safe'] = safe
307  
-    return urlquote(value, **kwargs)
  297
+    return urlquote(value)
308 298
 urlencode.is_safe = False
309 299
 urlencode = stringfilter(urlencode)
310 300
 
4  django/utils/http.py
@@ -14,7 +14,7 @@ def urlquote(url, safe='/'):
14 14
     can safely be used as part of an argument to a subsequent iri_to_uri() call
15 15
     without double-quoting occurring.
16 16
     """
17  
-    return force_unicode(urllib.quote(smart_str(url), smart_str(safe)))
  17
+    return force_unicode(urllib.quote(smart_str(url), safe))
18 18
 
19 19
 urlquote = allow_lazy(urlquote, unicode)
20 20
 
@@ -25,7 +25,7 @@ def urlquote_plus(url, safe=''):
25 25
     returned string can safely be used as part of an argument to a subsequent
26 26
     iri_to_uri() call without double-quoting occurring.
27 27
     """
28  
-    return force_unicode(urllib.quote_plus(smart_str(url), smart_str(safe)))
  28
+    return force_unicode(urllib.quote_plus(smart_str(url), safe))
29 29
 urlquote_plus = allow_lazy(urlquote_plus, unicode)
30 30
 
31 31
 def urlencode(query, doseq=0):
13  docs/ref/templates/builtins.txt
@@ -1970,19 +1970,6 @@ For example::
1970 1970
 If ``value`` is ``"http://www.example.org/foo?a=b&c=d"``, the output will be
1971 1971
 ``"http%3A//www.example.org/foo%3Fa%3Db%26c%3Dd"``.
1972 1972
 
1973  
-.. versionadded:: 1.1
1974  
-
1975  
-An optional argument containing the characters which should not be escaped can
1976  
-be provided.
1977  
-
1978  
-If not provided, the '/' character is assumed safe. An empty string can be
1979  
-provided when *all* characters should be escaped. For example::
1980  
-
1981  
-    {{ value|urlencode:"" }}
1982  
-
1983  
-If ``value`` is ``"http://www.example.org/"``, the output will be
1984  
-``"http%3A%2F%2Fwww.example.org%2F"``.
1985  
-
1986 1973
 .. templatefilter:: urlize
1987 1974
 
1988 1975
 urlize
4  tests/regressiontests/templates/filters.py
@@ -265,10 +265,6 @@ def get_filter_tests():
265 265
         'filter-iriencode03': ('{{ url|iriencode }}', {'url': mark_safe('?test=1&me=2')}, '?test=1&me=2'),
266 266
         'filter-iriencode04': ('{% autoescape off %}{{ url|iriencode }}{% endautoescape %}', {'url': mark_safe('?test=1&me=2')}, '?test=1&me=2'),
267 267
 
268  
-        # urlencode
269  
-        'filter-urlencode01': ('{{ url|urlencode }}', {'url': '/test&"/me?/'}, '/test%26%22/me%3F/'),
270  
-        'filter-urlencode02': ('/test/{{ urlbit|urlencode:"" }}/', {'urlbit': 'escape/slash'}, '/test/escape%2Fslash/'),
271  
-
272 268
         # Chaining a bunch of safeness-preserving filters should not alter
273 269
         # the safe status either way.
274 270
         'chaining01': ('{{ a|capfirst|center:"7" }}.{{ b|capfirst|center:"7" }}', {"a": "a < b", "b": mark_safe("a < b")}, " A &lt; b . A < b "),

0 notes on commit 7f404e2

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