changeset 41:5b3cd0b66b30

fix bug with multiple-saved nodes.
author casties
date Wed, 02 Nov 2016 16:56:27 +0100
parents f38ca3eb1088
children 4dee9586cc44
files importFromOpenMind/importer/check_ismi_log.py
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/importFromOpenMind/importer/check_ismi_log.py	Mon Oct 31 18:33:12 2016 +0100
+++ b/importFromOpenMind/importer/check_ismi_log.py	Wed Nov 02 16:56:27 2016 +0100
@@ -10,9 +10,9 @@
 omitDeleted = True
 
 # active log levels for logging
-#logLevels = {'DEBUG', 'INFO', 'WARNING', 'ERROR', 'SYSMSG'}
+logLevels = {'DEBUG', 'INFO', 'WARNING', 'ERROR', 'SYSMSG'}
 #logLevels = {'INFO', 'WARNING', 'ERROR', 'SYSMSG'}
-logLevels = {'ERROR', 'SYSMSG'}
+#logLevels = {'ERROR', 'SYSMSG'}
 
 def log(level, message):
     if level in logLevels:
@@ -160,6 +160,10 @@
 
 
 def compareNodeLists(prev, cur, ctx, lostFile=None):
+    """compare list of previous and current nodes.
+    
+    prints results to the log and output file.
+    """
     prevNodes = {}
     curNodes = {}
     
@@ -224,7 +228,13 @@
         
     # make list of additional current (=new) nodes
     for nid in curNodeUnchecked:
-        addCurNodes.append(curNodes[nid])
+        curNode = curNodes[nid]
+        # list can contain lists
+        if isinstance(curNode, list):
+            # use the last version(?)
+            curNode = curNode[-1]
+            
+        addCurNodes.append(curNode)
         log("DEBUG", "new node %s"%curNodes[nid])
         
     # compare missing and new nodes