getsentry/raven-python — pull request #369 by rhyselsmore (2013-10-02 09:37:26+00:00)
Title: Presenting a Sentry ID in the Flask request global for further use

As per our Twitter conversation, I am working towards getting this sorted out.

captureException & captureMessage return a result object which the user can make use of (displaying in templates etc), but for an unhandled exception the user has to make use of an error handler like so:

```
@app.errorhandler(500)
def handle_503(e):
return "Broken Yo'"
```

These changes allow you to create handlers like so:

```
@app.errorhandler(500)
def handle_503(e):
return "A Message was logged to Sentry. ID: %s" % g.sentry.get('id')
```

or even refer to them in a template

```
Sentry Message ID: {{ g.sentry.id }}
```

I still need to consider async clients (like how Django works), but what do you think of this for a start?