style: formatted code

This commit is contained in:
Aradhya-Tripathi 2021-10-05 18:23:46 +05:30
parent 3b25bde3ac
commit 2a241bd2dc
2 changed files with 2 additions and 5 deletions

View file

@ -27,8 +27,7 @@ class TestSafeExec(unittest.TestCase):
def test_query_builder(self):
_locals = dict(out=None)
safe_exec(script='''out = frappe.qb.from_("User").select(frappe.qb.terms.PseudoColumn("Max(name)")).run()''',
_globals=None, _locals=_locals)
safe_exec(script='''out = frappe.qb.from_("User").select(frappe.qb.terms.PseudoColumn("Max(name)")).run()''', _globals=None, _locals=_locals)
self.assertEqual(frappe.db.sql("SELECT Max(name) FROM tabUser"), _locals["out"])
def test_safe_query_builder(self):

View file

@ -32,10 +32,8 @@ class NamespaceDict(frappe._dict):
def get_safe_query_builder():
"""Allows execution of SELECT SQL queries only.
Raises:
PermissionsError raised on execution of any other SQL query.
PermissionsError raised on execution of any other SQL query
"""
query_class = get_attr(str(frappe.qb).split("'")[1])
class SafeQB(query_class):