diff options
author | Josh Blum | 2009-09-02 16:58:15 -0700 |
---|---|---|
committer | Josh Blum | 2009-09-02 16:58:15 -0700 |
commit | 56a58932701c981e55972ad994d397733edb8c75 (patch) | |
tree | cd326a9a553f287450795a08e0eeff3308d8e9f0 | |
parent | 30513fdc9afa3d8e9d4dce4214299d89aed3c409 (diff) | |
download | gnuradio-56a58932701c981e55972ad994d397733edb8c75.tar.gz gnuradio-56a58932701c981e55972ad994d397733edb8c75.tar.bz2 gnuradio-56a58932701c981e55972ad994d397733edb8c75.zip |
Evaluation fix in param.to_code().
Dont force an evaluation in to code unless the type is string or list.
Not doing so forces the variables to call evaluate before the namespace was bootstrapped.
This fixes a bug that came up when the validate was replaced with rewrite in flowgraph.import_data().
By replacing the validate, evaluate was only called once, and the namespace was not bootstrapped.
-rw-r--r-- | grc/python/Param.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/grc/python/Param.py b/grc/python/Param.py index 17cfad051..e61779136 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -403,17 +403,18 @@ class Param(_Param, _GUIParam): def to_code(self): """ Convert the value to code. + For string and list types, check the init flag, call evaluate(). + This ensures that evaluate() was called to set the xxxify_flags. @return a string representing the code """ - #run init tasks in evaluate - #such as setting flags - if not self._init: self.evaluate() v = self.get_value() t = self.get_type() if t in ('string', 'file_open', 'file_save'): #string types + if not self._init: self.evaluate() if self._stringify_flag: return '"%s"'%v.replace('"', '\"') else: return v elif t in ('complex_vector', 'real_vector', 'int_vector'): #vector types + if not self._init: self.evaluate() if self._lisitify_flag: return '(%s, )'%v else: return '(%s)'%v else: return v |