def require_user_id_else_redirect_to_homepage(handler):
 def test_login(self, **kwargs):
  'Checks if the user for the current session is logged in.\n\n        If not, redirects the user to the home page.\n        '
  if (not self.user_id):
   self.redirect('/')
   return
  return handler(self, **kwargs)
 return test_login

def require_user_id_else_redirect_to_homepage ( handler ) : def test_login ( self , ** kwargs ) : if ( not self . user_id ) : self . redirect ( '/' ) return return handler ( self , ** kwargs ) return test_login
decorator that checks if a user_id is associated to the current session .