[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate/tests - testDTML.py:1.13

Chris McDonough chrism@zope.com
Wed, 14 Aug 2002 11:47:28 -0400


Update of /cvs-repository/Zope/lib/python/DocumentTemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv25172/DocumentTemplate/tests

Modified Files:
	testDTML.py 
Log Message:
Added 'url_unquote' and 'url_unquote_plus' modifiers to DTML as
well as made these functions available in PythonScripts via
the 'standard' module.


=== Zope/lib/python/DocumentTemplate/tests/testDTML.py 1.12 => 1.13 ===
--- Zope/lib/python/DocumentTemplate/tests/testDTML.py:1.12	Thu May 23 09:19:16 2002
+++ Zope/lib/python/DocumentTemplate/tests/testDTML.py	Wed Aug 14 11:46:58 2002
@@ -248,6 +248,45 @@
         res = html(spam=42) + html(spam=None)
         assert res == expected, res
 
+    def testUrlUnquote(self):
+        html1 = self.doc_class(
+            """
+            <dtml-var expr="'http%3A//www.zope.org%3Fa%3Db%20123'" fmt=url-unquote>
+            """
+            )
+        html2 = self.doc_class(
+            """
+            <dtml-var expr="'http%3A%2F%2Fwww.zope.org%3Fa%3Db+123'" fmt=url-unquote-plus>
+            """
+            )
+            
+        expected = (
+            """
+            http://www.zope.org?a=b 123
+            """
+            )
+        self.assertEqual(html1(), expected)
+        self.assertEqual(html2(), expected)
+        html1 = self.doc_class(
+            """
+            <dtml-var expr="'http%3A//www.zope.org%3Fa%3Db%20123'" url_unquote>
+            """
+            )
+        html2 = self.doc_class(
+            """
+            <dtml-var expr="'http%3A%2F%2Fwww.zope.org%3Fa%3Db+123'" url_unquote_plus>
+            """
+            )
+            
+        expected = (
+            """
+            http://www.zope.org?a=b 123
+            """
+            )
+        self.assertEqual(html1(), expected)
+        self.assertEqual(html2(), expected)
+            
+
     def test_fmt(self):
         html=self.doc_class(
             """