Beispiel #1
0
def update_language(doclist):
	"""update language"""
	if webnotes.lang != 'en':
		from webnotes.modules import get_doc_path
		if not hasattr(webnotes.local, 'translations'):
			webnotes.local.translations = {}
		translations = webnotes.local.translations

		# load languages for each doctype
		from webnotes.translate import get_lang_data
		_messages = {}

		for d in doclist:
			if d.doctype=='DocType':
				_messages.update(get_lang_data(get_doc_path(d.module, d.doctype, d.name), 
					webnotes.lang, 'doc'))
				_messages.update(get_lang_data(get_doc_path(d.module, d.doctype, d.name), 
					webnotes.lang, 'js'))

		doc = doclist[0]

		# attach translations to client
		doc.fields["__messages"] = _messages
		
		if not webnotes.lang in translations:
			translations[webnotes.lang] = webnotes._dict({})
		translations[webnotes.lang].update(_messages)
Beispiel #2
0
def update_language(doclist):
    """update language"""
    if webnotes.lang != 'en':
        from webnotes.translate import messages
        from webnotes.modules import get_doc_path

        # load languages for each doctype
        from webnotes.translate import get_lang_data
        _messages = {}

        for d in doclist:
            if d.doctype == 'DocType':
                _messages.update(
                    get_lang_data(get_doc_path(d.module, d.doctype, d.name),
                                  webnotes.lang, 'doc'))
                _messages.update(
                    get_lang_data(get_doc_path(d.module, d.doctype, d.name),
                                  webnotes.lang, 'js'))

        doc = doclist[0]

        # attach translations to client
        doc.fields["__messages"] = _messages

        if not webnotes.lang in messages:
            messages[webnotes.lang] = webnotes._dict({})
        messages[webnotes.lang].update(_messages)
Beispiel #3
0
def build_from_query_report():
	"""make locale for the query reports from database and the framework js and py files"""
	import re
	for item in webnotes.conn.sql("""select name, report_name,ref_doctype, query 
			from `tabReport`""", as_dict=1):
		messages_js, messages_py = [], []

		if item:
			messages_js.append(item.report_name)
			messages_py.append(item.report_name)
			# get the messages from the query using the regex :
			# if we have the string "Production Date:Date:180" in the query then the regex will search for string between " and : .
			# the regex will take "Production Date" and store them into messages
			if item.query :
				messages_query = re.findall('"([^:,^"]*):', item.query)
				messages_js += messages_query
				messages_py += messages_query
			
			module = get_doctype_module(item.ref_doctype)		
			if module :
				doctype_path = get_doc_path(module, "Report", item.name)
				if os.path.exists(doctype_path):
					for (basepath, folders, files) in os.walk(doctype_path):
						if 'locale' in folders: folders.remove('locale')
						for fname in files:
							if fname.endswith('.js'):
								messages_js += get_message_list(os.path.join(basepath, fname))	
							if fname.endswith('.py'):
								messages_py += get_message_list(os.path.join(basepath, fname))
						break			
					write_messages_file(doctype_path, messages_js, 'js')
					write_messages_file(doctype_path, messages_py, 'py')
Beispiel #4
0
def build_for_modules():
    """doctype descriptions, module names, etc for each module"""
    from webnotes.modules import get_module_path, get_doc_path

    for m in webnotes.conn.sql("""select name from `tabModule Def`"""):
        module_path = get_module_path(m[0])
        if os.path.exists(module_path):
            messages = []
            messages += [
                t[0] for t in webnotes.conn.sql(
                    """select description from tabDocType 
				where module=%s""", m[0])
            ]
            for t in webnotes.conn.sql(
                    """select 
				if(ifnull(title,'')='',name,title)
				from tabPage where module=%s 
				and ifnull(standard,'No')='Yes' """, m[0]):
                messages.append(t[0])
            messages += [
                t[0] for t in webnotes.conn.sql(
                    """select t1.name from 
				tabReport t1, tabDocType t2 where
				t1.ref_doctype = t2.name and
				t1.is_standard = "Yes" and
				t2.module = %s""", m[0])
            ]

            doctype_path = get_doc_path(m[0], 'Module Def', m[0])
            write_messages_file(doctype_path, messages, 'doc')
