--- documentViewer/documentViewer.py 2006/07/06 16:01:42 1.14 +++ documentViewer/documentViewer.py 2006/07/26 12:23:55 1.17 @@ -143,14 +143,10 @@ class documentViewer(Folder): """returns if access to the resource is granted""" access = docinfo.get('accessType', None) zLOG.LOG("documentViewer (accessOK)", zLOG.INFO, "access type %s"%access) - if access is None: - # no information - no access - #TODO: check + if access is not None and access == 'free': + zLOG.LOG("documentViewer (accessOK)", zLOG.INFO, "access is free") return True - elif access == 'free': - zLOG.LOG("documentViewer (accessOK)", zLOG.INFO, "access is free") - return True - elif access in self.authgroups: + elif access is None or access in self.authgroups: # only local access -- only logged in users user = getSecurityManager().getUser() if user is not None: @@ -285,9 +281,14 @@ class documentViewer(Folder): if dom is None: dom = self.getIndexMeta(url) + archivePath = None + archiveName = None + archiveNames=dom.xpath("//resource/name") if archiveNames and (len(archiveNames)>0): archiveName=getTextFromNode(archiveNames[0]) + else: + zLOG.LOG("documentViewer (getdocinfofromtexttool)", zLOG.WARNING,"resource/name missing in: %s"%(url)) archivePaths=dom.xpath("//resource/archive-path") if archivePaths and (len(archivePaths)>0): @@ -295,10 +296,17 @@ class documentViewer(Folder): # clean up archive path if archivePath[0] != '/': archivePath = '/' + archivePath - if not archivePath.endswith(archiveName): + if archiveName and (not archivePath.endswith(archiveName)): archivePath += "/" + archiveName else: - archivePath=None + # try to get archive-path from url + zLOG.LOG("documentViewer (getdocinfofromtexttool)", zLOG.WARNING,"resource/archive-path missing in: %s"%(url)) + if (not url.startswith('http')): + archivePath = url.replace('index.meta', '') + + if archivePath is None: + # we balk without archive-path + raise IOError("Missing archive-path (for text-tool) in %s"%(url)) imageDirs=dom.xpath("//texttool/image") if imageDirs and (len(imageDirs)>0):