Ensure that primary key values do not confuse the admin URLs by escaping any '/', '_' and ':' and similarly problematic characters. Similar to urllib.parse.quote(), except that the quoting is slightly different so that it doesn't get automatically unquoted by the web browser.
(s)
| 89 | |
| 90 | |
| 91 | def quote(s): |
| 92 | """ |
| 93 | Ensure that primary key values do not confuse the admin URLs by escaping |
| 94 | any '/', '_' and ':' and similarly problematic characters. |
| 95 | Similar to urllib.parse.quote(), except that the quoting is slightly |
| 96 | different so that it doesn't get automatically unquoted by the web browser. |
| 97 | """ |
| 98 | return s.translate(QUOTE_MAP) if isinstance(s, str) else s |
| 99 | |
| 100 | |
| 101 | def unquote(s): |
no outgoing calls
searching dependent graphs…