Beispiel #5
0
def build_from_query_report():
	"""make locale for the query reports from database and the framework js and py files"""
	import re
	for item in webnotes.conn.sql("""select name, report_name,ref_doctype, query 
			from `tabReport`""", as_dict=1):
		messages_js, messages_py = [], []

		if item:
			messages_js.append(item.report_name)
			messages_py.append(item.report_name)
			# get the messages from the query using the regex :
			# if we have the string "Production Date:Date:180" in the query then the regex will search for string between " and : .
			# the regex will take "Production Date" and store them into messages
			if item.query :
				messages_query = re.findall('"([^:,^"]*):', item.query)
				messages_js += messages_query
				messages_py += messages_query
			
			module = get_doctype_module(item.ref_doctype)		
			if module :
				doctype_path = get_doc_path(module, "Report", item.name)
				if os.path.exists(doctype_path):
					for (basepath, folders, files) in os.walk(doctype_path):
						if 'locale' in folders: folders.remove('locale')
						for fname in files:
							if fname.endswith('.js'):
								messages_js += get_message_list(os.path.join(basepath, fname))	
							if fname.endswith('.py'):
								messages_py += get_message_list(os.path.join(basepath, fname))
						break			
					write_messages_file(doctype_path, messages_js, 'js')
					write_messages_file(doctype_path, messages_py, 'py')
Beispiel #6
0
	def make_controller_template(self):
		from webnotes.modules import get_doc_path, get_module_path, scrub
		
		pypath = os.path.join(get_doc_path(self.doc.module, 
			self.doc.doctype, self.doc.name), scrub(self.doc.name) + '.py')

		if not os.path.exists(pypath):
			with open(pypath, 'w') as pyfile:
				with open(os.path.join(get_module_path("core"), "doctype", "doctype", 
					"doctype_template.py"), 'r') as srcfile:
					pyfile.write(srcfile.read())
Beispiel #7
0
	def make_controller_template(self):
		from webnotes.modules import get_doc_path, get_module_path, scrub
		
		pypath = os.path.join(get_doc_path(self.doc.module, 
			self.doc.doctype, self.doc.name), scrub(self.doc.name) + '.py')

		if not os.path.exists(pypath):
			with open(pypath, 'w') as pyfile:
				with open(os.path.join(get_module_path("core"), "doctype", "doctype", 
					"doctype_template.py"), 'r') as srcfile:
					pyfile.write(srcfile.read())
def get_print_style(style=None):
    if not style:
        style = webnotes.conn.get_default("print_style") or "Standard"
    path = os.path.join(get_doc_path("Core", "DocType", "Print Format"), "styles", style.lower() + ".css")
    if not os.path.exists(path):
        if style != "Standard":
            return get_print_style("Standard")
        else:
            return "/* Standard Style Missing ?? */"
    else:
        with open(path, "r") as sfile:
            return sfile.read()
def update_readme(mydocs, module, doctype=None, name=None):
	if doctype:
		readme_path = os.path.join(get_doc_path(module, doctype, name), "README.md")
	else:
		readme_path = os.path.join(get_module_path(module), "README.md")
	
	mydocs["_intro"] = ""
	
	if os.path.exists(readme_path):
		with open(readme_path, "r") as readmefile:
			mydocs["_intro"] = readmefile.read()
		mydocs["_modified"] = get_timestamp(readme_path)
def update_language(doclist):
	"""update language"""
	if webnotes.lang != 'en':
		from webnotes import _
		from webnotes.modules import get_doc_path

		# load languages for each doctype
		from webnotes.translate import get_lang_data, update_lang_js
		_messages = {}

		for d in doclist:
			if d.doctype=='DocType':
				_messages.update(get_lang_data(get_doc_path(d.module, d.doctype, d.name), 
					webnotes.lang, 'doc'))
				_messages.update(get_lang_data(get_doc_path(d.module, d.doctype, d.name), 
					webnotes.lang, 'js'))

		doc = doclist[0]

		# attach translations to client
		doc.fields["__messages"] = _messages
Beispiel #11
0
def get_print_style(style=None):
	if not style:
		style = webnotes.conn.get_default("print_style") or "Standard"
	path = os.path.join(get_doc_path("Core", "DocType", "Print Format"), "styles", 
		style.lower() + ".css")
	if not os.path.exists(path):
		if style!="Standard":
			return get_print_style("Standard")
		else:
			return "/* Standard Style Missing ?? */"
	else:
		with open(path, 'r') as sfile:
			return sfile.read() + """ \* test *\ """
