changeset 39:4342a81e0aa0

make getTagsAsHash not return empty lists.
author casties
date Tue, 29 Oct 2013 18:19:29 +0100
parents a8907351ddf2
children 1eabc75b9180
files MPIWGThesaurus.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGThesaurus.py	Tue Oct 29 16:47:36 2013 +0100
+++ b/MPIWGThesaurus.py	Tue Oct 29 18:19:29 2013 +0100
@@ -729,12 +729,14 @@
             tagTypes = [tagType]
         
         for tagType in tagTypes:
-            retHash[tagType]=[]
             tagsStored=tags.get(tagType,None)
             
             if tagsStored is None:
-                return;
+                # WTF: was: return
+                continue
             
+            retHash[tagType]=[]
+
             for tag in tagsStored.keys(): #gehe durch alle gespeichteren approached
                 logging.debug("checking:"+tag)
                 currentTag = tagsStored.get(tag,None)
@@ -743,6 +745,10 @@
                 if currentTag.has_key(projectID):
                     tagCnt+=1
                     retHash[tagType].append("""%s"""%tag)
+                    
+            if len(retHash[tagType]) == 0:
+                # empty tag list
+                del retHash[tagType]
             
         if tagCnt==0:
             return None