Minor fix in slabimport.
authorSandrine Avakian <sandrine.avakian@inria.fr>
Mon, 11 Mar 2013 09:25:16 +0000 (10:25 +0100)
committerSandrine Avakian <sandrine.avakian@inria.fr>
Mon, 11 Mar 2013 09:25:16 +0000 (10:25 +0100)
sfa/importer/slabimporter.py

index a35489c..e66f083 100644 (file)
@@ -68,7 +68,10 @@ class SlabImporter:
 
         #retrieve all existing SFA objects
         all_records = dbsession.query(RegRecord).all()
-      
+        
+        # initialize record.stale to True by default, then mark stale=False on the ones that are in use
+        for record in all_records: 
+            record.stale = True
         #create hash by (type,hrn) 
         #used  to know if a given record is already known to SFA 
        
@@ -82,9 +85,6 @@ class SlabImporter:
         self.records_by_type_pointer = \
             dict ( [ ( (str(record.type),record.pointer) , record ) for record in all_records  if record.pointer != -1] )
 
-        # initialize record.stale to True by default, then mark stale=False on the ones that are in use
-        for record in all_records: 
-            record.stale = True
         
         nodes_listdict  = slabdriver.slab_api.GetNodes()
         nodes_by_id = dict([(node['node_id'],node) for node in nodes_listdict])
@@ -340,7 +340,7 @@ class SlabImporter:
                 print>>sys.stderr,"SlabImporter: stale records: hrn %s %s" \
                                             %(record.hrn,record.stale)
             try:        
-                stale=record.stale
+                stale = record.stale
             except:     
                 stale=True
                 self.logger.warning("stale not found with %s"%record)