Beispiel #12
0
def update_readme(mydocs, module, doctype=None, name=None):
    if doctype:
        readme_path = os.path.join(get_doc_path(module, doctype, name),
                                   "README.md")
    else:
        readme_path = os.path.join(get_module_path(module), "README.md")

    mydocs["_intro"] = ""

    if os.path.exists(readme_path):
        with open(readme_path, "r") as readmefile:
            mydocs["_intro"] = readmefile.read()
        mydocs["_modified"] = get_timestamp(readme_path)
Beispiel #13
0
def get_print_format(doctype, format):
	# server, find template
	path = os.path.join(get_doc_path(webnotes.conn.get_value("DocType", doctype, "module"), 
		"Print Format", format), format + ".html")
	if os.path.exists(path):
		with open(path, "r") as pffile:
			return pffile.read()
	else:
		html = webnotes.conn.get_value("Print Format", format, "html")
		if html:
			return html
		else:
			return "No template found.\npath: " + path
Beispiel #14
0
def get_print_format(doctype, format):
	# server, find template
	path = os.path.join(get_doc_path(webnotes.conn.get_value("DocType", doctype, "module"), 
		"Print Format", format), format + ".html")
	if os.path.exists(path):
		with open(path, "r") as pffile:
			return pffile.read()
	else:
		html = webnotes.conn.get_value("Print Format", format, "html")
		if html:
			return html
		else:
			return "No template found.\npath: " + path
def load_doc_messages(module, doctype, name):
	if webnotes.lang=="en":
		return {}

	global docs_loaded
	doc_path = get_doc_path(module, doctype, name)

	# don't repload the same doc again
	if (webnotes.lang + ":" + doc_path) in docs_loaded:
		return

	docs_loaded.append(webnotes.lang + ":" + doc_path)

	global messages
	messages.update(get_lang_data(doc_path, None, 'doc'))
Beispiel #16
0
def update_language(doclist):
    """update language"""
    if webnotes.lang != "en":
        from webnotes.translate import messages
        from webnotes.modules import get_doc_path

        # load languages for each doctype
        from webnotes.translate import get_lang_data

        _messages = {}

        for d in doclist:
            if d.doctype == "DocType":
                _messages.update(get_lang_data(get_doc_path(d.module, d.doctype, d.name), webnotes.lang, "doc"))
                _messages.update(get_lang_data(get_doc_path(d.module, d.doctype, d.name), webnotes.lang, "js"))

        doc = doclist[0]

        # attach translations to client
        doc.fields["__messages"] = _messages

        if not webnotes.lang in messages:
            messages[webnotes.lang] = webnotes._dict({})
        messages[webnotes.lang].update(_messages)
Beispiel #17
0
def load_doc_messages(module, doctype, name):
    if webnotes.lang == "en":
        return {}

    global docs_loaded
    doc_path = get_doc_path(module, doctype, name)

    # don't repload the same doc again
    if (webnotes.lang + ":" + doc_path) in docs_loaded:
        return

    docs_loaded.append(webnotes.lang + ":" + doc_path)

    global messages
    messages.update(get_lang_data(doc_path, None, 'doc'))
Beispiel #18
0
def build_for_doc_from_database(fields):
	for item in webnotes.conn.sql("""select name from `tab%s`""" % fields.doctype, as_dict=1):
		messages = []
		doclist = webnotes.bean(fields.doctype, item.name).doclist

		for doc in doclist:
			if doc.doctype in fields:
				messages += map(lambda x: x in fields[doc.doctype] and doc.fields.get(x) or None, 
					doc.fields.keys())
					
			if fields.custom:
				messages += fields.custom(doc)	
		
		doc = doclist[0]
		if doc.fields.get(fields.module_field):
			doctype_path = get_doc_path(doc.fields[fields.module_field], 
				doc.doctype, doc.name)
			write_messages_file(doctype_path, messages, 'doc')
