def test_profile_is_noop(monkeypatch): monkeypatch.setitem(config['cherrypy'], 'profiling.on', False) profiled = profile(some_function) assert profiled is some_function monkeypatch.setitem(config['cherrypy'], 'profiling.on', True) profiled = profile(some_function) assert profiled is not some_function
def set_renderable(func, public): """ Return a function that is flagged correctly and is ready to be called by cherrypy as a request """ func.public = getattr(func, 'public', public) new_func = profile(timed(cached_page(sessionized(restricted(renderable(func)))))) new_func.exposed = True return new_func
def set_renderable(func, access): """ Return a function that is flagged correctly and is ready to be called by cherrypy as a request """ func.restricted = getattr(func, 'restricted', access) new_func = profile(timed(cached_page(sessionized(restricted(renderable(func)))))) new_func.exposed = True return new_func