changeset 5149:eae57b3d9e0e

migration scripts: fix exception handler to catch both int() ValueErrors
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 15 Sep 2009 15:34:08 +0200
parents a0ca2bd83cd3
children b424a3d66cfc
files MoinMoin/script/migration/_conv160.py MoinMoin/script/migration/_conv160a.py
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/migration/_conv160.py	Tue Sep 15 13:50:03 2009 +0200
+++ b/MoinMoin/script/migration/_conv160.py	Tue Sep 15 15:34:08 2009 +0200
@@ -140,11 +140,11 @@
                     continue
                 fields = line.split('\t') + [''] * 9
                 timestamp, rev, action, pagename, ip, hostname, userid, extra, comment = fields[:9]
-                timestamp = int(timestamp)
                 try:
+                    timestamp = int(timestamp)
                     rev = int(rev)
                 except ValueError, err:
-                    print "Error: %r has a damaged timestamp in log line %d [%s] - skipping this entry" % (
+                    print "Error: %r has a damaged timestamp or revision number in log line %d [%s] - skipping this entry" % (
                         self.fname, lineno, str(err))
                     continue # ignore this line, do not terminate - to find all those errors in one go
                 pagename = wikiutil.unquoteWikiname(pagename)
--- a/MoinMoin/script/migration/_conv160a.py	Tue Sep 15 13:50:03 2009 +0200
+++ b/MoinMoin/script/migration/_conv160a.py	Tue Sep 15 15:34:08 2009 +0200
@@ -140,11 +140,11 @@
                     continue
                 fields = line.split('\t') + [''] * 9
                 timestamp, rev, action, pagename, ip, hostname, userid, extra, comment = fields[:9]
-                timestamp = int(timestamp)
                 try:
+                    timestamp = int(timestamp)
                     rev = int(rev)
                 except ValueError, err:
-                    print "Error: %r has a damaged timestamp in log line %d [%s] - skipping this entry" % (
+                    print "Error: %r has a damaged timestamp or revision number in log line %d [%s] - skipping this entry" % (
                         self.fname, lineno, str(err))
                     continue # ignore this line, do not terminate - to find all those errors in one go
                 pagename = wikiutil.unquoteWikiname(pagename)