#!/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
# -*- coding: Latin-1 -*-

# ***** include the biocase.lib directory in the python sys path for importing *****
import os, sys
execfile( os.path.abspath(os.path.join(os.path.dirname( __file__ ), os.path.pardir, os.path.pardir, os.path.pardir, 'lib', 'biocase', 'adjustpath.py' ) ) )

import cgitb; cgitb.enable()
import cgi
import biocase.configuration
from biocase.tools.templating import PageMacro

cfg = biocase.configuration.Cfg()

# read template
tmpl = PageMacro('Content', PageMacro.DELMODE)
tmpl.load('Content', os.path.join(cfg.wwwLocator,'utilities','queryforms','_qf_spice.html') )

# get wrapper url
form = cgi.FieldStorage()
if form.has_key('url'):
    wrapper_url = form.getfirst('url')
else:
    raise "No wrapper URL found!"

# fill template with url
tmpl['wrapper_url']=wrapper_url


#
# print HTML
#
print 'Content-Type: text/html; charset=utf-8\n\n'
print str(tmpl)



