• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python modules.get_doc_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webnotes.modules.get_doc_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_doc_path函数的具体用法?Python get_doc_path怎么用?Python get_doc_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_doc_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: update_language

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)
开发者ID:ricardomomm,项目名称:wnframework,代码行数:27,代码来源:doctype.py


示例2: build_from_query_report

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')
开发者ID:PriyaShitole,项目名称:MedViger-lib,代码行数:32,代码来源:translate.py


示例3: make_controller_template

	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())
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:11,代码来源:doctype.py


示例4: update_readme

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)
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:12,代码来源:documentation_tool.py


示例5: get_print_style

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()
开发者ID:bindscha,项目名称:wnframework_old,代码行数:12,代码来源:print_format.py


示例6: update_language

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
开发者ID:gowrav-vishwakarma,项目名称:wnframework,代码行数:21,代码来源:doctype.py


示例7: get_print_format

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
开发者ID:ricardomomm,项目名称:wnframework,代码行数:13,代码来源:print_format.py


示例8: load_doc_messages

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'))
开发者ID:bperretti,项目名称:wnframework-bperretti,代码行数:15,代码来源:translate.py


示例9: update_language

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)
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:24,代码来源:doctype.py


示例10: load_doc_messages

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'))
开发者ID:PriyaShitole,项目名称:MedViger-lib,代码行数:18,代码来源:translate.py


示例11: build_for_doc_from_database

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')
开发者ID:PriyaShitole,项目名称:MedViger-lib,代码行数:18,代码来源:translate.py


示例12: getpage

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,)
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:21,代码来源:page.py


示例13: build_for_modules

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')
开发者ID:IPenuelas,项目名称:wnframework,代码行数:23,代码来源:translate.py


示例14: get_doctypes

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),
#.........这里部分代码省略.........
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:101,代码来源:documentation_tool.py


示例15: get_doc_messages

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')
开发者ID:IPenuelas,项目名称:wnframework,代码行数:3,代码来源:translate.py



注:本文中的webnotes.modules.get_doc_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python modules.get_module_path函数代码示例发布时间:2022-05-26
下一篇:
Python wrapper.getlist函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap