[minor] ignore_csrf in site_config and to check for autoname in hooks even if not autoname is present

This commit is contained in:
Rushabh Mehta 2016-05-29 23:06:51 +05:30
parent 6824df7ac9
commit d235f159bb
2 changed files with 6 additions and 4 deletions

View file

@ -64,7 +64,9 @@ class HTTPRequest:
def validate_csrf_token(self):
if frappe.local.request and frappe.local.request.method=="POST":
if not frappe.local.session.data.csrf_token or frappe.local.session.data.device=="mobile":
if not frappe.local.session.data.csrf_token \
or frappe.local.session.data.device=="mobile" \
or frappe.conf.get('ignore_csrf', None):
# not via boot
return

View file

@ -30,10 +30,10 @@ def set_new_name(doc):
elif getattr(doc.meta, "issingle", False):
doc.name = doc.doctype
elif hasattr(doc, "autoname"):
else:
doc.run_method("autoname")
elif autoname:
if not doc.name and autoname:
if autoname.startswith('field:'):
fieldname = autoname[6:]
doc.name = (doc.get(fieldname) or "").strip()
@ -195,7 +195,7 @@ def append_number_if_name_exists(doc):
count = "1"
doc.name = "{0}-{1}".format(doc.name, count)
return doc
def de_duplicate(doctype, name):