247 | | frame['vars'] = [(k, force_escape(pprint(v))) for k, v in frame['vars']] |
| 247 | vars = [] |
| 248 | for k, v in frame['vars']: |
| 249 | v = pprint(v) |
| 250 | # The force_escape filter assume unicode, make sure that works |
| 251 | if isinstance(v, str): |
| 252 | v = v.decode('utf-8', 'replace') # don't choke on non-utf-8 input |
| 253 | # You may be looking at large blobs of data, trim it |
| 254 | if len(v) > 4096: |
| 255 | v = u'%s... <trimmed %d bytes string>' % (v[0:4096], len(v)) |
| 256 | vars.append((k, force_escape(v))) |
| 257 | frame['vars'] = vars |