Fixed SQLAlchemy operation error with the boolean value as true/false for Python version < 3.7

This commit is contained in:
Khushboo Vashi
2020-10-01 13:05:53 +05:30
committed by Akshay Joshi
parent 656e239e55
commit 228d4bb321
2 changed files with 12 additions and 12 deletions

View File

@@ -162,13 +162,13 @@ def update_macro(data, macro):
:param macro: macro
"""
name = getattr(data, 'name', None)
sql = getattr(data, 'sql', None)
name = data.get('name', None)
sql = data.get('sql', None)
if name or sql and macro.sql and name is None:
if name or sql and macro.sql and 'name' in data and name is None:
return False, gettext(
"Could not find the required parameter (name).")
elif name or sql and macro.name and sql is None:
elif name or sql and macro.name and 'sql' in data and sql is None:
return False, gettext(
"Could not find the required parameter (sql).")