(text)
| 1016 | ) |
| 1017 | |
| 1018 | def _escape_cdata(text): |
| 1019 | # escape character data |
| 1020 | try: |
| 1021 | # it's worth avoiding do-nothing calls for strings that are |
| 1022 | # shorter than 500 characters, or so. assume that's, by far, |
| 1023 | # the most common case in most applications. |
| 1024 | if "&" in text: |
| 1025 | text = text.replace("&", "&") |
| 1026 | if "<" in text: |
| 1027 | text = text.replace("<", "<") |
| 1028 | if ">" in text: |
| 1029 | text = text.replace(">", ">") |
| 1030 | return text |
| 1031 | except (TypeError, AttributeError): |
| 1032 | _raise_serialization_error(text) |
| 1033 | |
| 1034 | def _escape_attrib(text): |
| 1035 | # escape attribute value |
no test coverage detected
searching dependent graphs…