def _populate_choices(self): self.choices = [] for chain_id in self.jobChainLink.link.config["chain_choices"]: try: chain = self.jobChainLink.workflow.get_chain(chain_id) except KeyError: continue if not choice_is_available(self.jobChainLink.link, chain, django_settings): continue self.choices.append((chain_id, chain["description"], None))
def _get_options_for_chain_choice(link, workflow, ignored_choices): ret = [] for chain_id in link.config["chain_choices"]: chain = workflow.get_chain(chain_id) label = chain.get_label("description") if label in ignored_choices: continue if not choice_is_available(link, chain, django_settings): continue ret.append((chain_id, label)) return ret
def test_choice_is_available__disabled(settings, _workflow): """<Send to backlog> is not going to be shown to the user.""" settings.SEARCH_ENABLED = ("aips") link = _workflow.get_link(CREATE_SIP_LINK_ID) chain = _workflow.get_chain(SEND_TO_BACKLOG_CHAIN_ID) assert choice_is_available(link, chain, settings) is False