changeset 175:f7c2f112afe6

Fix the BDB XML upgrade procedure: If a document is found that is associated with a non-existing build, just remove it.
author cmlenz
date Tue, 30 Aug 2005 18:56:14 +0000
parents 79c61c26a4e1
children ccf67a4de4fa
files bitten/upgrades.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/upgrades.py
+++ b/bitten/upgrades.py
@@ -75,8 +75,12 @@
         if doc.getMetaData('', 'build', metaval):
             build_id = int(metaval.asNumber())
             build = Build.fetch(env, id=build_id, db=db)
-            doc.setMetaData('', 'config', dbxml.XmlValue(build.config))
-            container.updateDocument(doc, uc)
+            if build:
+                doc.setMetaData('', 'config', dbxml.XmlValue(build.config))
+                container.updateDocument(doc, uc)
+            else:
+                # an orphaned report, for whatever reason... just remove it
+                container.deleteDocument(doc, uc)
 
 map = {
     2: [add_log_table],
Copyright (C) 2012-2017 Edgewall Software