mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #24962 -- Added newline to characters escaped by contrib.admin.utils.quote()
Thanks alito for the report and patch.
This commit is contained in:
		| @@ -68,7 +68,7 @@ def quote(s): | ||||
|     res = list(s) | ||||
|     for i in range(len(res)): | ||||
|         c = res[i] | ||||
|         if c in """:/_#?;@&=+$,"[]<>%\\""": | ||||
|         if c in """:/_#?;@&=+$,"[]<>%\n\\""": | ||||
|             res[i] = '_%02X' % ord(c) | ||||
|     return ''.join(res) | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ from django.contrib import admin | ||||
| from django.contrib.admin import helpers | ||||
| from django.contrib.admin.utils import ( | ||||
|     NestedObjects, display_for_field, flatten, flatten_fieldsets, | ||||
|     label_for_field, lookup_field, | ||||
|     label_for_field, lookup_field, quote, | ||||
| ) | ||||
| from django.db import DEFAULT_DB_ALIAS, models | ||||
| from django.test import TestCase, override_settings | ||||
| @@ -379,3 +379,6 @@ class UtilsTests(TestCase): | ||||
|             }), | ||||
|         ) | ||||
|         self.assertEqual(flatten_fieldsets(fieldsets), ['url', 'title', 'content', 'sites']) | ||||
|  | ||||
|     def test_quote(self): | ||||
|         self.assertEqual(quote('something\nor\nother'), 'something_0Aor_0Aother') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user