[zopeorg-checkins] CVS: Products/ZWiki/Extensions - convert.py:1.4
Ken Manheimer
klm at zope.com
Sat Dec 15 19:20:42 EST 2001
Update of /cvs-zopeorg/Products/ZWiki/Extensions
In directory cvs.zope.org:/tmp/cvs-serv27476
Modified Files:
convert.py
Log Message:
Guard against corrupt folders, so processing completes.
add_subscribe_links(): Commit every 100 changed footers. (I don't
think this is necessary, but accidentally ran the version with the
real fix plus this in it, so i'm checking it in.)
hierarchy_folders(): Catch exceptions and continue processing.
=== Products/ZWiki/Extensions/convert.py 1.3 => 1.4 ===
did = did + 1
footer.raw = new
+ if not did % 100:
+ get_transaction().commit()
else:
missed = missed + 1
return ("Did %s footers, missed %s, skipped %s already done."
@@ -43,13 +45,22 @@
addline = (' / <a href="&dtml-wiki_page_url;/subscribeform">'
'Subscriptions</a>')
-def hierarchy_folders(folder=None):
+bads = []
+def hierarchy_folders(folder):
"""Return list all folders contained in the current one, inclusive."""
+ global bads
got = []
- if folder is None:
- folder = self
got.append(folder)
- for subfolder in folder.objectValues(spec=FOLDER_TYPES):
+ folderpath = string.join(folder.getPhysicalPath(), '/')
+ for id in folder.objectIds(spec=FOLDER_TYPES):
+ subfolder = folder[id]
got.append(subfolder)
- got.extend(hierarchy_folders(subfolder))
+ try:
+ got.extend(hierarchy_folders(subfolder))
+ except:
+ import sys
+ bad = folderpath + '/' + id
+ bads.append(bad)
+ print ("Skipping failure #%s in folder '%s' (%s)"
+ % (len(bads), bad, sys.exc_info()[1]))
return got
More information about the zopeorg-checkins
mailing list