home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.3)
-
- import apache
- import imp
- import os
- import sys
-
- try:
- import threading
- _lock = threading.Lock()
- except (ImportError, AttributeError):
-
- class DummyLock:
-
- def acquire(self):
- pass
-
-
- def release(self):
- pass
-
-
- _lock = DummyLock()
-
- os.environ = { }
- original = sys.modules.keys()
- (stdlib, x) = os.path.split(os.__file__)
-
- def handler(req):
- for m in sys.modules.keys():
- if m not in original:
- mod = sys.modules[m]
- if hasattr(mod, '__file__'):
- (path, x) = os.path.split(mod.__file__)
- if path != stdlib:
- del sys.modules[m]
-
-
- hasattr(mod, '__file__')
-
- if req.subprocess_env.has_key('script_filename'):
- (dir, file) = os.path.split(req.subprocess_env['script_filename'])
- else:
- (dir, file) = os.path.split(req.filename)
- (module_name, ext) = os.path.splitext(file)
- _lock.acquire()
-
- try:
-
- try:
- cwd = os.getcwd()
- os.chdir(dir)
- (env, si, so) = apache.setup_cgi(req)
-
- try:
- (fd, path, desc) = imp.find_module(module_name, [
- dir])
- except ImportError:
- raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
-
- imp.load_module(module_name, fd, path, desc)
- return apache.OK
- finally:
- apache.restore_nocgi(env, si, so)
-
- try:
- fd.close()
- except:
- pass
-
- os.chdir(cwd)
-
- finally:
- _lock.release()
-
-
-