def require_user(handler):
 def test_login(self, **kwargs):
  'Checks if the user for the current session is logged in.'
  if (not self.user_id):
   self.redirect(current_user_services.create_login_url(self.request.uri))
   return
  return handler(self, **kwargs)
 return test_login

def require_user ( handler ) : def test_login ( self , ** kwargs ) : if ( not self . user_id ) : self . redirect ( current_user_services . create_login_url ( self . request . uri ) ) return return handler ( self , ** kwargs ) return test_login
decorator that checks if a user is associated to the current session .