mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Fixing the issue4860. Escaping embedded '"' character in js_output() method of Morsel.
This commit is contained in:
		
							parent
							
								
									985951df7f
								
							
						
					
					
						commit
						c730a6a123
					
				
					 2 changed files with 5 additions and 5 deletions
				
			
		|  | @ -477,7 +477,7 @@ def js_output(self, attrs=None): | ||||||
|         document.cookie = \"%s\"; |         document.cookie = \"%s\"; | ||||||
|         // end hiding --> |         // end hiding --> | ||||||
|         </script> |         </script> | ||||||
|         """ % ( self.OutputString(attrs), ) |         """ % ( self.OutputString(attrs).replace('"',r'\"'), ) | ||||||
|     # end js_output() |     # end js_output() | ||||||
| 
 | 
 | ||||||
|     def OutputString(self, attrs=None): |     def OutputString(self, attrs=None): | ||||||
|  |  | ||||||
|  | @ -51,17 +51,17 @@ def test_load(self): | ||||||
| 
 | 
 | ||||||
|         self.assertEqual(C.output(['path']), |         self.assertEqual(C.output(['path']), | ||||||
|             'Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme') |             'Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme') | ||||||
|         self.assertEqual(C.js_output(), """ |         self.assertEqual(C.js_output(), r""" | ||||||
|         <script type="text/javascript"> |         <script type="text/javascript"> | ||||||
|         <!-- begin hiding |         <!-- begin hiding | ||||||
|         document.cookie = "Customer="WILE_E_COYOTE"; Path=/acme; Version=1"; |         document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme; Version=1"; | ||||||
|         // end hiding --> |         // end hiding --> | ||||||
|         </script> |         </script> | ||||||
|         """) |         """) | ||||||
|         self.assertEqual(C.js_output(['path']), """ |         self.assertEqual(C.js_output(['path']), r""" | ||||||
|         <script type="text/javascript"> |         <script type="text/javascript"> | ||||||
|         <!-- begin hiding |         <!-- begin hiding | ||||||
|         document.cookie = "Customer="WILE_E_COYOTE"; Path=/acme"; |         document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme"; | ||||||
|         // end hiding --> |         // end hiding --> | ||||||
|         </script> |         </script> | ||||||
|         """) |         """) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Senthil Kumaran
						Senthil Kumaran