Mercurial > hg > purlService
changeset 4:107f13ca333b
try except added
author | dwinter |
---|---|
date | Thu, 01 Nov 2012 17:08:10 +0100 |
parents | caeede0c9464 |
children | 3ebe37d81071 |
files | harvestToPurl.py manageIndexMetaPURLs.py |
diffstat | 2 files changed, 23 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/harvestToPurl.py Thu Nov 01 15:52:14 2012 +0100 +++ b/harvestToPurl.py Thu Nov 01 17:08:10 2012 +0100 @@ -31,14 +31,17 @@ fl=re.sub("^"+delpath,replacepath,fl) #loesche den teil vom path der mir delpath beginnt val,purl = md.register(fl, True, user=user,imagePath=imagePath,update=update) - if val==manageIndexMetaPURLs.ALREADY_EXISTS: - print "found %s -> %s"%(fl,purl) + try: + if val==manageIndexMetaPURLs.ALREADY_EXISTS: + print "found %s -> %s"%(fl,purl) - elif val==manageIndexMetaPURLs.UPDATED: - print "updated %s -> %s"%(fl,purl) - else: - print "added %s -> %s"%(fl,purl) - + elif val==manageIndexMetaPURLs.UPDATED: + print "updated %s -> %s"%(fl,purl) + else: + print "added %s -> %s"%(fl,purl) + except: + print "cannot print: %s"%purl + if 'pageimg' in dirs: dirs.remove('pageimg') # don't visit pageimf for dir in dirs: @@ -47,11 +50,19 @@ if dir.startswith("."): dirs.remove(dir) + if dir.startswith(":"): + dirs.remove(dir) + # erzeugt einen imagepath wenn kein texttooltag existiert def createImagePath(path,root): - tree= etree.parse(path) - + print "parsing: %s"%path + try: + tree= etree.parse(path) + except: + print "cannot parse %s"%path + return "" + #teste ob texttool tag, dann kein imagePath tt =tree.xpath('//texttool') if len(tt)>0: @@ -96,4 +107,4 @@ harvestIndexMeta(path,user,delpath=delpath,replacepath=replacepath,update=True) - \ No newline at end of file +
--- a/manageIndexMetaPURLs.py Thu Nov 01 15:52:14 2012 +0100 +++ b/manageIndexMetaPURLs.py Thu Nov 01 17:08:10 2012 +0100 @@ -38,7 +38,7 @@ def __init__(self): - self.purlDB = web.database(dbn="postgres", db="purlDB",user="purlUSER",password="3333") + self.purlDB = web.database(dbn="postgres", db="purlDB",user="purlUSER",password="p*lWa55eR", host="localhost") @@ -214,4 +214,4 @@ im = IndexMetaPURLManager() print im.register("/tmp3/index.meta", True, "", "dwinter") - pass \ No newline at end of file + pass