Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ErrorWrapper: send correct status code back to browser

Signed-off-by: Simon Willison <simon@simonwillison.net>
  • Loading branch information...
commit 4e118a8971df9678057c2d109b1a4f2e2a4817cb 1 parent a179c03
@peritus peritus authored Simon Willison committed
Showing with 6 additions and 6 deletions.
  1. +2 −2 djng/errors.py
  2. +2 −2 example_urls.py
  3. +2 −2 readme.txt
View
4 djng/errors.py
@@ -17,7 +17,7 @@ def __call__(self, request):
return response
def default_error_404(self, request):
- return Response('A 404 error occurred')
+ return Response('A 404 error occurred', status=404)
def default_error_500(self, request, e):
- return Response('A 500 error occurred: %r' % e)
+ return Response('A 500 error occurred: %r' % e, status=505)
View
4 example_urls.py
@@ -5,8 +5,8 @@
(r'^hello$', lambda request: djng.Response('Hello, world')),
(r'^goodbye$', lambda request: djng.Response('Goodbye, world')),
),
- custom_404 = lambda request: djng.Response('404 error'),
- custom_500 = lambda request: djng.Response('500 error')
+ custom_404 = lambda request: djng.Response('404 error', status=404),
+ custom_500 = lambda request: djng.Response('500 error', status=500)
)
if __name__ == '__main__':
View
4 readme.txt
@@ -27,8 +27,8 @@ Or if you want hello and goodbye URLs, and a custom 404 page:
(r'^hello$', lambda request: djng.Response('Hello, world')),
(r'^goodbye$', lambda request: djng.Response('Goodbye, world')),
),
- custom_404 = lambda request: djng.Response('404 error'),
- custom_500 = lambda request: djng.Response('500 error')
+ custom_404 = lambda request: djng.Response('404 error', status=404),
+ custom_500 = lambda request: djng.Response('500 error', status=500)
)
if __name__ == '__main__':
Please sign in to comment.
Something went wrong with that request. Please try again.