Ticket #11268: django_contrib_admin_util_quote.diff
File django_contrib_admin_util_quote.diff, 948 bytes (added by , 15 years ago) |
---|
-
django/contrib/admin/util.py
10 10 def quote(s): 11 11 """ 12 12 Ensure that primary key values do not confuse the admin URLs by escaping 13 any ' /', '_' and ':' characters. Similar to urllib.quote, except that the14 quoting is slightly different so that it doesn't get automatically13 any ' ', '/', '_' and ':' characters. Similar to urllib.quote, except that 14 the quoting is slightly different so that it doesn't get automatically 15 15 unquoted by the Web browser. 16 16 """ 17 17 if not isinstance(s, basestring): … … 19 19 res = list(s) 20 20 for i in range(len(res)): 21 21 c = res[i] 22 if c in """:/_#?;@&=+$,"<>%\\""":22 if c in ' :/_#?;@&=+$,"<>%\\': 23 23 res[i] = '_%02X' % ord(c) 24 24 return ''.join(res) 25 25