示例#1
0
文件: soap.py 项目: vipod/pyzimbra
    def __init__(self, message, cause=None):
        ZimbraClientException.__init__(self, message, cause)

        self.code = None
        self.trace = None

        if cause != None and isinstance(cause, urllib2.HTTPError):
            self.code = cause.code
示例#2
0
    def __init__(self, message, cause = None):
        ZimbraClientException.__init__(self, message, cause)

        self.code = None
        self.trace = None

        if cause != None and isinstance(cause, urllib2.HTTPError):
            self.code = cause.code
示例#3
0
文件: auth.py 项目: vipod/pyzimbra
    def authenticate(self, transport, account_name, password):
        """
        Authenticates account, if no password given tries to pre-authenticate.
        @param transport: transport to use for method calls
        @param account_name: account name
        @param password: account password
        @return: AuthToken if authentication succeeded
        @raise AuthException: if authentication fails
        """
        if not isinstance(transport, ZimbraClientTransport):
            raise ZimbraClientException('Invalid transport')

        if util.empty(account_name):
            raise AuthException('Empty account name')
示例#4
0
    def invoke(self, ns, request_name, params={}, simplify=False):
        """
        Invokes zimbra method using established authentication session.
        @param req: zimbra request
        @parm params: request params
        @param simplify: True to return python object, False to return xml struct
        @return: zimbra response
        @raise AuthException: if authentication fails
        @raise SoapException: wrapped server exception
        """
        if self.auth_token == None:
            raise AuthException('Unable to invoke zimbra method')

        if util.empty(request_name):
            raise ZimbraClientException('Invalid request')

        return self.transport.invoke(ns,
                                     request_name,
                                     params,
                                     self.auth_token,
                                     simplify)
示例#5
0
文件: auth.py 项目: vipod/pyzimbra
 def __init__(self, message, cause = None):
     ZimbraClientException.__init__(self, message, cause)