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)
| 172 | _is_legal_key = re.compile('[%s]+' % re.escape(_LegalChars)).fullmatch |
| 173 | |
| 174 | def _quote(str): |
| 175 | r"""Quote a string for use in a cookie header. |
| 176 | |
| 177 | If the string does not need to be double-quoted, then just return the |
| 178 | string. Otherwise, surround the string in doublequotes and quote |
| 179 | (with a \) special characters. |
| 180 | """ |
| 181 | if str is None or _is_legal_key(str): |
| 182 | return str |
| 183 | else: |
| 184 | return '"' + str.translate(_Translator) + '"' |
| 185 | |
| 186 | |
| 187 | _OctalPatt = re.compile(r"\\[0-3][0-7][0-7]") |
no test coverage detected