--- ECHO_content/VLPExtension.py 2006/01/20 15:12:57 1.54 +++ ECHO_content/VLPExtension.py 2007/07/26 08:29:06 1.62 @@ -21,7 +21,7 @@ import os from stat import * from types import * from Globals import package_home - +import transaction def lemmatize(str): @@ -145,7 +145,7 @@ def manage_addSendMailForm(self, id, toA class VLP_essay(Folder): - """classe für VLP essays""" + """classe fr VLP essays""" meta_type="VLP_essay" @@ -263,6 +263,12 @@ class VLP_essay(Folder): retstr=url+"?p="+str(int(pagenum)+1) return retstr + def lastURL(self,pagenum,url): + # teste ob performance ok, sonst in variable + pages=len(self.ZopeFind(self,obj_metatypes=['DTML Document','File'])) + + return url+"?p="+str(pages) + def previousURL(self,pagenum,url): if int(pagenum)-1 > 0: @@ -364,12 +370,12 @@ class VLP_subcollection(ECHO_collection) sort=self.collectionSort(type) item = [x for x in self.ZSQLSimpleSearch("""SELECT * FROM vl_literature - WHERE volumeid = '%s' """%self.getId() + WHERE volumeid ~ '%s\\\\M' """%self.getId() + """ %s AND not referenceType='%s' """%(online,type) + """ORDER BY """ + sort)] tocItem = [x for x in self.ZSQLSimpleSearch("""SELECT * FROM vl_literature - WHERE volumeid = '%s' """%self.getId() + WHERE reference = '%s' """%self.getId() + """AND online = 1 AND referenceType='%s' """%type + """ORDER BY """ + sort)] @@ -426,10 +432,11 @@ class VLP_collection(ECHO_collection): def generateSubCollections(self,errorsTXT=""): """erzeuge subcollectionen""" - founds=self.ZSQLSimpleSearch("select * from vl_literature where referencetype in ('Edited Book'),'(Book)','(Collection)','(JournalVolume)')") + founds=self.ZSQLSimpleSearch("select * from vl_literature where referencetype in ('(Edited Book)','(Book)','(Collection)','(JournalVolume)','(Generic Container)')") self.REQUEST.RESPONSE.write("

Create Subcollections

\n") for found in founds: + try: foundCol=self.ZopeFind(self,obj_ids=[found.reference]) if foundCol: @@ -475,6 +482,7 @@ class VLP_collection(ECHO_collection): files=os.listdir(self.vlp_basis) errorsTXT+="

New Ressources

" + for fileName in files: if fileName[0:3]=="lit": @@ -503,10 +511,10 @@ class VLP_collection(ECHO_collection): except: error=sys.exc_info()[0:2] RESPONSE.write("

(ERROR (%s): %s %s)

\n"%(fileName,error[0],error[1])) - errorsTXT+="

File not created:%s "+"(ERROR: %s %s)

"%error + errorsTXT+="

File not created:%s (ERROR: %s %s)

"%(fileName,error[0],error[1]) errorsTXT+=self.generateSubCollections() - errorsTXT+="/n" + errorsTXT+="\n" RESPONSE.write(errorsTXT) if RESPONSE is not None: RESPONSE.redirect('manage_main') @@ -771,8 +779,7 @@ class VLP_resource(ECHO_resource,Cacheab temp=[] ret.sort() for x in ret: - if (not (x[0]==".")) and (not x[0:4] in excludeNames): - + if (not (x[0] in ('.',':'))) and (not x[0:4] in excludeNames): temp.append((calculateName(x),os.path.splitext(x)[0])) return temp @@ -882,19 +889,18 @@ class VLP_resource(ECHO_resource,Cacheab def createIndexFile(self,RESPONSE=None): """create index file""" - + logging.debug("createindexfile of %s"%self.id) pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','index_template.zpt')).__of__(self)() - - if not hasattr(self,'index.xml'): zt=ZopePageTemplate('index.xml') self._setObject('index.xml',zt) else: zt=getattr(self,'index.xml') - + #logging.debug("createindexfile uses %s"%pt) zt.pt_edit(pt, 'text/xml') + transaction.get().commit() if RESPONSE is not None: RESPONSE.redirect('manage_main')