kml/kmlcgi.py
changeset 0 bb616224c02a
equal deleted inserted replaced
-1:000000000000 0:bb616224c02a
       
     1 #!/usr/bin/python3
       
     2 # coding=utf8
       
     3 
       
     4 import sys
       
     5 import os
       
     6 import time
       
     7 import config
       
     8 import hh_http
       
     9 import flyby
       
    10 from kml import deb
       
    11 
       
    12 # for s in ('PYTHONIOENCODING', 'LC_ALL'):
       
    13 # 	if s in os.environ:
       
    14 # 		deb(os.environ[s])
       
    15 # for s in os.environ:
       
    16 #     deb('ENV[{}]={}'.format(s, os.environ[s]))
       
    17 
       
    18 if(not 'HTTP_HOST' in os.environ):
       
    19     sys.exit(1)
       
    20 c = config.Config()
       
    21 h = hh_http.Http(c)
       
    22 fl = flyby.Flyby(c)
       
    23 if c.configReq:             	# on config request (...kml...) configure tour
       
    24     if h.parsehttp(''):			# syntax OK
       
    25         fl.tour()				# generate Google Earth tour
       
    26         h.sendform(confirm=True)
       
    27     else:
       
    28         h.sendform(confirm=False)
       
    29 elif c.dnldReq:	                # on download request (...flyby...) send KML-file
       
    30     h.sendfile(c.kmlfile)