Example #1
0
def _process_async_call(f, args):
    ''' Process an asynchronous action call and automatically format the response '''
    try:
        res = f(**args)
        data = res if res is not None else {}
        json_resp = format_async_response(data)
    except cherrypy.HTTPError, e:
        raise e
Example #2
0
        return res
    ret_f = wrapper
    ret_f.exposed = True
    return ret_f     

def _process_async_call(f, args):
    ''' Process an asynchronous action call and automatically format the response '''
    try:
        res = f(**args)
        data = res if res is not None else {}
        json_resp = format_async_response(data)
    except cherrypy.HTTPError, e:
        raise e
    except Exception, e:
        Logger.error("Error while processing call to %s" % f.__name__, e)
        json_resp = format_async_response(None, False, e)
    if Config.is_dev():
        Logger.debug("Async response to %s: %s" % (f.__name__, json_resp))
    return json_resp


##  CONTROLLER  #################################

class BaseController(object):
    ''' Base controller
    Abstract base for all controllers.
    Contains all sorts of helpers and structures that may be needed in controllers.
    '''
    
    instances = dict()
    web_dir = None