def HandleRequest(unused_environ, handler_name, unused_url, post_data, unused_error, application_root, python_lib, import_hook=None):
 body = cStringIO.StringIO()
 module_name = _FileToModuleName(handler_name)
 (parent_module, _, submodule_name) = module_name.rpartition('.')
 parent_module = _GetModuleOrNone(parent_module)
 main = None
 if (module_name in sys.modules):
  module = sys.modules[module_name]
  main = _GetValidMain(module)
 if (not main):
  module = imp.new_module('__main__')
  if (import_hook is not None):
   module.__loader__ = import_hook
 saved_streams = (sys.stdin, sys.stdout)
 try:
  sys.modules['__main__'] = module
  module.__dict__['__name__'] = '__main__'
  sys.stdin = post_data
  sys.stdout = body
  if main:
   os.environ['PATH_TRANSLATED'] = module.__file__
   main()
  else:
   filename = _AbsolutePath(handler_name, application_root, python_lib)
   if filename.endswith((os.sep + '__init__.py')):
    module.__path__ = [os.path.dirname(filename)]
   if (import_hook is None):
    (code, filename) = _LoadModuleCode(filename)
   else:
    code = import_hook.get_code(module_name)
   if (not code):
    return {'error': 2}
   os.environ['PATH_TRANSLATED'] = filename
   module.__file__ = filename
   try:
    sys.modules[module_name] = module
    eval(code, module.__dict__)
   except:
    del sys.modules[module_name]
    if (parent_module and (submodule_name in parent_module.__dict__)):
     del parent_module.__dict__[submodule_name]
    raise
   else:
    if parent_module:
     parent_module.__dict__[submodule_name] = module
  return _ParseResponse(body)
 except:
  exception = sys.exc_info()
  message = ''.join(traceback.format_exception(exception[0], exception[1], exception[2].tb_next))
  logging.error(message)
  return {'error': 1}
 finally:
  (sys.stdin, sys.stdout) = saved_streams
  module.__name__ = module_name
  if ('__main__' in sys.modules):
   del sys.modules['__main__']

def HandleRequest ( unused_environ , handler_name , unused_url , post_data , unused_error , application_root , python_lib , import_hook = None ) : body = cStringIO . StringIO ( ) module_name = _FileToModuleName ( handler_name ) ( parent_module , _ , submodule_name ) = module_name . rpartition ( '.' ) parent_module = _GetModuleOrNone ( parent_module ) main = None if ( module_name in sys . modules ) : module = sys . modules [ module_name ] main = _GetValidMain ( module ) if ( not main ) : module = imp . new_module ( '__main__' ) if ( import_hook is not None ) : module . __loader__ = import_hook saved_streams = ( sys . stdin , sys . stdout ) try : sys . modules [ '__main__' ] = module module . __dict__ [ '__name__' ] = '__main__' sys . stdin = post_data sys . stdout = body if main : os . environ [ 'PATH_TRANSLATED' ] = module . __file__ main ( ) else : filename = _AbsolutePath ( handler_name , application_root , python_lib ) if filename . endswith ( ( os . sep + '__init__.py' ) ) : module . __path__ = [ os . path . dirname ( filename ) ] if ( import_hook is None ) : ( code , filename ) = _LoadModuleCode ( filename ) else : code = import_hook . get_code ( module_name ) if ( not code ) : return { 'error' : 2 } os . environ [ 'PATH_TRANSLATED' ] = filename module . __file__ = filename try : sys . modules [ module_name ] = module eval ( code , module . __dict__ ) except : del sys . modules [ module_name ] if ( parent_module and ( submodule_name in parent_module . __dict__ ) ) : del parent_module . __dict__ [ submodule_name ] raise else : if parent_module : parent_module . __dict__ [ submodule_name ] = module return _ParseResponse ( body ) except : exception = sys . exc_info ( ) message = '' . join ( traceback . format_exception ( exception [ 0 ] , exception [ 1 ] , exception [ 2 ] . tb_next ) ) logging . error ( message ) return { 'error' : 1 } finally : ( sys . stdin , sys . stdout ) = saved_streams module . __name__ = module_name if ( '__main__' in sys . modules ) : del sys . modules [ '__main__' ]
handle a single wsgi request .