#!C:\Program Files\Python27\python.exe # -*- coding: UTF-8 -*- import os, sys, ssl # set path to lib and import sys.path.insert(0, os.path.abspath("../rw_common")) from lib import getRecordSet, ssi_to_tempfile from templating import PageMacro # Get schemalist from DB; page through and retrieve concept list schemas = getRecordSet("""SELECT * FROM registry.used_schemas ORDER BY num_datasources DESC""") schemalist = [] for id, ns, num_ds in schemas: rs = getRecordSet("""SELECT num_datasources, concept_path FROM registry.used_concepts WHERE schema_id = %i ORDER BY num_datasources DESC, concept_path ASC""" % id) l = ''.join(["
  • %ix %s
  • " % (cnt, p) for cnt, p in rs]) schemalist += [{'id': str(id), 'namespace': ns, 'num_datasources': str(num_ds), 'concept_list': l}] # load html template and fill in data tmpl = PageMacro('Content', PageMacro.DELMODE) ssl._create_default_https_context = ssl._create_unverified_context temp = ssi_to_tempfile("https://www.biocase.org/whats_biocase/_concept_survey.shtml") tmpl.load('Content', temp) tmpl.expand('Content', 'schemalist', schemalist) tmpl.expand('Content', 'schemaoverview', schemalist) # print HTML print "Content-Type: text/html\n" print tmpl os.remove(temp)