openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #29756
Re: [Merge] lp:~trb143/openlp/may_fixes into lp:openlp
Review: Needs Fixing
A developer should be able to overwrite a working flag. Otherwise you're going to see this everywhere:
Registry.remove_flag("is_cool")
Registry.setflag("is_cool", True)
Diff comments:
> === modified file 'openlp/core/common/registry.py'
> --- openlp/core/common/registry.py 2016-05-14 04:24:46 +0000
> +++ openlp/core/common/registry.py 2016-05-21 19:02:29 +0000
> @@ -145,3 +145,39 @@
> trace_error_handler(log)
> log.error("Event {event} called but not registered".format(event=event))
> return results
> +
> + def get_flag(self, key):
> + """
> + Extracts the working_flag value from the list based on the key passed in
> +
> + :param key: The flag to be retrieved.
> + """
> + if key in self.working_flags:
> + return self.working_flags[key]
> + else:
> + trace_error_handler(log)
> + log.error('Working Flag {key} not found in list'.format(key=key))
> + raise KeyError('Working Flag {key} not found in list'.format(key=key))
> +
> + def set_flag(self, key, reference):
> + """
> + Sets a working_flag based on the key passed in.
> +
> + :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))
They should be able to overwrite flags.
> + else:
> + self.working_flags[key] = reference
> +
> + def remove_flag(self, key):
> + """
> + Removes the working flags value from the list based on the key passed.
> +
> + :param key: The working_flag to be deleted.
> + """
> + if key in self.working_flags:
> + del self.working_flags[key]
--
https://code.launchpad.net/~trb143/openlp/may_fixes/+merge/295394
Your team OpenLP Core is subscribed to branch lp:openlp.
References