startmod.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import os, sys
00004 
00005 from mod_python import apache
00006 
00007 env = {}
00008 
00009 def handler(req):
00010   env = apache.build_cgi_env(req)
00011 
00012   if os.path.exists("/etc/ros/env"):
00013     keys = os.listdir("/etc/ros/env/")
00014     for key in keys:
00015       if key not in os.environ:
00016         os.environ[key] = open("/etc/ros/env/%s" % key).read().strip()
00017 
00018   ros_root = os.environ['ROS_ROOT']
00019 
00020   roslib_src = os.path.join(ros_root, "core/roslib/src")
00021   if not roslib_src in sys.path:  
00022     sys.path.append(roslib_src)
00023 
00024   if os.environ['PATH'].find(ros_root) == -1:
00025     os.environ['PATH'] = os.path.join(ros_root, 'bin') + ":" + os.environ.get('PATH', '')
00026 
00027   os.environ['HOME'] = '/tmp'
00028   os.environ['ROS_CACHE_TIMEOUT'] = '3600'
00029 
00030   if env.get('PYTHON_RELOADER', '').lower() == 'on':
00031     from pyclearsilver import autoreloader
00032 
00033   import cgistarter
00034   import config
00035 
00036   #sys.stderr.write("path:" + os.getcwd())
00037   path,f = os.path.split(__file__)
00038   #sys.stderr.write("path: %s\n"  % path)
00039   cwd = path
00040   #os.chdir(path)
00041 
00042   cgistarter.setConfig(config)
00043   return cgistarter.handler(req, cwd)
00044 


webui
Author(s): Scott Hassan/hassan@willowgarage.com
autogenerated on Sat Dec 28 2013 17:47:58