def require_moderator(handler):
 def test_is_moderator(self, **kwargs):
  'Check that the user is a moderator.'
  if (not self.user_id):
   self.redirect(current_user_services.create_login_url(self.request.uri))
   return
  if (not rights_manager.Actor(self.user_id).is_moderator()):
   raise self.UnauthorizedUserException('You do not have the credentials to access this page.')
  return handler(self, **kwargs)
 return test_is_moderator

def require_moderator ( handler ) : def test_is_moderator ( self , ** kwargs ) : if ( not self . user_id ) : self . redirect ( current_user_services . create_login_url ( self . request . uri ) ) return if ( not rights_manager . Actor ( self . user_id ) . is_moderator ( ) ) : raise self . UnauthorizedUserException ( 'You do not have the credentials to access this page.' ) return handler ( self , ** kwargs ) return test_is_moderator
decorator that checks if the current user is a moderator .