jgorset/django-respite — pull request #31 by timkurvers (2012-04-19 11:55:42+00:00)
Title: Error convenience method

Adds a convenience method for rendering error responses to views. This effectively allows one to replace ..

```python
self._render(
request = request,
template = '404',
context = {
'message': 'Object could not be found'
},
status = 404
)
```

.. with ..

```python
self._error(request, 404, message = 'Object could not be found')
```

For consistency sake, the additional keyword arguments provided will be available in the context under ``error``. The resulting JSON-response would look as follows:

```json
{"error": {"message": "Object could not be found"}}
```