comparison MPIWGThesaurus.py @ 39:4342a81e0aa0

make getTagsAsHash not return empty lists.
author casties
date Tue, 29 Oct 2013 18:19:29 +0100
parents a8907351ddf2
children 9a23640f7f49
comparison
equal deleted inserted replaced
38:a8907351ddf2 39:4342a81e0aa0
727 tagTypes = tags.keys() 727 tagTypes = tags.keys()
728 else: 728 else:
729 tagTypes = [tagType] 729 tagTypes = [tagType]
730 730
731 for tagType in tagTypes: 731 for tagType in tagTypes:
732 tagsStored=tags.get(tagType,None)
733
734 if tagsStored is None:
735 # WTF: was: return
736 continue
737
732 retHash[tagType]=[] 738 retHash[tagType]=[]
733 tagsStored=tags.get(tagType,None) 739
734
735 if tagsStored is None:
736 return;
737
738 for tag in tagsStored.keys(): #gehe durch alle gespeichteren approached 740 for tag in tagsStored.keys(): #gehe durch alle gespeichteren approached
739 logging.debug("checking:"+tag) 741 logging.debug("checking:"+tag)
740 currentTag = tagsStored.get(tag,None) 742 currentTag = tagsStored.get(tag,None)
741 if currentTag is None: 743 if currentTag is None:
742 continue 744 continue
743 if currentTag.has_key(projectID): 745 if currentTag.has_key(projectID):
744 tagCnt+=1 746 tagCnt+=1
745 retHash[tagType].append("""%s"""%tag) 747 retHash[tagType].append("""%s"""%tag)
748
749 if len(retHash[tagType]) == 0:
750 # empty tag list
751 del retHash[tagType]
746 752
747 if tagCnt==0: 753 if tagCnt==0:
748 return None 754 return None
749 755
750 return retHash 756 return retHash