Skip to content

Commit

Permalink
Adds get_search_folder_request.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdinunzio committed Feb 10, 2014
1 parent 65e8b04 commit 1194768
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 16 deletions.
32 changes: 27 additions & 5 deletions pyzimbra/soap_soappy.py
Expand Up @@ -76,16 +76,38 @@ def __init__(self, rules = None):
},
'GetMsgResponse': {
'm': {
's':{},
'd':{},
'rev':{},
'id':{},
's': {},
'd': {},
'rev': {},
'id': {},
'inv': {
'type': {},
'comp': {},
},
},
},
'GetFolderResponse': {
'folder': {
'id': {},
'name': {},
'absFolderPath': {},
'uuid': {},
'luuid': {},
'rev': {},
'i4next': {},
'i4ms': {},
'activesyncdisabled': {},
'l': {},
's': {},
'ms': {},
'n': {},
'folder': {
'folder': {
'folder': {},
},
},
},
},
}

SOAPpy.SOAPParser.__init__(self, rules)
Expand Down Expand Up @@ -191,7 +213,7 @@ def build_opener(self):
Builds url opener, initializing proxy.
@return: OpenerDirector
"""
http_handler = urllib2.HTTPHandler() # debuglevel=self.transport.debug
http_handler = urllib2.HTTPHandler()

if util.empty(self.transport.proxy_url):
return urllib2.build_opener(http_handler)
Expand Down
5 changes: 4 additions & 1 deletion pyzimbra/soap_transport.py
Expand Up @@ -49,7 +49,8 @@ def __init__(self):


# ------------------------------------------------------------------ unbound
def invoke(self, ns, request_name, params, auth_token, simplify=False):
def invoke(self, ns, request_name, params, auth_token, simplify=False,
methodattrs=None):
"""
Invokes zimbra soap request.
"""
Expand All @@ -62,6 +63,7 @@ def invoke(self, ns, request_name, params, auth_token, simplify=False):

headers = SOAPpy.Types.headerType()


if auth_token.token != None:
data={sconstant.E_AUTH_TOKEN: auth_token.token,
sconstant.E_SESSION_ID: auth_token.session_id}
Expand All @@ -74,6 +76,7 @@ def invoke(self, ns, request_name, params, auth_token, simplify=False):
ns,
header=headers,
noroot=1,
methodattrs=methodattrs,
simplify_objects=simplify)
proxy.config.debug = self.log.isEnabledFor(logging.DEBUG)
proxy.config.strictNamespaces = 0
Expand Down
20 changes: 16 additions & 4 deletions pyzimbra/z/client.py
Expand Up @@ -2,22 +2,22 @@
"""
################################################################################
# Copyright (c) 2010, Ilgar Mashayev
#
#
# E-mail: pyzimbra@lab.az
# Website: http://github.com/ilgarm/pyzimbra
################################################################################
# This file is part of pyzimbra.
#
#
# Pyzimbra is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# Pyzimbra is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyzimbra. If not, see <http://www.gnu.org/licenses/>.
################################################################################
Expand Down Expand Up @@ -101,3 +101,15 @@ def get_info(self, params={}):
params)

return res


def get_search_folder_request(self, attrs={}, methodattrs=None):
l = SOAPpy.Types.untypedType(data='', attrs=attrs)
params = {'folder': l}

res = self.invoke(zconstant.NS_ZIMBRA_MAIL_URL,
'GetFolderRequest',
params,
methodattrs=methodattrs)

return res
7 changes: 5 additions & 2 deletions pyzimbra/zclient.py
Expand Up @@ -64,12 +64,14 @@ def __init__(self, soap_url, domains={}, proxy_url=None):


# ------------------------------------------------------------------ unbound
def invoke(self, ns, request_name, params={}, simplify=False):
def invoke(self, ns, request_name, params={}, simplify=False,
methodattrs=None):
"""
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
@param methodattrs: attributes of the method
@return: zimbra response
@raise AuthException: if authentication fails
@raise SoapException: wrapped server exception
Expand All @@ -84,7 +86,8 @@ def invoke(self, ns, request_name, params={}, simplify=False):
request_name,
params,
self.auth_token,
simplify)
simplify,
methodattrs)


@abc.abstractmethod
Expand Down
13 changes: 9 additions & 4 deletions pyzimbra/zconstant.py
Expand Up @@ -2,22 +2,22 @@
"""
################################################################################
# Copyright (c) 2010, Ilgar Mashayev
#
#
# E-mail: pyzimbra@lab.az
# Website: http://github.com/ilgarm/pyzimbra
################################################################################
# This file is part of pyzimbra.
#
#
# Pyzimbra is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# Pyzimbra is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyzimbra. If not, see <http://www.gnu.org/licenses/>.
################################################################################
Expand Down Expand Up @@ -49,3 +49,8 @@
NS_ZIMBRA_ADMIN_URL = 'urn:zimbraAdmin'
NS_ZIMBRA_ACC_MAP = {None: NS_ZIMBRA_ADMIN_URL}
NS_ZIMBRA_ACC = '{%s}' % NS_ZIMBRA_ADMIN_URL

NS_ZIMBRA_MAIL_URL = 'urn:zimbraMail'
NS_ZIMBRA_MAIL_MAP = {None: NS_ZIMBRA_ACC_URL}
NS_ZIMBRA_MAIL = '{%s}' % NS_ZIMBRA_ACC_URL

0 comments on commit 1194768

Please sign in to comment.