Example #1
0
 def _get_active_rules(self):
     """
     :o.leave_days<7
     [vicalloy]
     :o.leave_days>=7
     [tom]
     """
     rules = [e.strip() for e in self.param.splitlines() if e.strip()]
     str_rules = ''
     need_add = True
     for rule in rules:
         is_condition = rule.startswith(':')
         if not is_condition and not need_add:
             continue
         if is_condition:
             need_add = safe_eval(rule[1:], {'o': self.wf_obj})
             continue
         str_rules = '%s,%s' % (str_rules, rule)
     return [e.strip() for e in str_rules.split(',') if e.strip()]
Example #2
0
 def is_match_condition(self, wf_obj):
     if not self.condition.strip():
         return True
     return safe_eval(self.condition, {'o': wf_obj})
Example #3
0
 def _get_eval_val(self, eval_str):
     return safe_eval(eval_str, {'o': self.wf_obj})