From 8760688849a4faf902de90d6d28335a1edbfcc03 Mon Sep 17 00:00:00 2001 From: jblum Date: Wed, 18 Mar 2009 05:56:59 +0000 Subject: Properly handle duplicated IDs. Duplicates OK in disabled blocks. Confine validation errors to blocks involved. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10633 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/src/platforms/python/Param.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grc/src/platforms/python/Param.py b/grc/src/platforms/python/Param.py index e92494bcd..efebe92e5 100644 --- a/grc/src/platforms/python/Param.py +++ b/grc/src/platforms/python/Param.py @@ -215,7 +215,7 @@ class Param(_Param): ######################### # Enum Type ######################### - if self.is_enum(): return self.get_value() + if self.is_enum(): return v ######################### # Numeric Types ######################### @@ -305,7 +305,7 @@ class Param(_Param): raise Exception params = self.get_all_params('id') keys = [param.get_value() for param in params] - try: assert(len(keys) == len(set(keys))) + try: assert keys.count(v) <= 1 #id should only appear once, or zero times if block is disabled except: self._add_error_message('ID "%s" is not unique.'%v) raise Exception @@ -392,4 +392,4 @@ class Param(_Param): @param type the specified type @return a list of params """ - return sum([filter(lambda p: p.get_type() == type, block.get_params()) for block in self.get_parent().get_parent().get_blocks()], []) + return sum([filter(lambda p: p.get_type() == type, block.get_params()) for block in self.get_parent().get_parent().get_enabled_blocks()], []) -- cgit