[Python-checkins] r71029 - in python/trunk/Lib: Cookie.py test/test_cookie.py
senthil.kumaran
python-checkins at python.org
Thu Apr 2 05:00:34 CEST 2009
Author: senthil.kumaran
Date: Thu Apr 2 05:00:34 2009
New Revision: 71029
Log:
Fixing the issue4860. Escaping embedded '"' character in js_output() method of Morsel.
Modified:
python/trunk/Lib/Cookie.py
python/trunk/Lib/test/test_cookie.py
Modified: python/trunk/Lib/Cookie.py
==============================================================================
--- python/trunk/Lib/Cookie.py (original)
+++ python/trunk/Lib/Cookie.py Thu Apr 2 05:00:34 2009
@@ -477,7 +477,7 @@
document.cookie = \"%s\";
// end hiding -->
</script>
- """ % ( self.OutputString(attrs), )
+ """ % ( self.OutputString(attrs).replace('"',r'\"'), )
# end js_output()
def OutputString(self, attrs=None):
Modified: python/trunk/Lib/test/test_cookie.py
==============================================================================
--- python/trunk/Lib/test/test_cookie.py (original)
+++ python/trunk/Lib/test/test_cookie.py Thu Apr 2 05:00:34 2009
@@ -51,17 +51,17 @@
self.assertEqual(C.output(['path']),
'Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme')
- self.assertEqual(C.js_output(), """
+ self.assertEqual(C.js_output(), r"""
<script type="text/javascript">
<!-- begin hiding
- document.cookie = "Customer="WILE_E_COYOTE"; Path=/acme; Version=1";
+ document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme; Version=1";
// end hiding -->
</script>
""")
- self.assertEqual(C.js_output(['path']), """
+ self.assertEqual(C.js_output(['path']), r"""
<script type="text/javascript">
<!-- begin hiding
- document.cookie = "Customer="WILE_E_COYOTE"; Path=/acme";
+ document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme";
// end hiding -->
</script>
""")
More information about the Python-checkins
mailing list