--- cdli/cdli_files.py 2006/03/19 03:27:21 1.12 +++ cdli/cdli_files.py 2006/03/28 19:56:31 1.14 @@ -757,8 +757,14 @@ class CDLIFileObject(versionedFileObject security.declarePublic('getDesignation') def getDesignation(self): """get the designation out of the file""" - txt=re.search("&[Pp](.*)= (.*)",self.data) - + try: + txt=re.search("&[Pp](.*)= (.*)",self.data[0:]) + except: + print self.getId() + txt=self.data[0:] + print str(txt) + + return "ERROR" try: return txt.group(2) except: @@ -970,7 +976,10 @@ class CDLIFileFolder(versionedFileFolder return ret - + def checkCatalog(self,fn): + """check if fn is in the catalog""" + + def uploadATF(self,upload,basketId=0,RESPONSE=None): """upload an atf file""" #TODO: add comments @@ -983,6 +992,7 @@ class CDLIFileFolder(versionedFileFolder changed=[] errors=[] newPs=[] + psNotInCatalog=[] basketNameFromFile, numberOfFiles=splitatf(upload,dir) if basketId == '0': @@ -999,6 +1009,11 @@ class CDLIFileFolder(versionedFileFolder for fn in os.listdir(dir): + + if self.checkCatalog(fn): + psNotInCatalog.append(fn) + + founds=self.CDLICatalog.search({'title':fn}) if len(founds)==0: @@ -1149,7 +1164,7 @@ class CDLIFileFolder(versionedFileFolder #os.write(tf,obj.getLastVersion().data) if RESPONSE: - RESPONSE.write(obj.getLastVersion().data) + RESPONSE.write(obj.getLastVersion().data[0:]) #os.close(tf) #RESPONSE.redirect(self.absolute_url()+"/downloadFile?fn="%tfilename) return True