def _check_python_code(self): for rec in self.sudo().filtered('approve_python_code'): try: msg = test_python_expr(expr=rec.approve_python_code.strip(), mode="exec") except: raise ValidationError(_('Invalid python syntax')) if msg: raise ValidationError(msg) for rec in self.sudo().filtered('refuse_python_code'): try: msg = test_python_expr(expr=rec.refuse_python_code.strip(), mode="exec") except: raise ValidationError(_('Invalid python syntax')) if msg: raise ValidationError(msg)
def _check_python_code_syntax(self, field_name): """ Syntax check the python code """ for record in self: code = getattr(record, field_name).strip() msg = test_python_expr(expr=code, mode='exec') if msg: raise exceptions.ValidationError(msg)
def _check_python_code(self): for action in self.sudo().filtered('code'): msg = test_python_expr(expr=action.code.strip(), mode="exec") if msg: raise ValidationError(msg)
def _check_python_code(self): for r in self.sudo(): msg = test_python_expr(expr=r.template_post_init.strip(), mode="exec") if msg: raise ValidationError(msg)
def _check_code(self): for record in self.sudo().filtered('code'): message = test_python_expr(expr=record.code.strip(), mode="exec") if message: raise ValidationError(message)
def _check_python_field(self, field_name): for step in self.sudo().filtered(field_name): msg = test_python_expr(expr=step[field_name].strip(), mode="exec") if msg: raise ValidationError(msg)
def _check_python_code(self): for song in self.filtered('python_code'): msg = test_python_expr(expr=self.python_code.strip(), mode="exec") if msg: raise exceptions.ValidationError(msg)
def _check_webhook_process(self): for record in self.sudo().filtered('webhook_process'): message = test_python_expr(expr=record.webhook_process.strip(), mode="exec") if message: raise ValidationError(message)
def _check_python_text_fill(self): for action in self.filtered('text_fill'): msg = test_python_expr(expr=action.text_fill.strip(), mode="exec") if msg: raise ValidationError(msg)
def _check_python_code(self): for r in self.sudo().filtered("common_code"): msg = test_python_expr(expr=(r.common_code or "").strip(), mode="exec") if msg: raise ValidationError(msg)
def onchange_code(self): for r in self: if not r.code: continue msg = test_python_expr(expr=r.code, mode="exec") r.code_check = msg
def _check_params(self): for action in self.filtered('params'): msg = test_python_expr(expr=action.params.strip(), mode='eval') if msg: raise ValidationError(msg)
def _check_python_code(self): for item in self.sudo().filtered("post_code"): msg = test_python_expr(expr=item.post_code.strip(), mode="exec") if msg: raise ValidationError(msg)