示例#1
0
文件: rapi.py 项目: azet/ganeti
  def __init__(self, authenticator, reqauth, _client_cls=None):
    """Initializes this class.

    @type authenticator: an implementation of {RapiAuthenticator} interface
    @param authenticator: a class containing an implementation of
                          ValidateRequest function
    @type reqauth: bool
    @param reqauth: Whether to require authentication

    """
    # pylint: disable=W0233
    # it seems pylint doesn't see the second parent class there
    http.server.HttpServerHandler.__init__(self)
    http.auth.HttpServerRequestAuthentication.__init__(self)
    self._client_cls = _client_cls
    self._resmap = connector.Mapper()
    self._authenticator = authenticator
    self._reqauth = reqauth
示例#2
0
    def __init__(self, user_fn, reqauth, _client_cls=None):
        """Initializes this class.

    @type user_fn: callable
    @param user_fn: Function receiving username as string and returning
      L{http.auth.PasswordFileUser} or C{None} if user is not found
    @type reqauth: bool
    @param reqauth: Whether to require authentication

    """
        # pylint: disable=W0233
        # it seems pylint doesn't see the second parent class there
        http.server.HttpServerHandler.__init__(self)
        http.auth.HttpServerRequestAuthentication.__init__(self)
        self._client_cls = _client_cls
        self._resmap = connector.Mapper()
        self._user_fn = user_fn
        self._reqauth = reqauth
示例#3
0
 def setUp(self):
   self.map = connector.Mapper()