[pypy-svn] r41401 - pypy/dist/pypy/translator/js/lib

fijal at codespeak.net fijal at codespeak.net
Mon Mar 26 17:51:48 CEST 2007


Author: fijal
Date: Mon Mar 26 17:51:45 2007
New Revision: 41401

Modified:
   pypy/dist/pypy/translator/js/lib/server.py
Log:
Fix error codes


Modified: pypy/dist/pypy/translator/js/lib/server.py
==============================================================================
--- pypy/dist/pypy/translator/js/lib/server.py	(original)
+++ pypy/dist/pypy/translator/js/lib/server.py	Mon Mar 26 17:51:45 2007
@@ -360,12 +360,14 @@
     def process_http_error(self, e):
         """ create the response body and headers for errors
         """
-        headers = {'Content-Type': 'text/plain'} # XXX need more headers here?
+        headers = {'Content-Type': 'text/html'} # XXX need more headers here?
         if e.status in [301, 302]:
             headers['Location'] = e.data
             body = 'Redirecting to %s' % (e.data,)
         else:
-            body = 'Error: %s (%s)' % (e.status, e.message)
+            message, explain = self.responses[e.status]
+            body = self.error_message_format % {'code': e.status, 'message': message,
+                                                'explain': explain}
         return headers, body
     
     def response(self, status, headers, body, send_body=True):



More information about the Pypy-commit mailing list