Mercurial > hg > purlService
comparison harvestToPurl.py @ 4:107f13ca333b
try except added
author | dwinter |
---|---|
date | Thu, 01 Nov 2012 17:08:10 +0100 |
parents | caeede0c9464 |
children | 1b2d74f94ca8 |
comparison
equal
deleted
inserted
replaced
3:caeede0c9464 | 4:107f13ca333b |
---|---|
29 imagePath=re.sub("^"+delpath,replacepath,imagePath) | 29 imagePath=re.sub("^"+delpath,replacepath,imagePath) |
30 | 30 |
31 fl=re.sub("^"+delpath,replacepath,fl) #loesche den teil vom path der mir delpath beginnt | 31 fl=re.sub("^"+delpath,replacepath,fl) #loesche den teil vom path der mir delpath beginnt |
32 | 32 |
33 val,purl = md.register(fl, True, user=user,imagePath=imagePath,update=update) | 33 val,purl = md.register(fl, True, user=user,imagePath=imagePath,update=update) |
34 if val==manageIndexMetaPURLs.ALREADY_EXISTS: | 34 try: |
35 print "found %s -> %s"%(fl,purl) | 35 if val==manageIndexMetaPURLs.ALREADY_EXISTS: |
36 print "found %s -> %s"%(fl,purl) | |
36 | 37 |
37 elif val==manageIndexMetaPURLs.UPDATED: | 38 elif val==manageIndexMetaPURLs.UPDATED: |
38 print "updated %s -> %s"%(fl,purl) | 39 print "updated %s -> %s"%(fl,purl) |
39 else: | 40 else: |
40 print "added %s -> %s"%(fl,purl) | 41 print "added %s -> %s"%(fl,purl) |
41 | 42 except: |
43 print "cannot print: %s"%purl | |
44 | |
42 if 'pageimg' in dirs: | 45 if 'pageimg' in dirs: |
43 dirs.remove('pageimg') # don't visit pageimf | 46 dirs.remove('pageimg') # don't visit pageimf |
44 for dir in dirs: | 47 for dir in dirs: |
45 if dir== "pageimg": | 48 if dir== "pageimg": |
46 dirs.remove('pageimg') | 49 dirs.remove('pageimg') |
47 if dir.startswith("."): | 50 if dir.startswith("."): |
48 dirs.remove(dir) | 51 dirs.remove(dir) |
49 | 52 |
53 if dir.startswith(":"): | |
54 dirs.remove(dir) | |
55 | |
50 | 56 |
51 # erzeugt einen imagepath wenn kein texttooltag existiert | 57 # erzeugt einen imagepath wenn kein texttooltag existiert |
52 def createImagePath(path,root): | 58 def createImagePath(path,root): |
53 tree= etree.parse(path) | 59 print "parsing: %s"%path |
54 | 60 try: |
61 tree= etree.parse(path) | |
62 except: | |
63 print "cannot parse %s"%path | |
64 return "" | |
65 | |
55 #teste ob texttool tag, dann kein imagePath | 66 #teste ob texttool tag, dann kein imagePath |
56 tt =tree.xpath('//texttool') | 67 tt =tree.xpath('//texttool') |
57 if len(tt)>0: | 68 if len(tt)>0: |
58 return "" | 69 return "" |
59 | 70 |