def is_valid(self): missing = self.depends_on - set(self.context.keys()) if missing: raise exceptions.WorkflowValidationError( "Unable to complete the workflow. The values %s are " "required but not present." % ", ".join(missing)) checked_steps = [] if "general_processes" in self.context: checked_steps = self.context["general_processes"] enabled_services = set([]) for process_name in checked_steps: enabled_services.add(str(process_name).split(":")[0]) steps_valid = True for step in self.steps: process_name = str(getattr(step, "process_name", None)) if process_name not in enabled_services and \ not isinstance(step, GeneralConfig): continue if not step.action.is_valid(): steps_valid = False step.has_errors = True if not steps_valid: return steps_valid return self.validate(self.context)
def is_valid(self): """Verified that all required data is present in the context and calls the ``validate`` method to allow for finer-grained checks on the context data. """ missing = self.depends_on - set(self.context.keys()) if missing: raise exceptions.WorkflowValidationError( "Unable to complete the workflow. The values %s are " "required but not present." % ", ".join(missing)) # Validate each step. Cycle through all of them to catch all errors # in one pass before returning. steps_valid = True for step in self.steps: if not step.action.is_valid(): steps_valid = False step.has_errors = True if need_post_check_when_account_is_frozen(self): steps_valid = False step.has_errors = True step.action.add_error(None, _('(Account in debt, Please recharge.)')) break if not steps_valid: return steps_valid return self.validate(self.context)
def is_valid(self): """Verifies that all required data is present in the context. It also calls the ``validate`` method to allow for finer-grained checks on the context data. """ missing = self.depends_on - set(self.context.keys()) if missing: raise exceptions.WorkflowValidationError( "Unable to complete the workflow. The values %s are " "required but not present." % ", ".join(missing)) # Validate each step. Cycle through all of them to catch all errors # in one pass before returning. steps_valid = True for step in self.steps: if not step.action.is_valid(): steps_valid = False step.has_errors = True if not steps_valid: return steps_valid return self.validate(self.context)