def add_route(app, fn):
    method = getattr(fn, '__method__', None)
    path = getattr(fn, '__route__', None)
    if ((path is None) or (method is None)):
        raise ValueError(('@get or @post not defined in %s.' % str(fn)))
    if ((not asyncio.iscoroutinefunction(fn)) and (not inspect.isgeneratorfunction(fn))):
        fn = asyncio.coroutine(fn)
    logging.info(('add route %s %s => %s(%s)' % (method, path, fn.__name__, ', '.join(inspect.signature(fn).parameters.keys()))))
    app.router.add_route(method, path, RequestHandler(app, fn))
def add_route(app, fn):
    method = getattr(fn, '__method__', None)
    path = getattr(fn, '__route__', None)
    if ((path is None) or (method is None)):
        raise ValueError(('@get or @post not defined in %s.' % str(fn)))
    if ((not asyncio.iscoroutinefunction(fn)) and (not inspect.isgeneratorfunction(fn))):
        fn = asyncio.coroutine(fn)
    logging.info(('add route %s %s => %s(%s)' % (method, path, fn.__name__, ', '.join(inspect.signature(fn).parameters.keys()))))
    app.router.add_route(method, path, RequestHandler(app, fn))