web/application.py
changeset 9727 33f6ad4c75a5
parent 9659 c45073a96aee
child 9728 f79ce7b39ee9
equal deleted inserted replaced
9726:8905267dc7ae 9727:33f6ad4c75a5
   579     def ajax_error_handler(self, req, ex):
   579     def ajax_error_handler(self, req, ex):
   580         req.set_header('content-type', 'application/json')
   580         req.set_header('content-type', 'application/json')
   581         status = httplib.INTERNAL_SERVER_ERROR
   581         status = httplib.INTERNAL_SERVER_ERROR
   582         if isinstance(ex, PublishException) and ex.status is not None:
   582         if isinstance(ex, PublishException) and ex.status is not None:
   583             status = ex.status
   583             status = ex.status
   584         req.status_out = status
   584         if req.status_out < 400:
       
   585             # don't overwrite it if it's already set
       
   586             req.status_out = status
   585         json_dumper = getattr(ex, 'dumps', lambda : unicode(ex))
   587         json_dumper = getattr(ex, 'dumps', lambda : unicode(ex))
   586         return json_dumper()
   588         return json_dumper()
   587 
   589 
   588     # special case handling
   590     # special case handling
   589 
   591