diff --git a/cellprofiler/modules/straightenworms.py b/cellprofiler/modules/straightenworms.py index f98fd9f678..6385ada05d 100644 --- a/cellprofiler/modules/straightenworms.py +++ b/cellprofiler/modules/straightenworms.py @@ -476,7 +476,7 @@ def sort_fn(a,b): def read_params(self, workspace): '''Read the training params or use the cached value''' d = self.get_dictionary(workspace.image_set_list) - if hasattr(d, "training_params"): + if "training_params" in d: return d["training_params"] params = d["training_params"] = {} params = read_params(self.training_set_directory, diff --git a/cellprofiler/modules/tests/test_straightenworms.py b/cellprofiler/modules/tests/test_straightenworms.py index 72d4210cac..3abec221c2 100644 --- a/cellprofiler/modules/tests/test_straightenworms.py +++ b/cellprofiler/modules/tests/test_straightenworms.py @@ -172,9 +172,8 @@ def __init__(self): module.training_set_directory.dir_choice == cps.URL_FOLDER_NAME module.training_set_directory.custom_path = "http://www.cellprofiler.org" module.training_set_file_name.value = "TrainingSet.xml" - module.training_params = { - "TrainingSet.xml": ( P(), "URL") - } + module.get_dictionary = lambda dummy: { + "training_params" : P()} pipeline = cpp.Pipeline() pipeline.add_module(module)