dcramer/raven — Issue #35: Cannot capture exception when used with genshi
Author: rslinckx
Created: 2012-01-17 14:10:06+00:00
State: open

When trying to render a genshi template with raven enabled I get the following traceback:

Traceback (most recent call last):
File "/Users/kikidonk/Whatever/env/kp/lib/python2.7/site-packages/flask/app.py", line 1506, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/kikidonk/Whatever/env/kp/lib/python2.7/site-packages/flask/app.py", line 1181, in handle_exception
got_request_exception.send(self, exception=e)
File "/Users/kikidonk/Whatever/env/kp/lib/python2.7/site-packages/blinker/base.py", line 220, in send
for receiver in self.receivers_for(sender)]
File "/Users/kikidonk/Whatever/env/kp/lib/python2.7/site-packages/raven/contrib/flask/__init__.py", line 31, in _handle_exception
'app': sender.name,
File "/Users/kikidonk/Whatever/env/kp/lib/python2.7/site-packages/raven/base.py", line 219, in capture
data.update(processor.process(data))
File "/Users/kikidonk/Whatever/env/kp/lib/python2.7/site-packages/raven/processors.py", line 28, in process
for k, v in frame['vars'].iteritems():
AttributeError: 'str' object has no attribute 'iteritems'

It seems that frame['vars'] contains a string...

In utils/stacks.py:149 I see that 'vars': transform(frame.f_locals)

And upon inspection it seems that frame.f_locals is a list with a single item being a dict containing the genshi variables.

I'm guessing the transform sees a list and then stringifies it, but then other code expects it to be a dict (which it really should be).

Maybe genshi does weird stuff with f_locals ?