$NetBSD$

--- lib/python/mod_python/cgihandler.py.orig	2000-12-05 22:05:37.000000000 -0500
+++ lib/python/mod_python/cgihandler.py
@@ -108,6 +108,7 @@
             # thread safe, this is why we must obtain the lock.
             cwd = os.getcwd()
             os.chdir(dir)
+            sys.path.append (dir)
 
             # simulate cgi environment
             env, si, so = apache.setup_cgi(req)
@@ -119,7 +120,9 @@
                 raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
 
             # this executes the module
-            imp.load_module(module_name, fd, path, desc)
+            try: imp.load_module(module_name, fd, path, desc)
+            except SystemExit, e:
+                if not e or not e.args or e.args[0]: raise
 
             return apache.OK
 
