--- documentViewer/documentViewer.py 2010/06/14 10:49:48 1.69.2.1 +++ documentViewer/documentViewer.py 2010/06/16 16:38:17 1.69.2.2 @@ -266,7 +266,7 @@ class documentViewer(Folder, extraFuncti params[param] = str(val) # quote values and assemble into query string - logging.info("XYXXXXX: %s"%repr(params.items())) + logging.debug("XYXXXXX: %s"%repr(params.items())) ps = "&".join(["%s=%s"%(k,urllib.quote(v)) for (k, v) in params.items()]) url=self.REQUEST['URL1']+"?"+ps return url @@ -285,9 +285,9 @@ class documentViewer(Folder, extraFuncti def isAccessible(self, docinfo): """returns if access to the resource is granted""" access = docinfo.get('accessType', None) - logger("documentViewer (accessOK)", logging.INFO, "access type %s"%access) + logging.debug("documentViewer (accessOK) access type %s"%access) if access is not None and access == 'free': - logger("documentViewer (accessOK)", logging.INFO, "access is free") + logging.debug("documentViewer (accessOK) access is free") return True elif access is None or access in self.authgroups: # only local access -- only logged in users @@ -298,7 +298,7 @@ class documentViewer(Folder, extraFuncti else: return False - logger("documentViewer (accessOK)", logging.INFO, "unknown access type %s"%access) + logging.debug("documentViewer (accessOK) unknown access type %s"%access) return False @@ -314,7 +314,7 @@ class documentViewer(Folder, extraFuncti infoUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path - logger("documentViewer (getparamfromdigilib)", logging.INFO, "dirInfo from %s"%(infoUrl)) + logging.debug("documentViewer (getparamfromdigilib) dirInfo from %s"%(infoUrl)) for cnt in range(num_retries): try: @@ -323,12 +323,12 @@ class documentViewer(Folder, extraFuncti dom = Parse(txt) break except: - logger("documentViewer (getdirinfofromdigilib)", logging.ERROR, "error reading %s (try %d)"%(infoUrl,cnt)) + logging.error("documentViewer (getdirinfofromdigilib) error reading %s (try %d)"%(infoUrl,cnt)) else: raise IOError("Unable to get dir-info from %s"%(infoUrl)) sizes=dom.xpath("//dir/size") - logger("documentViewer (getparamfromdigilib)", logging.INFO, "dirInfo:size"%sizes) + logging.debug("documentViewer (getparamfromdigilib) dirInfo:size"%sizes) if sizes: docinfo['numPages'] = int(getTextFromNode(sizes[0])) @@ -363,7 +363,7 @@ class documentViewer(Folder, extraFuncti dom = Parse(txt) break except: - logger("ERROR documentViewer (getIndexMeta)", logging.INFO,"%s (%s)"%sys.exc_info()[0:2]) + logging.error("ERROR documentViewer (getIndexMeta) %s (%s)"%sys.exc_info()[0:2]) if dom is None: raise IOError("Unable to read index meta from %s"%(url)) @@ -391,7 +391,7 @@ class documentViewer(Folder, extraFuncti dom = Parse(txt) break except: - logger("ERROR documentViewer (getPresentationInfoXML)", logging.INFO,"%s (%s)"%sys.exc_info()[0:2]) + logging.error("ERROR documentViewer (getPresentationInfoXML) %s (%s)"%sys.exc_info()[0:2]) if dom is None: raise IOError("Unable to read infoXMLfrom %s"%(url)) @@ -401,7 +401,7 @@ class documentViewer(Folder, extraFuncti def getAuthinfoFromIndexMeta(self,path,docinfo=None,dom=None,cut=0): """gets authorization info from the index.meta file at path or given by dom""" - logger("documentViewer (getauthinfofromindexmeta)", logging.INFO,"path: %s"%(path)) + logging.debug("documentViewer (getauthinfofromindexmeta) path: %s"%(path)) access = None @@ -477,7 +477,7 @@ class documentViewer(Folder, extraFuncti def getDocinfoFromTextTool(self, url, dom=None, docinfo=None): """parse texttool tag in index meta""" - logger("documentViewer (getdocinfofromtexttool)", logging.INFO, "url: %s" % (url)) + logging.debug("documentViewer (getdocinfofromtexttool) url: %s" % (url)) if docinfo is None: docinfo = {} if docinfo.get('lang', None) is None: @@ -492,7 +492,7 @@ class documentViewer(Folder, extraFuncti if archiveNames and (len(archiveNames) > 0): archiveName = getTextFromNode(archiveNames[0]) else: - logger("documentViewer (getdocinfofromtexttool)", logging.WARNING, "resource/name missing in: %s" % (url)) + logging.warning("documentViewer (getdocinfofromtexttool) resource/name missing in: %s" % (url)) archivePaths = dom.xpath("//resource/archive-path") if archivePaths and (len(archivePaths) > 0): @@ -504,7 +504,7 @@ class documentViewer(Folder, extraFuncti archivePath += "/" + archiveName else: # try to get archive-path from url - logger("documentViewer (getdocinfofromtexttool)", logging.WARNING, "resource/archive-path missing in: %s" % (url)) + logging.warning("documentViewer (getdocinfofromtexttool) resource/archive-path missing in: %s" % (url)) if (not url.startswith('http')): archivePath = url.replace('index.meta', '') @@ -596,7 +596,7 @@ class documentViewer(Folder, extraFuncti def getDocinfoFromImagePath(self,path,docinfo=None,cut=0): """path ist the path to the images it assumes that the index.meta file is one level higher.""" - logger("documentViewer (getdocinfofromimagepath)", logging.INFO,"path: %s"%(path)) + logging.debug("documentViewer (getdocinfofromimagepath) path: %s"%(path)) if docinfo is None: docinfo = {} path=path.replace("/mpiwg/online","") @@ -606,7 +606,7 @@ class documentViewer(Folder, extraFuncti pathorig=path for x in range(cut): path=getParentDir(path) - logging.error("PATH:"+path) + logging.debug("documentViewer (getdocinfofromimagepath) PATH:"+path) imageUrl=self.digilibBaseUrl+"/servlet/Scaler?fn="+path docinfo['imageURL'] = imageUrl @@ -618,13 +618,13 @@ class documentViewer(Folder, extraFuncti def getDocinfo(self, mode, url): """returns docinfo depending on mode""" - logger("documentViewer (getdocinfo)", logging.INFO,"mode: %s, url: %s"%(mode,url)) + logging.debug("documentViewer (getdocinfo) mode: %s, url: %s"%(mode,url)) # look for cached docinfo in session if self.REQUEST.SESSION.has_key('docinfo'): docinfo = self.REQUEST.SESSION['docinfo'] # check if its still current if docinfo is not None and docinfo.get('mode') == mode and docinfo.get('url') == url: - logger("documentViewer (getdocinfo)", logging.INFO,"docinfo in session: %s"%docinfo) + logging.debug("documentViewer (getdocinfo) docinfo in session: %s"%docinfo) return docinfo # new docinfo docinfo = {'mode': mode, 'url': url} @@ -635,10 +635,10 @@ class documentViewer(Folder, extraFuncti elif mode=="filepath": docinfo = self.getDocinfoFromImagePath(url, docinfo=docinfo,cut=1) else: - logger("documentViewer (getdocinfo)", logging.ERROR,"unknown mode!") + logging.error("documentViewer (getdocinfo) unknown mode: %s!"%mode) raise ValueError("Unknown mode %s! Has to be one of 'texttool','imagepath','filepath'."%(mode)) - logger("documentViewer (getdocinfo)", logging.INFO,"docinfo: %s"%docinfo) + logging.debug("documentViewer (getdocinfo) docinfo: %s"%docinfo) self.REQUEST.SESSION['docinfo'] = docinfo return docinfo