From c5d872df6c7e58bd56c55ff1ed70b1bbdc3d50c6 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sat, 4 Apr 2009 09:42:14 +0000 Subject: [PATCH] suppress logging for 403, No_Access; strip excess path elements from baseURL git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3325 fd906abe-77d9-0310-91a1-e0d9ade77398 --- integrator/bscw.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/integrator/bscw.py b/integrator/bscw.py index c2423d9..600eb4c 100644 --- a/integrator/bscw.py +++ b/integrator/bscw.py @@ -81,16 +81,23 @@ class BSCWConnection(object): def setURLs(self): url = self.getRepositoryURL() if url: - self.baseURL, self.rootId = url.rsplit('/', 1) + baseURL, self.rootId = url.rsplit('/', 1) + self.baseURL = baseURL.split('/bscw.cgi', 1)[0] + '/bscw.cgi' def getItem(self, address, nested=True): try: item = self.server.get_attributes(address, standardAttributes, 1, nested) except Fault, excp: - logging.getLogger('cybertools.integrator.bscw').warn(str(excp)) item = None + excpInfo = str(excp) + if "No permission: (403, 'No_Access')" in excpInfo: + pass + else: + info = '%s - server: %s, address: %s.' % (excpInfo, self.server, address) + logging.getLogger('cybertools.integrator.bscw').warn(info) except Exception, excp: - logging.getLogger('cybertools.integrator.bscw').error(str(excp)) + info = '%s - server: %s, address: %s.' % (excpInfo, self.server, address) + logging.getLogger('cybertools.integrator.bscw').error(info) item = None return item @@ -236,10 +243,14 @@ class File(BSCWProxyBase, File): try: data = self.connection.server.get_document(self.address).data except Fault, excp: - logging.getLogger('cybertools.integrator.bscw').warn(str(excp)) + info = '%s - server: %s, address: %s.' % ( + str(excp), self.connection.server, self.address) + logging.getLogger('cybertools.integrator.bscw').warn(info) data = '' except Exception, excp: - logging.getLogger('cybertools.integrator.bscw').error(str(excp)) + info = '%s - server: %s, address: %s.' % ( + str(excp), self.connection.server, self.address) + logging.getLogger('cybertools.integrator.bscw').error(info) data = '' return data data = property(getData)