fix: Validate Python syntax on saves

This commit is contained in:
Gavin D'souza 2020-11-27 11:01:49 +05:30 committed by Shivam Mishra
parent 8ff2b57b35
commit b3d52fcd57

View file

@ -4,6 +4,8 @@
from __future__ import unicode_literals
import ast
import frappe
from frappe.model.document import Document
from frappe.utils.safe_exec import safe_exec
@ -11,9 +13,9 @@ from frappe import _
class ServerScript(Document):
@staticmethod
def validate():
def validate(self):
frappe.only_for('Script Manager', True)
ast.parse(self.script)
@staticmethod
def on_update():