[web/ajax] don't override any status code with 500 in ajax_error_handler
If the request produced an error such as Unauthorized or NotFound,
core_handle sets an appropriate status_out. Which is then overridden by
the ajax error handler.
--- a/web/application.py Fri Mar 14 11:11:28 2014 +0100
+++ b/web/application.py Thu Mar 13 17:01:58 2014 +0100
@@ -581,7 +581,9 @@
status = httplib.INTERNAL_SERVER_ERROR
if isinstance(ex, PublishException) and ex.status is not None:
status = ex.status
- req.status_out = status
+ if req.status_out < 400:
+ # don't overwrite it if it's already set
+ req.status_out = status
json_dumper = getattr(ex, 'dumps', lambda : unicode(ex))
return json_dumper()