--- OSAS/OSA_system/archive.py 2003/10/05 19:11:09 1.1 +++ OSAS/OSA_system/archive.py 2005/05/04 14:06:32 1.11 @@ -17,7 +17,7 @@ import xml.dom.minidom from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplate import PageTemplate import tempfile -tempfile.tempdir="/var/tmp/archiver" +tempfile.tempdir="/var/tmp" exclusion=[".HSResource","lost+found","Network Trash Folder","TheFindByContentFolder","TheVolumeSettingsFolder"] class fsentry(Implicit, Persistent, RoleManager): @@ -75,6 +75,7 @@ class filesystem(Implicit, Persistent, R def getfs(self,start): """load filessystem""" + f = os.popen("find "+ start+" -name '*' ","r") lines = f.readlines() @@ -137,6 +138,7 @@ class filesystem(Implicit, Persistent, R j[k]=self.node[k] return j + def archive_the_path(self,path): """parse indexmeta and return digilib path""" try: @@ -176,6 +178,7 @@ class filesystem(Implicit, Persistent, R if self.archive_the_path(k): j[k]=self.node[k] return j + security.declarePublic('getImageDirs') def getImageDirs(self,dom,path): dirs=dom.getElementsByTagName("dir") @@ -239,6 +242,7 @@ class filesystem2(Implicit, Persistent, def getfs(self,start): """load filessystem""" + f = os.popen("find "+ start+" -name '*' ","r") lines = f.readlines() @@ -373,6 +377,7 @@ class browse(Implicit, Persistent, RoleM def getfs(start): """return filesystem""" + f = os.popen("find "+ start+" -name '*'","r") lines = f.readlines() return lines @@ -527,16 +532,17 @@ class metacheck(Implicit, Persistent, Ro return [retstr,error] else: return ['','running'] + def __init__(self,path): """archive the documents in path""" self.lines=[] if type(path)==StringType: - f = os.popen("/usr/local/mpiwg/archive/metacheck "+path,"r") + f = os.popen("/usr/local/mpiwg/archive/metacheck "+path,"r") self.lines.append(Error([path,self.parsearchive(f.readlines())])) else: for singlepath in path: - f = os.popen("/usr/local/mpiwg/archive/metacheck "+singlepath,"r") + f = os.popen("/usr/local/mpiwg/archive/metacheck "+singlepath,"r") self.lines.append(Error([singlepath,self.parsearchive(f.readlines())])) security.declarePublic('messages') @@ -577,11 +583,11 @@ class archive(Implicit, Persistent, Role if type(path)==StringType: self.filenames[path]=tempfile.mktemp() - f = os.popen("/usr/local/mpiwg/archive/archiver "+path+" > "+self.filenames[path]+" &","r") + f = os.popen("/usr/local/mpiwg/archive/archiver "+path+" -premigrate > "+self.filenames[path]+" &","r") else: for singlepath in path: self.filenames[singlepath]=tempfile.mktemp() - f = os.popen("/usr/local/mpiwg/archive/archiver "+singlepath+" > "+self.filenames[singlepath]+" &","r") + f = os.popen("/usr/local/mpiwg/archive/archiver "+singlepath+" -premigrate > "+self.filenames[singlepath]+" &","r") security.declarePublic('messages') def messages(self): @@ -636,13 +642,14 @@ def getText(nodelist): rc = "" for node in nodelist: + if node.nodeType == node.TEXT_NODE: rc = rc + node.data return rc def getBib(nodelist): rc= "" - print "HI" + for node in nodelist: if node.nodeType == node.ELEMENT_NODE: @@ -685,7 +692,7 @@ def getMetafile(path): else: html=html+"

Info

" html=html+getBib(bib.childNodes) - print html + #print html except: """none""" @@ -734,18 +741,29 @@ def isdigilib2(path): def isFullText(path,folder_name): """check if foldername in path is full text""" + try: dom=xml.dom.minidom.parse(path+"/index.meta") - for node in dom.getElementsByTagName("dir"): - - if getText(node.getElementsByTagName("content-type")[0].childNodes)=="fulltext": - + except: + """ nothing""" + return 0 + for node in dom.getElementsByTagName("dir"): + + try: + child=getText(node.getElementsByTagName("content-type")[0].childNodes) + + if child =="fulltext": + if getText(node.getElementsByTagName("name")[0].childNodes)==folder_name: return 1 - return 0 - except: + except: + """nothing""" + #print "erro",node + #print sys.exc_info() + #return 0 - return 0 + return 0 + def isPresentation(path,folder_name): @@ -853,10 +871,11 @@ class overview(Implicit,Persistent, Role if not len(str)==0: for line in str: retstr=retstr+line+"
" - check=re.search(r"(.*):(.*)",line) - if check.group(1)=='ABORT': + check=line.split(":") + #re.search(r"(.*):(.*)",line) + if check[0]=='ABORT': error="error" - elif check.group(1)=='DONE': + elif check[0]=='DONE': error="ok" else: error="running" @@ -931,14 +950,14 @@ def EditIndex(self,path): indexmeta="" self.REQUEST.SESSION['indexmeta']=indexmeta self.REQUEST.SESSION['path']=path - newtemplate=PageTemplateFile('/usr/local/mpiwg/Zope/Extensions/editindex').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/editindex').__of__(self) return newtemplate() def EditIndex2(self): if not self.REQUEST.has_key('fileupload'): #newtext=urllib.unquote(self.REQUEST['indexmeta']) newtext=self.REQUEST['indexmeta'] - print newtext + #print newtext else: self.file_name=self.REQUEST['fileupload'].filename #newtext=self.REQUEST.form['fileupload'].read()