'The @app.bind(name) decorator binds the given function to a keyword argument
that can be used with @app.route() handlers.
The return value is stored thread-safe in app.thread.[name] & g.[name].
The return value is available in handlers as a keyword argument [name].'

def bind(self, name='db'):

    def decorator(handler):
        f = (lambda : setattr(g, name, handler()))
        f()
        self.thread(START)(f)
        return handler
    return decorator
