Pylons/pyramid_debugtoolbar — Issue #42: request_vars.mako template does not handle forms with file data
Author: everilae
Created: 2011-10-25 12:06:41+00:00
State: open

With a POST request from form accepting multipart/form-data containing a file request_vars.mako raises an exception

File "/venv/local/lib/python2.7/site-packages/pyramid_debugtoolbar-0.9.4post2-py2.7.egg/pyramid_debugtoolbar/panels/templates/request_vars.mako", line 88, in render_body
${", ".join(value)|h}
TypeError: sequence item 0: expected string, instance found

It seems PDT is given a ready made instance instead of a plain string. A quick hack would be to

${", ".join(isinstance(val, (str, unicode)) and val or repr(val) for val in value)|h}

... or handle values before giving them to template (the better solution?).