[importers] The behavior of this method will change in future versions.
authorDimitri Papadopoulos <dimitri.papadopoulos@cea.fr>
Sat, 27 Jul 2013 09:35:17 +0200
changeset 365 1cbe7540884d
parent 364 6985ee412eab
child 366 0518974bc7f4
[importers] The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
importers/imagen.py
--- a/importers/imagen.py	Fri Jul 26 23:45:33 2013 +0200
+++ b/importers/imagen.py	Sat Jul 27 09:35:17 2013 +0200
@@ -383,7 +383,7 @@
         # No data file path
         print 'NO DATA FILEPATH FOR', scan_id, scan_type
         return
-    if not _file:
+    if _file is None:
         return
     file_uri = format_filepath(_file.get('URI'))
     file_format = unicode(_file.get('format'))
@@ -503,7 +503,7 @@
             store.relate(measure.eid, 'external_resources', extres_eid)
     # Add scores - Volumetric
     volumetrics = assessor.find('%(fs)smeasures/%(fs)svolumetric' % {'fs': FREESURFER})
-    if volumetrics:
+    if volumetrics is not None:
         for volumetric in volumetrics.getchildren():
             if volumetric.tag != '%sregions' % FREESURFER:
                 name = volumetric.tag.split('}')[-1]
@@ -527,7 +527,7 @@
                             score_eid = store.create_entity('ScoreValue', **attrs).eid
     # Add scores - Surface
     surfaces = assessor.find('%(fs)smeasures/%(fs)ssurface' % {'fs': FREESURFER})
-    if surfaces:
+    if surfaces is not None:
         for hemisphere in surfaces.getchildren():
             for surface in hemisphere.getchildren():
                 if isinstance(surface, etree._Comment):