Commit 5348fa86 authored by 's avatar

Fixed a bug in notFoundError - the HTTP status code was never set to 404

for not found errors :(
parent ed30e915
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
############################################################################## ##############################################################################
'''CGI Response Output formatter '''CGI Response Output formatter
$Id: HTTPResponse.py,v 1.21 1999/09/23 22:01:50 jim Exp $''' $Id: HTTPResponse.py,v 1.22 1999/11/03 16:48:39 brian Exp $'''
__version__='$Revision: 1.21 $'[11:-2] __version__='$Revision: 1.22 $'[11:-2]
import string, types, sys, regex import string, types, sys, regex
from string import find, rfind, lower, upper, strip, split, join, translate from string import find, rfind, lower, upper, strip, split, join, translate
...@@ -505,6 +505,7 @@ class HTTPResponse(BaseResponse): ...@@ -505,6 +505,7 @@ class HTTPResponse(BaseResponse):
</HTML>""") </HTML>""")
def notFoundError(self,entry='who knows!'): def notFoundError(self,entry='who knows!'):
self.setStatus(404)
raise 'NotFound',self._error_html( raise 'NotFound',self._error_html(
"Resource not found", "Resource not found",
"Sorry, the requested Zope resource does not exist.<p>" + "Sorry, the requested Zope resource does not exist.<p>" +
...@@ -521,6 +522,7 @@ class HTTPResponse(BaseResponse): ...@@ -521,6 +522,7 @@ class HTTPResponse(BaseResponse):
"\n%s" % entry) "\n%s" % entry)
def badRequestError(self,name): def badRequestError(self,name):
self.setStatus(400)
if regex.match('^[A-Z_0-9]+$',name) >= 0: if regex.match('^[A-Z_0-9]+$',name) >= 0:
raise 'InternalError', self._error_html( raise 'InternalError', self._error_html(
"Internal Error", "Internal Error",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment