temboardagent/api_wrapper.py
def api_function_wrapper(config, http_context, sessions, module,
                         function_name):
    """
    API function wrapper in charge of:
        - instanciating a new logger;
        - check the user session id;
        - call the function 'function_name' from 'module_name' module and
          return its result;
    """
    logger.debug("Calling %s.%s()." % (module.__name__, function_name,))
    logger.debug(http_context)

    try:
        username = check_sessionid(http_context['headers'], sessions)
        http_context['username'] = username
        dm = getattr(module, function_name)(config, http_context)
        logger.debug("Done.")
        return dm

    except (Exception, HTTPError) as e:
        logger.exception(str(e))
        logger.debug("Failed.")
        if isinstance(e, HTTPError):
            raise e
        else:
            raise HTTPError(500, "Internal error.")

    API function wrapper in charge of:
        - instanciating a new logger;
        - check the user session id;
        - call the function 'function_name' from 'module_name' module and
          return its result;
    
API function wrapper in charge of:
instanciating a new logger;
check the user session id;
call the function 'function_name' from 'module_name' module and
return its result.
API function wrapper in charge of : instanciating a new logger ; check the user session id ; call the function ' function_name ' from ' module_name ' module and return its result .
def api_function_wrapper(config, http_context, sessions, module,
                         function_name):
    logger.debug("Calling %s.%s()." % (module.__name__, function_name,))
    logger.debug(http_context)
    try:
        username = check_sessionid(http_context['headers'], sessions)
        http_context['username'] = username
        dm = getattr(module, function_name)(config, http_context)
        logger.debug("Done.")
        return dm
    except (Exception, HTTPError) as e:
        logger.exception(str(e))
        logger.debug("Failed.")
        if isinstance(e, HTTPError):
            raise e
        else:
            raise HTTPError(500, "Internal error.")
def api_function_wrapper ( config , http_context , sessions , module , function_name ) : logger . debug ( "Calling %s.%s()." % ( module . __name__ , function_name , ) ) logger . debug ( http_context ) try : username = check_sessionid ( http_context [ 'headers' ] , sessions ) http_context [ 'username' ] = username dm = getattr ( module , function_name ) ( config , http_context ) logger . debug ( "Done." ) return dm except ( Exception , HTTPError ) as e : logger . exception ( str ( e ) ) logger . debug ( "Failed." ) if isinstance ( e , HTTPError ) : raise e else : raise HTTPError ( 500 , "Internal error." )
API function wrapper in charge of:
 instanciating a new logger;
 check the user session id;
 call the function 'function_name' from 'module_name' module and
return its result;
API function wrapper in charge of : instanciating a new logger ; check the user session id ; call the function ' function_name ' from ' module_name ' module and return its result ;
"""
    API function wrapper in charge of:
        - instanciating a new logger;
        - check the user session id;
        - call the function 'function_name' from 'module_name' module and
          return its result;
    """
config
http_context
sessions
module
function_name