@frappe.whitelist()
def get_js(items):
 items = json.loads(items)
 out = []
 for src in items:
  src = src.strip(u'/').split(u'/')
  if ((u'..' in src) or (src[0] != u'assets')):
   frappe.throw(_(u'Invalid file path: {0}').format(u'/'.join(src)))
  contentpath = os.path.join(frappe.local.sites_path, *src)
  with open(contentpath, u'r') as srcfile:
   code = frappe.utils.cstr(srcfile.read())
  if (frappe.local.lang != u'en'):
   messages = frappe.get_lang_dict(u'jsfile', contentpath)
   messages = json.dumps(messages)
   code += u'\n\n$.extend(frappe._messages, {})'.format(messages)
  out.append(code)
 return out

@ frappe . whitelist ( ) def get_js ( items ) : items = json . loads ( items ) out = [ ] for src in items : src = src . strip ( u'/' ) . split ( u'/' ) if ( ( u'..' in src ) or ( src [ 0 ] != u'assets' ) ) : frappe . throw ( _ ( u'Invalid file path: {0}' ) . format ( u'/' . join ( src ) ) ) contentpath = os . path . join ( frappe . local . sites_path , * src ) with open ( contentpath , u'r' ) as srcfile : code = frappe . utils . cstr ( srcfile . read ( ) ) if ( frappe . local . lang != u'en' ) : messages = frappe . get_lang_dict ( u'jsfile' , contentpath ) messages = json . dumps ( messages ) code += u'\n\n$.extend(frappe._messages, {})' . format ( messages ) out . append ( code ) return out
load js code files .