# HG changeset patch # User dwinter # Date 1351844711 -3600 # Node ID 78dd28ade713832eff528cc4259ccd8a173066d2 # Parent f0417a01690af6e81f4a49d537bb79274d45d381 error handling diff -r f0417a01690a -r 78dd28ade713 addDriToIndexMeta.py --- a/addDriToIndexMeta.py Fri Nov 02 09:06:44 2012 +0100 +++ b/addDriToIndexMeta.py Fri Nov 02 09:25:11 2012 +0100 @@ -11,10 +11,14 @@ from os.path import join, getsize errorFile = file("/tmp/addDRIErrors.txt","w") +parseErrorFile = file("/tmp/addDRIParseErrors.txt","w") def addPURL(fl,purl,test=False): - tree = etree.parse(fl) - + try: + tree = etree.parse(fl) + except: + parseErrorFile.write("PARSE ERROR:"+fl+"\n") + return False dris = tree.xpath("/resource/meta/dri[@type='mpiwg']") if len(dris)==0: # erzeuge neu @@ -22,7 +26,7 @@ newDri.text=purl metas=tree.xpath("/resource/meta") if len(metas)==0: - print "no resource/meta in %s"%fl + parseErrorFile.write("no resource/meta: %s \n"%fl) return False else: metas[0].append(newDri) @@ -66,4 +70,4 @@ dirs.remove(dir) if __name__ == '__main__': - addDriToIndexMeta("/mpiwg/online/permanent/annalen",delpath="/mpiwg/online") \ No newline at end of file + addDriToIndexMeta("/mpiwg/online/",delpath="/mpiwg/online",test=False) diff -r f0417a01690a -r 78dd28ade713 manageIndexMetaPURLs.py --- a/manageIndexMetaPURLs.py Fri Nov 02 09:06:44 2012 +0100 +++ b/manageIndexMetaPURLs.py Fri Nov 02 09:25:11 2012 +0100 @@ -38,7 +38,7 @@ def __init__(self): - self.purlDB = web.database(dbn="postgres", db="purlDB",user="purlUSER",password="3333", host="localhost") + self.purlDB = web.database(dbn="postgres", db="purlDB",user="purlUSER",password="p*lWa55eR", host="localhost")