#!c:\Program Files\Python39\python.exe # -*- coding: Latin-1 -*- # ***** include the biocase.lib directory in the python sys path for importing ***** import os exec(open(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir, os.path.pardir, 'lib', 'biocase', 'adjustpath.py'))).read()) import cgitb; cgitb.enable() import biocase.configuration from biocase.tools.templating import PageMacro from biocase.datasources import getDsaList cfg = biocase.configuration.Cfg() # read template tmpl = PageMacro('Content', PageMacro.DELMODE) tmpl.load('Content', os.path.join(cfg.wwwLocator,'utilities','queryforms','_index.html') ) # get available datasources dsalist_data=[] for dsaObj in getDsaList(): # check for all SPICE CMFs spice={} spice['http://www.sp2000.org/CDMSchema1.3'] = False for cmfObj in dsaObj.getSchemaListObj(): for spiceNS in list(spice.keys()): if cmfObj.NS == spiceNS: del spice[spiceNS] dsa_data = {} dsa_data['dsa'] = dsaObj.name dsa_data['url_biocase']= dsaObj.getBioCASeAccessPoint() if len(spice) == 0: spice='SPICE' %( dsaObj.getSPICEAccessPoint() ) else: spice='SPICE' dsa_data['spice'] = spice dsalist_data.append( dsa_data ) # fill template with dsa list tmpl.expand('Content', 'dsa_list', dsalist_data) # # print HTML # print('Content-Type: text/html; charset=utf-8\n\n') print(str(tmpl))