Author: SmileyChris
Date: 2010-10-21 16:21:43 -0500 (Thu, 21 Oct 2010)
New Revision: 14316
Modified:
django/branches/releases/1.2.X/django/template/defaultfilters.py
django/branches/releases/1.2.X/django/utils/http.py
django/branches/releases/1.2.X/docs/ref/templates/builtins.txt
django/branches/releases/1.2.X/tests/regressiontests/templates/filters.py
Log:
[1.2.X] Revert [13850], this was a new feature not a bugfix.
Modified: django/branches/releases/1.2.X/django/template/defaultfilters.py
===================================================================
--- django/branches/releases/1.2.X/django/template/defaultfilters.py
2010-10-21 21:17:07 UTC (rev 14315)
+++ django/branches/releases/1.2.X/django/template/defaultfilters.py
2010-10-21 21:21:43 UTC (rev 14316)
@@ -291,20 +291,10 @@
upper.is_safe = False
upper = stringfilter(upper)
-def urlencode(value, safe=None):
- """
- Escapes a value for use in a URL.
-
- Takes an optional ``safe`` parameter used to determine the characters which
- should not be escaped by Django's ``urlquote`` method. If not provided, the
- default safe characters will be used (but an empty string can be provided
- when *all* characters should be escaped).
- """
+def urlencode(value):
+ """Escapes a value for use in a URL."""
from django.utils.http import urlquote
- kwargs = {}
- if safe is not None:
- kwargs['safe'] = safe
- return urlquote(value, **kwargs)
+ return urlquote(value)
urlencode.is_safe = False
urlencode = stringfilter(urlencode)
Modified: django/branches/releases/1.2.X/django/utils/http.py
===================================================================
--- django/branches/releases/1.2.X/django/utils/http.py 2010-10-21 21:17:07 UTC
(rev 14315)
+++ django/branches/releases/1.2.X/django/utils/http.py 2010-10-21 21:21:43 UTC
(rev 14316)
@@ -14,7 +14,7 @@
can safely be used as part of an argument to a subsequent iri_to_uri() call
without double-quoting occurring.
"""
- return force_unicode(urllib.quote(smart_str(url), smart_str(safe)))
+ return force_unicode(urllib.quote(smart_str(url), safe))
urlquote = allow_lazy(urlquote, unicode)
@@ -25,7 +25,7 @@
returned string can safely be used as part of an argument to a subsequent
iri_to_uri() call without double-quoting occurring.
"""
- return force_unicode(urllib.quote_plus(smart_str(url), smart_str(safe)))
+ return force_unicode(urllib.quote_plus(smart_str(url), safe))
urlquote_plus = allow_lazy(urlquote_plus, unicode)
def urlencode(query, doseq=0):
Modified: django/branches/releases/1.2.X/docs/ref/templates/builtins.txt
===================================================================
--- django/branches/releases/1.2.X/docs/ref/templates/builtins.txt
2010-10-21 21:17:07 UTC (rev 14315)
+++ django/branches/releases/1.2.X/docs/ref/templates/builtins.txt
2010-10-21 21:21:43 UTC (rev 14316)
@@ -1970,19 +1970,6 @@
If ``value`` is ``"http://www.example.org/foo?a=b&c=d"``, the output will be
``"http%3A//www.example.org/foo%3Fa%3Db%26c%3Dd"``.
-.. versionadded:: 1.1
-
-An optional argument containing the characters which should not be escaped can
-be provided.
-
-If not provided, the '/' character is assumed safe. An empty string can be
-provided when *all* characters should be escaped. For example::
-
- {{ value|urlencode:"" }}
-
-If ``value`` is ``"http://www.example.org/"``, the output will be
-``"http%3A%2F%2Fwww.example.org%2F"``.
-
.. templatefilter:: urlize
urlize
Modified:
django/branches/releases/1.2.X/tests/regressiontests/templates/filters.py
===================================================================
--- django/branches/releases/1.2.X/tests/regressiontests/templates/filters.py
2010-10-21 21:17:07 UTC (rev 14315)
+++ django/branches/releases/1.2.X/tests/regressiontests/templates/filters.py
2010-10-21 21:21:43 UTC (rev 14316)
@@ -265,10 +265,6 @@
'filter-iriencode03': ('{{ url|iriencode }}', {'url':
mark_safe('?test=1&me=2')}, '?test=1&me=2'),
'filter-iriencode04': ('{% autoescape off %}{{ url|iriencode }}{%
endautoescape %}', {'url': mark_safe('?test=1&me=2')}, '?test=1&me=2'),
- # urlencode
- 'filter-urlencode01': ('{{ url|urlencode }}', {'url': '/test&"/me?/'},
'/test%26%22/me%3F/'),
- 'filter-urlencode02': ('/test/{{ urlbit|urlencode:"" }}/', {'urlbit':
'escape/slash'}, '/test/escape%2Fslash/'),
-
# Chaining a bunch of safeness-preserving filters should not alter
# the safe status either way.
'chaining01': ('{{ a|capfirst|center:"7" }}.{{ b|capfirst|center:"7"
}}', {"a": "a < b", "b": mark_safe("a < b")}, " A < b . A < b "),
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.