Helper for Markup.__mod__
| 209 | |
| 210 | |
| 211 | class _MarkupEscapeHelper(object): |
| 212 | """Helper for Markup.__mod__""" |
| 213 | |
| 214 | def __init__(self, obj, escape): |
| 215 | self.obj = obj |
| 216 | self.escape = escape |
| 217 | |
| 218 | __getitem__ = lambda s, x: _MarkupEscapeHelper(s.obj[x], s.escape) |
| 219 | __unicode__ = __str__ = lambda s: text_type(s.escape(s.obj)) |
| 220 | __repr__ = lambda s: str(s.escape(repr(s.obj))) |
| 221 | __int__ = lambda s: int(s.obj) |
| 222 | __float__ = lambda s: float(s.obj) |
| 223 | |
| 224 | |
| 225 | # we have to import it down here as the speedups and native |