Get whether string I{s} contains special characters. @param s: A string to check. @type s: str @return: True if needs encoding. @rtype: boolean
(self, s)
| 49 | special = ('&', '<', '>', '"', "'") |
| 50 | |
| 51 | def needsEncoding(self, s): |
| 52 | """ |
| 53 | Get whether string I{s} contains special characters. |
| 54 | @param s: A string to check. |
| 55 | @type s: str |
| 56 | @return: True if needs encoding. |
| 57 | @rtype: boolean |
| 58 | """ |
| 59 | if isinstance(s, str): |
| 60 | for c in self.special: |
| 61 | if c in s: |
| 62 | return True |
| 63 | return False |
| 64 | |
| 65 | def encode(self, s): |
| 66 | """ |