Beispiel #19
0
def build_for_doc_from_database(fields):
	for item in webnotes.conn.sql("""select name from `tab%s`""" % fields.doctype, as_dict=1):
		messages = []
		doclist = webnotes.bean(fields.doctype, item.name).doclist

		for doc in doclist:
			if doc.doctype in fields:
				messages += map(lambda x: x in fields[doc.doctype] and doc.fields.get(x) or None, 
					doc.fields.keys())
					
			if fields.custom:
				messages += fields.custom(doc)	
		
		doc = doclist[0]
		if doc.fields.get(fields.module_field):
			doctype_path = get_doc_path(doc.fields[fields.module_field], 
				doc.doctype, doc.name)
			write_messages_file(doctype_path, messages, 'doc')
Beispiel #20
0
def load_doc_messages(module, doctype, name):
    if webnotes.lang == "en":
        return {}

    if not webnotes.local.translated_docs:
        webnotes.local.translated_docs = []

    doc_path = get_doc_path(module, doctype, name)

    # don't repload the same doc again
    if (webnotes.lang + ":" + doc_path) in webnotes.local.translated_docs:
        return

    if not docs_loaded:
        webnotes.local.translate_docs_loaded = []
    webnotes.local.translated_docs.append(webnotes.lang + ":" + doc_path)

    webnotes.local.translations.update(get_lang_data(doc_path, None, 'doc'))
Beispiel #21
0
def load_doc_messages(module, doctype, name):
	if webnotes.lang=="en":
		return {}

	if not webnotes.local.translated_docs:
		webnotes.local.translated_docs = []

	doc_path = get_doc_path(module, doctype, name)

	# don't repload the same doc again
	if (webnotes.lang + ":" + doc_path) in webnotes.local.translated_docs:
		return

	if not docs_loaded:
		webnotes.local.translate_docs_loaded = []
	webnotes.local.translated_docs.append(webnotes.lang + ":" + doc_path)

	webnotes.local.translations.update(get_lang_data(doc_path, None, 'doc'))
Beispiel #22
0
def getpage():
    """
	   Load the page from `webnotes.form` and send it via `webnotes.response`
	"""
    page = webnotes.form_dict.get("name")
    doclist = get(page)

    if has_permission(doclist):
        # load translations
        if webnotes.lang != "en":
            from webnotes.modules import get_doc_path
            from webnotes.translate import get_lang_data

            d = doclist[0]
            messages = get_lang_data(get_doc_path(d.module, d.doctype, d.name), webnotes.lang, "js")
            webnotes.response["__messages"] = messages

        webnotes.response["docs"] = doclist
    else:
        webnotes.response["403"] = 1
        raise webnotes.PermissionError, "No read permission for Page %s" % (doclist[0].title or page,)
Beispiel #23
0
def getpage():
    """
	   Load the page from `webnotes.form` and send it via `webnotes.response`
	"""
    page = webnotes.form_dict.get('name')
    doclist = get(page)

    if has_permission(doclist):
        # load translations
        if webnotes.lang != "en":
            from webnotes.modules import get_doc_path
            from webnotes.translate import get_lang_data
            d = doclist[0]
            messages = get_lang_data(get_doc_path(d.module, d.doctype, d.name),
                                     webnotes.lang, 'js')
            webnotes.response["__messages"] = messages

        webnotes.response['docs'] = doclist
    else:
        webnotes.response['403'] = 1
        raise webnotes.PermissionError, 'No read permission for Page %s' % \
         (doclist[0].title or page, )
Beispiel #24
0
def build_for_modules():
	"""doctype descriptions, module names, etc for each module"""
	from webnotes.modules import get_module_path, get_doc_path
	
	for m in webnotes.conn.sql("""select name from `tabModule Def`"""):
		module_path = get_module_path(m[0])
		if os.path.exists(module_path):
			messages = []
			messages += [t[0] for t in webnotes.conn.sql("""select description from tabDocType 
				where module=%s""", m[0])]
			for t in webnotes.conn.sql("""select 
				if(ifnull(title,'')='',name,title)
				from tabPage where module=%s 
				and ifnull(standard,'No')='Yes' """, m[0]):
				messages.append(t[0])
			messages += [t[0] for t in webnotes.conn.sql("""select t1.name from 
				tabReport t1, tabDocType t2 where
				t1.ref_doctype = t2.name and
				t1.is_standard = "Yes" and
				t2.module = %s""", m[0])]

			doctype_path = get_doc_path(m[0], 'Module Def', m[0])
			write_messages_file(doctype_path, messages, 'doc')
Beispiel #25
0
def get_doc_messages(module, doctype, name):
	from webnotes.modules import get_doc_path
	return get_lang_data(get_doc_path(module, doctype, name), None, 'doc')
