Browse Source

fix: Convert only as_dict and debug values to bool

Given the scope of its usage at this point, this becomes a problem when you'd have a field named y,n, true, false and order_by that field, or have the same values for a document name that parent parameter would accept out of all those that Frappe REST allows.
version-14
Gavin D'souza 4 years ago
parent
commit
b215921a97
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      frappe/api.py

+ 5
- 4
frappe/api.py View File

@@ -119,10 +119,11 @@ def handle():
frappe.local.form_dict.limit or frappe.local.form_dict.limit_page_length or 20,
)

# convert strings to native types
frappe.local.form_dict.update(
{x: sbool(y) for x, y in frappe.local.form_dict.items()}
)
# convert strings to native types - only as_dict and debug accept bool
for param in ["as_dict", "debug"]:
param_val = frappe.local.form_dict.get(param)
if param_val is not None:
frappe.local.form_dict[param] = sbool(param_val)

# evaluate frappe.get_list
data = frappe.call(frappe.client.get_list, doctype, **frappe.local.form_dict)


Loading…
Cancel
Save