#!C:\Python24\python.exe # **************************************** # +++ BioCASE # +++ pywrapper # # See http://www.biocase.org for details # # **************************************** import os, cgi # ***** include the biocase.lib directory in the python sys path for module importing ***** execfile( os.path.abspath(os.path.join(os.path.dirname( __file__ ), os.path.pardir, 'lib', 'biocase', 'adjustpath.py' ) ) ) import biocase.configuration from biocase.wrapper.pywrapper import pywrapper try: pywInstance = pywrapper('biocase') # # get datasource alias from GET querystring # if os.environ.has_key("QUERY_STRING"): QS = cgi.parse_qs( os.environ["QUERY_STRING"] ) pywInstance.logObj + (2, "Querystring analyzed by pywrapper.cgi directly: %s"%str(QS)) if QS.has_key('dsa'): dsa = QS['dsa'][0] elif QS.has_key('DSA'): dsa = QS['DSA'][0] elif QS.has_key('datasource'): dsa = QS['datasource'][0] else: raise "No Datasource alias given!" else: raise "No querystring given. Pass at least a datasource alias via dsa=XXX!" # # read the configuration files # # get global project configuration cfg = biocase.configuration.Cfg() # get PSF path PSFPath = os.path.join(cfg.datasourcesLocator, dsa, 'provider_setup_file.xml') # get LOG path logDir = os.path.join(cfg.logLocator) # set config directories pywInstance.readConfigFiles( PSFPath=PSFPath, logDir=logDir) # set datasource name for logging pywInstance.setDatasourceName(dsa) # create a request from CGI pywInstance.setRequest() # print the result to the screen pywInstance.printResponseString(httpHeader=1) except: try: pywInstance.logObj + ("Serious PyWrapper instance crash") pywInstance.printResponseString() except: print pywInstance.getFullLog(httpHeader=1)