r"""Quote a string for use in a cookie header. If the string does not need to be double-quoted, then just return the string. Otherwise, surround the string in doublequotes and quote (with a \) special characters.
(str)
| 181 | |
| 182 | |
| 183 | def _quote(str): |
| 184 | r"""Quote a string for use in a cookie header. |
| 185 | |
| 186 | If the string does not need to be double-quoted, then just return the |
| 187 | string. Otherwise, surround the string in doublequotes and quote |
| 188 | (with a \) special characters. |
| 189 | """ |
| 190 | if str is None or _is_legal_key(str): |
| 191 | return str |
| 192 | else: |
| 193 | return '"' + str.translate(_Translator) + '"' |
| 194 | |
| 195 | |
| 196 | _unquote_sub = re.compile(r'\\(?:([0-3][0-7][0-7])|(.))').sub |
no test coverage detected
searching dependent graphs…