Beispiel #26
0
def get_doc_messages(module, doctype, name):
    from webnotes.modules import get_doc_path
    return get_lang_data(get_doc_path(module, doctype, name), None, 'doc')
def get_doctypes(m):
	doctypes = webnotes.conn.sql_list("""select name from 
		tabDocType where module=%s order by name""", m)
	prefix = "docs.dev.modules." + m + ".doctype."
	docs = {
		"_icon": "th",
		"_label": "DocTypes",
		"_toc": [prefix + d for d in doctypes]
	}
	
	for d in doctypes:
		meta = webnotes.get_doctype(d)
		meta_p = webnotes.get_doctype(d, True)
		doc_path = get_doc_path(m, "DocType", d)
		
		mydocs = docs[d] = {
			"_label": d,
			"_icon": meta[0].icon,
			"_type": "doctype",
			"_gh_source": get_gh_url(doc_path),
			"_toc": [
				prefix + d + ".model",
				prefix + d + ".permissions",
				prefix + d + ".controller_server"
			],
		}

		update_readme(mydocs, m, "DocType", d)

		# parents and links
		links, parents = [], []
		for df in webnotes.conn.sql("""select * from tabDocField where options=%s""", 
			d, as_dict=True):
			if df.parent:
				if df.fieldtype=="Table":
					parents.append(df.parent)
				if df.fieldtype=="Link":
					links.append(df.parent)
				
		if parents:
			mydocs["_intro"] += "\n\n#### Child Table Of:\n\n- " + "\n- ".join(list(set(parents))) + "\n\n"

		if links:
			mydocs["_intro"] += "\n\n#### Linked In:\n\n- " + "\n- ".join(list(set(links))) + "\n\n"
			
		if meta[0].issingle:
			mydocs["_intro"] += "\n\n#### Single DocType\n\nThere is no table for this DocType and the values of the Single instance are stored in `tabSingles`"

		# model
		modeldocs = mydocs["model"] = {
			"_label": d + " Model",
			"_icon": meta[0].icon,
			"_type": "model",
			"_intro": "Properties and fields for " + d,
			"_gh_source": get_gh_url(os.path.join(doc_path, scrub(d) + ".txt")),
			"_fields": [df.fields for df in meta.get({"doctype": "DocField"})],
			"_properties": meta[0].fields,
			"_modified": meta[0].modified
		}
		
		# permissions
		from webnotes.modules.utils import peval_doclist
		with open(os.path.join(doc_path, 
			scrub(d) + ".txt"), "r") as txtfile:
			doclist = peval_doclist(txtfile.read())
			
		permission_docs = mydocs["permissions"] = {
			"_label": d + " Permissions",
			"_type": "permissions",
			"_icon": meta[0].icon,
			"_gh_source": get_gh_url(os.path.join(doc_path, scrub(d) + ".txt")),
			"_intro": "Standard Permissions for " + d + ". These can be changed by the user.",
			"_permissions": [p for p in doclist if p.doctype=="DocPerm"],
			"_modified": doclist[0]["modified"]
		}
			
		# server controller
		server_controller_path = os.path.join(doc_path, scrub(d) + ".py")
		controller_docs = mydocs["controller_server"] = {
			"_label": d + " Server Controller",
			"_type": "_class",
			"_gh_source": get_gh_url(server_controller_path)
		}
		
		b = webnotes.bean([{"doctype": d}])
		b.make_controller()
		if not getattr(b.controller, "__doc__"):
			b.controller.__doc__ = "Controller Class for handling server-side events for " + d
		inspect_object_and_update_docs(controller_docs, b.controller)

		# client controller
		if meta_p[0].fields.get("__js"):
			client_controller_path = os.path.join(doc_path, scrub(d) + ".js")
			if(os.path.exists(client_controller_path)):
				mydocs["_toc"].append(prefix + d + ".controller_client")
				client_controller = mydocs["controller_client"] = {
					"_label": d + " Client Controller",
					"_icon": meta[0].icon,
					"_type": "controller_client",
					"_gh_source": get_gh_url(client_controller_path),
					"_modified": get_timestamp(client_controller_path),
					"_intro": "Client side triggers and functions for " + d,
					"_code": meta_p[0].fields["__js"],
					"_fields": [d.fieldname for d in meta_p if d.doctype=="DocField"]
				}

	return docs
