diff --git a/openlp/core/common/registry.py b/openlp/core/common/registry.py index ee322d87d..85fca6912 100644 --- a/openlp/core/common/registry.py +++ b/openlp/core/common/registry.py @@ -166,12 +166,7 @@ class Registry(object): :param key: The working_flag to be created this is usually a major class like "renderer" or "main_window" . :param reference: The data to be saved. """ - if key in self.working_flags: - trace_error_handler(log) - log.error('Duplicate Working Flag exception {key}'.format(key=key)) - raise KeyError('Duplicate Working Flag exception {key}'.format(key=key)) - else: - self.working_flags[key] = reference + self.working_flags[key] = reference def remove_flag(self, key): """ diff --git a/tests/functional/openlp_core_common/test_registry.py b/tests/functional/openlp_core_common/test_registry.py index 0cac19bcd..0642ff93c 100644 --- a/tests/functional/openlp_core_common/test_registry.py +++ b/tests/functional/openlp_core_common/test_registry.py @@ -102,17 +102,18 @@ class TestRegistry(TestCase): # WHEN: I add a working flag it should save it my_data = 'Lamas' + my_data2 = 'More Lamas' Registry().set_flag('test1', my_data) # THEN: we should be able retrieve the saved component - assert Registry().get_flag('test1') == my_data, 'The working flag can be retrieved and matches' + temp = Registry().get_flag('test1') + self.assertEquals(temp, my_data, 'The value should have been saved') - # WHEN: I add a component for the second time I am mad. - # THEN and I will get an exception - with self.assertRaises(KeyError) as context: - Registry().set_flag('test1', my_data) - self.assertEqual(context.exception.args[0], 'Duplicate Working Flag exception test1', - 'KeyError exception should have been thrown for duplicate working flag') + # WHEN: I add a component for the second time I am not mad. + # THEN and I will not get an exception + Registry().set_flag('test1', my_data2) + temp = Registry().get_flag('test1') + self.assertEquals(temp, my_data2, 'The value should have been updated') # WHEN I try to get back a non existent Working Flag # THEN I will get an exception