]> git.parisson.com Git - timeside.git/commitdiff
fix(analyzer.core): return an Error if duplicate result ids are in the results container
authorThomas Fillon <thomas@parisson.com>
Mon, 15 Sep 2014 10:39:14 +0000 (12:39 +0200)
committerThomas Fillon <thomas@parisson.com>
Mon, 15 Sep 2014 10:39:14 +0000 (12:39 +0200)
timeside/analyzer/core.py

index 23954a63c51d9515701278e80d44f2b95d8545ba..fe09dbd093627e2fb15d7de28bc5327b1f61efb2 100644 (file)
@@ -943,9 +943,12 @@ class AnalyzerResultContainer(dict):
         self.__setitem__(res_uuid, analyzer_result)
 
     def get_result_by_id(self, result_id):
+        if self.list_id().count(result_id) > 1:
+            raise ValueError('Result id shared by several procesors in the pipe. Get result from the processor instead')
         for res in self.values():
             if res.id_metadata.id == result_id:
                 return res
+        raise KeyError('No such result id: %s' % result_id)
 
     def list_id(self):
         return [res.id for res in self.values()]