[fix] strip whitespace in setup wizard args
This commit is contained in:
parent
1d23ebb51d
commit
77760db89c
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, json, copy
|
import frappe, json, copy
|
||||||
|
|
||||||
from frappe.utils import cstr, flt, getdate
|
from frappe.utils import cstr, flt, getdate, strip
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils.file_manager import save_file
|
from frappe.utils.file_manager import save_file
|
||||||
from frappe.translate import (set_default_language, get_dict,
|
from frappe.translate import (set_default_language, get_dict,
|
||||||
@ -23,12 +23,7 @@ def setup_account(args=None):
|
|||||||
if frappe.db.sql("select name from tabCompany"):
|
if frappe.db.sql("select name from tabCompany"):
|
||||||
frappe.throw(_("Setup Already Complete!!"))
|
frappe.throw(_("Setup Already Complete!!"))
|
||||||
|
|
||||||
if not args:
|
args = process_args(args)
|
||||||
args = frappe.local.form_dict
|
|
||||||
if isinstance(args, basestring):
|
|
||||||
args = json.loads(args)
|
|
||||||
|
|
||||||
args = frappe._dict(args)
|
|
||||||
|
|
||||||
if args.language and args.language != "english":
|
if args.language and args.language != "english":
|
||||||
set_default_language(args.language)
|
set_default_language(args.language)
|
||||||
@ -109,6 +104,21 @@ def setup_account(args=None):
|
|||||||
frappe.get_attr(hook)(args)
|
frappe.get_attr(hook)(args)
|
||||||
|
|
||||||
|
|
||||||
|
def process_args(args):
|
||||||
|
if not args:
|
||||||
|
args = frappe.local.form_dict
|
||||||
|
if isinstance(args, basestring):
|
||||||
|
args = json.loads(args)
|
||||||
|
|
||||||
|
args = frappe._dict(args)
|
||||||
|
|
||||||
|
# strip the whitespace
|
||||||
|
for key, value in args.items():
|
||||||
|
if isinstance(value, basestring):
|
||||||
|
args[key] = strip(value)
|
||||||
|
|
||||||
|
return args
|
||||||
|
|
||||||
def update_user_name(args):
|
def update_user_name(args):
|
||||||
if args.get("email"):
|
if args.get("email"):
|
||||||
args['name'] = args.get("email")
|
args['name'] = args.get("email")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user