diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-11-26 11:51:24 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-11-26 11:51:24 -0500 |
commit | 2208af0e78dc9e659842f6552e21c441df340b71 (patch) | |
tree | 9360f524bb7cd221c7f75e373456a4fe59f4ebfa /scripts | |
parent | fc362dac0ae1c820c0b4d7f84d5c0e963b66cc67 (diff) | |
download | cobbler-2208af0e78dc9e659842f6552e21c441df340b71.tar.gz cobbler-2208af0e78dc9e659842f6552e21c441df340b71.tar.xz cobbler-2208af0e78dc9e659842f6552e21c441df340b71.zip |
Make the services engine return proper HTTP error codes for obvious tracebacks and not founds. Working on the same for the web app.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/index.py | 8 | ||||
-rwxr-xr-x | scripts/services.py | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/scripts/index.py b/scripts/index.py index ee2755b8..c13fa22a 100755 --- a/scripts/index.py +++ b/scripts/index.py @@ -131,8 +131,12 @@ def handler(req): req.content_type = "text/html;charset=utf-8" req.write(unicode(content).encode('utf-8')) - return apache.OK - + if not content.startswith("# ERROR") and content.find("<!-- ERROR -->") == -1: + return apache.OK + else: + # catch Cheetah errors and web errors + return apache.HTTP_ERROR + #====================================================== def authenhandler(req): diff --git a/scripts/services.py b/scripts/services.py index 97a6f89c..4b77b2da 100755 --- a/scripts/services.py +++ b/scripts/services.py @@ -88,7 +88,14 @@ def handler(req): # apache.log_error("%s:%s ... %s" % (my_user, my_uri, str(form))) req.content_type = "text/plain;charset=utf-8" content = unicode(content).encode('utf-8') - req.write(content) - return apache.OK + if content.find("# *** ERROR ***") != -1: + req.write(content) + return apache.HTTP_ERROR + elif content.find("# profile not found") != -1 or content.find("# system not found") != -1: + req.content_type = "text/html;charset=utf-8" + return apache.HTTP_NOT_FOUND + else: + req.write(content) + return apache.HTTP_OK |