--- OSAS/OSA_system/OSAS_add.py 2003/10/11 10:54:13 1.4 +++ OSAS/OSA_system/OSAS_add.py 2004/01/29 10:19:38 1.10 @@ -33,14 +33,18 @@ def add(self, no_upload=0): def getISO(): - f=file('/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/iso639-1.inc','r').readlines() - ret={} - for lineraw in f: - line=lineraw.encode('ascii','replace') - value=string.split(line,'\t')[0].encode('ascii','replace') - key=string.split(line,'\t')[1].encode('ascii','replace') - - ret[key]=value + """ISO""" + try: + f=file('/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/iso639-1.inc','r').readlines() + #f=file('OSA_system/iso639-1.inc','r').readlines() + ret={} + for lineraw in f: + line=lineraw.encode('ascii','replace') + value=string.split(line,'\t')[0].encode('ascii','replace') + key=string.split(line,'\t')[1].encode('ascii','replace') + ret[key]=value + except: + ret={} return ret def add2(self): @@ -52,6 +56,9 @@ def add2(self): self.fields=self.bibdata[self.reftype] self.isolist=getISO() + tmp=getISO().keys() + tmp.sort() + self.isokeys=tmp #listed=[ x for x in self.isolist.keys()] #print listed #sorted=listed.sort() @@ -144,7 +151,8 @@ def add6(self): f=open(metapath,'w') f.writelines(renderxml) f.close() - os.chmod(metapath,0644) + os.chmod(metapath,0664) + os.popen('chmod -R 0775 %s'%self.add_metadata['archive-path']+"/"+self.add_metadata['folder_name']) if self.REQUEST.SESSION.has_key('no_upload'): #newtemplate2=PageTemplateFile('/usr/local/mpiwg/Zope/Extensions/done',"text/html").__of__(self) @@ -177,7 +185,11 @@ def addPresentation(self,path): try: author=archive.getText(dom.getElementsByTagName('author')[0].childNodes) except: - author=archive.getText(dom.getElementsByTagName('Author')[0].childNodes) + try: + author=archive.getText(dom.getElementsByTagName('Author')[0].childNodes) + except: + author=archive.getText(dom.getElementsByTagName('Editor')[0].childNodes) + title=archive.getText(dom.getElementsByTagName('title')[0].childNodes) try: date=archive.getText(dom.getElementsByTagName('year')[0].childNodes) @@ -223,7 +235,7 @@ def addPresentation2(self): os.mkdir(path+"/"+folder_name) except: """nothing""" - print "NAME:",file_name + #print "NAME:",file_name f=open(path+"/"+folder_name+"/"+file_name,"w") f.write(xmlinfo) f.close() @@ -336,13 +348,13 @@ def addTextExternal(self,path,texturl,ve writefile.close() #registrieren - print urllib.urlopen("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path).readlines() + return urllib.urlopen("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path).readlines() + - return "DONE:"+textpath+"/"+name def TextExternalError(text): firsts=text[0:10] - print firsts + #print firsts try: match=re.search(r".*> /tmp/sc.out &"% re.sub('/mpiwg/online/','',self.REQUEST['path']+"/"+self.REQUEST['image'])) #return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+self.REQUEST['path'])