Browse Source

Clear publish data function

master
venkataakhil 1 year ago
parent
commit
ddfcb22b11
  1. 8
      smart_service/apis/master_api.py
  2. 16
      smart_service/apis/support.py

8
smart_service/apis/master_api.py

@ -21,14 +21,6 @@ base_path = os.path.expanduser(
"~") + "/frappe-bench/sites/" + site_name + "/public" "~") + "/frappe-bench/sites/" + site_name + "/public"
@frappe.whitelist(allow_guest=True)
def masters1():
rate_res = custom_rate_limit(limit=5, seconds=10)
if rate_res != 1:
return rate_res
return 1
def custom_rate_limit(limit, seconds): def custom_rate_limit(limit, seconds):
ip_based = True ip_based = True
ip = frappe.local.request_ip if ip_based is True else None ip = frappe.local.request_ip if ip_based is True else None

16
smart_service/apis/support.py

@ -404,6 +404,18 @@ def set_procedure_false():
frappe.db.sql('''update `tabSystem Mapping_Sub System` set procedure_is_published=0; frappe.db.sql('''update `tabSystem Mapping_Sub System` set procedure_is_published=0;
''') ''')
frappe.db.commit() frappe.db.commit()
return 1 return True
except Exception as e: except Exception as e:
return e return False
@frappe.whitelist(allow_guest=1)
def clear_procedures():
try:
set_procedure_false()
frappe.db.sql('''delete FROM `tabPublish`;''')
frappe.db.sql('''delete FROM `tabPublish_Docs`;''')
frappe.db.commit()
except Exception as e:
return e

Loading…
Cancel
Save