def cgiHandler(environ, config='./tilestache.cfg', debug=False):
 if debug:
  import cgitb
  cgitb.enable()
 path_info = environ.get('PATH_INFO', None)
 query_string = environ.get('QUERY_STRING', None)
 script_name = environ.get('SCRIPT_NAME', None)
 (status_code, headers, content) = requestHandler2(config, path_info, query_string, script_name)
 headers.setdefault('Content-Length', str(len(content)))
 stdout.write(('Status: %d\n' % status_code))
 for (k, v) in headers.items():
  stdout.write(('%s: %s\n' % (k, v)))
 stdout.write('\n')
 stdout.write(content)

def cgiHandler ( environ , config = './tilestache.cfg' , debug = False ) : if debug : import cgitb cgitb . enable ( ) path_info = environ . get ( 'PATH_INFO' , None ) query_string = environ . get ( 'QUERY_STRING' , None ) script_name = environ . get ( 'SCRIPT_NAME' , None ) ( status_code , headers , content ) = requestHandler2 ( config , path_info , query_string , script_name ) headers . setdefault ( 'Content-Length' , str ( len ( content ) ) ) stdout . write ( ( 'Status: %d\n' % status_code ) ) for ( k , v ) in headers . items ( ) : stdout . write ( ( '%s: %s\n' % ( k , v ) ) ) stdout . write ( '\n' ) stdout . write ( content )
read environment path_info .