Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Return 404 code/status on NotFound #22

Merged
merged 1 commit into from

2 participants

@kkolev

Currently tasks.py is returning '200 OK' on NotFound exceptions, and I figured we want to be compliant from the start by returning a 404 :-)

I used the docs for Pyramid 1.3 [1] for the tweak, but I'm not certain if there's a better way to do this.

[1] http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/renderers.html#varying-attributes-of-rendered-responses

@tseaver tseaver merged commit 76803de into from
@tseaver
Owner

Thanks very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 10, 2013
  1. @kkolev
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  single_file_tasks/src/tasks.py
View
3  single_file_tasks/src/tasks.py
@@ -53,7 +53,8 @@ def close_view(request):
@view_config(context='pyramid.exceptions.NotFound', renderer='notfound.mako')
-def notfound_view(self):
+def notfound_view(request):
+ request.response.status = '404 Not Found'
return {}
Something went wrong with that request. Please try again.