def register_hooks(app):
 from .utils.user import get_current_user
 @app.before_request
 def load_current_user():
  g.user = get_current_user()
  if (g.user and g.user.is_staff):
   g._before_request_time = time.time()
 @app.after_request
 def rendering_time(response):
  if hasattr(g, '_before_request_time'):
   delta = (time.time() - g._before_request_time)
   response.headers['X-Render-Time'] = (delta * 1000)
  return response

def register_hooks ( app ) : from . utils . user import get_current_user @ app . before_request def load_current_user ( ) : g . user = get_current_user ( ) if ( g . user and g . user . is_staff ) : g . _before_request_time = time . time ( ) @ app . after_request def rendering_time ( response ) : if hasattr ( g , '_before_request_time' ) : delta = ( time . time ( ) - g . _before_request_time ) response . headers [ 'X-Render-Time' ] = ( delta * 1000 ) return response
register all known non-plugin hooks .