Beispiel #28
0
def get_doctypes(m):
    doctypes = webnotes.conn.sql_list(
        """select name from 
		tabDocType where module=%s order by name""", m)
    prefix = "docs.dev.modules." + m + ".doctype."
    docs = {
        "_icon": "th",
        "_label": "DocTypes",
        "_toc": [prefix + d for d in doctypes]
    }

    for d in doctypes:
        meta = webnotes.get_doctype(d)
        meta_p = webnotes.get_doctype(d, True)
        doc_path = get_doc_path(m, "DocType", d)

        mydocs = docs[d] = {
            "_label":
            d,
            "_icon":
            meta[0].icon,
            "_type":
            "doctype",
            "_gh_source":
            get_gh_url(doc_path),
            "_toc": [
                prefix + d + ".model", prefix + d + ".permissions",
                prefix + d + ".controller_server"
            ],
        }

        update_readme(mydocs, m, "DocType", d)

        # parents and links
        links, parents = [], []
        for df in webnotes.conn.sql(
                """select * from tabDocField where options=%s""", d,
                as_dict=True):
            if df.parent:
                if df.fieldtype == "Table":
                    parents.append(df.parent)
                if df.fieldtype == "Link":
                    links.append(df.parent)

        if parents:
            mydocs["_intro"] += "\n\n#### Child Table Of:\n\n- " + "\n- ".join(
                list(set(parents))) + "\n\n"

        if links:
            mydocs["_intro"] += "\n\n#### Linked In:\n\n- " + "\n- ".join(
                list(set(links))) + "\n\n"

        if meta[0].issingle:
            mydocs[
                "_intro"] += "\n\n#### Single DocType\n\nThere is no table for this DocType and the values of the Single instance are stored in `tabSingles`"

        # model
        modeldocs = mydocs["model"] = {
            "_label": d + " Model",
            "_icon": meta[0].icon,
            "_type": "model",
            "_intro": "Properties and fields for " + d,
            "_gh_source": get_gh_url(os.path.join(doc_path,
                                                  scrub(d) + ".txt")),
            "_fields": [df.fields for df in meta.get({"doctype": "DocField"})],
            "_properties": meta[0].fields,
            "_modified": meta[0].modified
        }

        # permissions
        from webnotes.modules.utils import peval_doclist
        with open(os.path.join(doc_path, scrub(d) + ".txt"), "r") as txtfile:
            doclist = peval_doclist(txtfile.read())

        permission_docs = mydocs["permissions"] = {
            "_label": d + " Permissions",
            "_type": "permissions",
            "_icon": meta[0].icon,
            "_gh_source": get_gh_url(os.path.join(doc_path,
                                                  scrub(d) + ".txt")),
            "_intro": "Standard Permissions for " + d +
            ". These can be changed by the user.",
            "_permissions": [p for p in doclist if p.doctype == "DocPerm"],
            "_modified": doclist[0]["modified"]
        }

        # server controller
        server_controller_path = os.path.join(doc_path, scrub(d) + ".py")
        controller_docs = mydocs["controller_server"] = {
            "_label": d + " Server Controller",
            "_type": "_class",
            "_gh_source": get_gh_url(server_controller_path)
        }

        b = webnotes.bean([{"doctype": d}])
        b.make_controller()
        if not getattr(b.controller, "__doc__"):
            b.controller.__doc__ = "Controller Class for handling server-side events for " + d
        inspect_object_and_update_docs(controller_docs, b.controller)

        # client controller
        if meta_p[0].fields.get("__js"):
            client_controller_path = os.path.join(doc_path, scrub(d) + ".js")
            if (os.path.exists(client_controller_path)):
                mydocs["_toc"].append(prefix + d + ".controller_client")
                client_controller = mydocs["controller_client"] = {
                    "_label":
                    d + " Client Controller",
                    "_icon":
                    meta[0].icon,
                    "_type":
                    "controller_client",
                    "_gh_source":
                    get_gh_url(client_controller_path),
                    "_modified":
                    get_timestamp(client_controller_path),
                    "_intro":
                    "Client side triggers and functions for " + d,
                    "_code":
                    meta_p[0].fields["__js"],
                    "_fields":
                    [d.fieldname for d in meta_p if d.doctype == "DocField"]
                }

    return docs