--- ECHO_content/VLPExtension.py 2008/10/08 08:35:20 1.78 +++ ECHO_content/VLPExtension.py 2008/10/08 10:51:53 1.80 @@ -565,23 +565,24 @@ class VLP_collection(ECHO_collection,Acq for found in founds: try: litid = str(found.reference) - foundCol=self.ZopeFind(self,obj_ids=[litid]) + foundCol=self.findObjFromLitName(litid) + #foundCol=self.ZopeFind(self,obj_ids=[litid]) if foundCol: - col = foundCol[0][1] - logging.debug("generateSubCollections: subcollection %s exists (%s)"%(col.getId(),found.reference)) + col = foundCol + logging.debug("generateSubCollections: subcollection %s exists (%s)"%(repr(col),found.reference)) if (col.title != found.titlerefdisplay) or (col.label != found.titlerefdisplay): # subcollection seems to have changed logging.debug("generateSubCollections: subcollection has changed, recreating!") - self.manage_delObjects([foundCol[0][0]]) - manage_addVLP_subCollection(self,litid,found.titlerefdisplay,found.titlerefdisplay) + col.aq_parent.manage_delObjects([col.getId()]) + manage_addVLP_subCollection(self.getOrCreateFolderForFile(litid),litid,found.titlerefdisplay,found.titlerefdisplay) else: logging.debug("generateSubCollections: creating new subcollection %s"%found.reference) - manage_addVLP_subCollection(self,litid,found.titlerefdisplay,found.titlerefdisplay) + manage_addVLP_subCollection(self.getOrCreateFolderForFile(litid),litid,found.titlerefdisplay,found.titlerefdisplay) #teste ob es Images auf dem Server gibt mit gleichem Namen (frontmatter) if os.path.exists(os.path.join(self.vlp_basis,litid)): logging.debug("generateSubCollections: found frontmatter in %s"%litid) - obj=getattr(self,litid) + obj=self.findObjFromLitName(litid) if not self.ZopeFind(obj,obj_ids=[litid]): metalink=self.REQUEST['URL1']+"/"+litid+"/"+litid+"/index_meta" newObj=VLP_resource(litid,'',metalink,litid,litid,litid,'generated','book','','','','','','') @@ -592,7 +593,7 @@ class VLP_collection(ECHO_collection,Acq if RESPONSE is not None: self.REQUEST.RESPONSE.write("

%s

\n"%litid) - logging.debug("

%s

\n"%litid) + logging.debug("

%s

\n"%litid) except: error=sys.exc_info()[0:2] @@ -963,12 +964,19 @@ class VLP_resource(ECHO_resource,Cacheab def file2page(self,p): """converts filename to pagenumber""" - dom=xml.dom.minidom.parse(ECHO_helpers.urlopen(getattr(self,'index.xml').absolute_url())) + + #dom=xml.dom.minidom.parse(ECHO_helpers.urlopen(getattr(self,'index.xml').absolute_url())) + index=getattr(self,'index.xml') + + txt=index.pt_render() + dom=xml.dom.minidom.parseString(txt) for page in dom.getElementsByTagName('page'): # pageummer mit lo oder hi sind aequivalent if (page.getAttribute('file')==p) or ("%slo"%page.getAttribute('file')==p) or ("%shi"%page.getAttribute('file')==p): - return page.getAttribute('nr') + nr=page.getAttribute('nr') + + return nr return 0