Exemplo n.º 1
0
def create_folder(module, dt, dn, code_type, plugin=None):
    if plugin:
        module_path = os.path.join(get_plugin_path(plugin), scrub(module))
    else:
        module_path = get_module_path(module)

    dt, dn = scrub_dt_dn(dt, dn)

    # create folder
    folder = os.path.join(module_path, dt, dn)

    webnotes.create_folder(folder)

    # create init_py_files
    if code_type:
        create_init_py(module_path, dt, dn)

    return folder
Exemplo n.º 2
0
def create_folder(module, dt, dn, code_type, plugin=None):
	if plugin:
		module_path = os.path.join(get_plugin_path(plugin), scrub(module))
	else:
		module_path = get_module_path(module)

	dt, dn = scrub_dt_dn(dt, dn)
	
	# create folder
	folder = os.path.join(module_path, dt, dn)
	
	webnotes.create_folder(folder)
	
	# create init_py_files
	if code_type:
		create_init_py(module_path, dt, dn)
	
	return folder
Exemplo n.º 3
0
def get_custom_server_script_path(doctype, plugin=None):
	from webnotes.modules import scrub, get_plugin_path
	from webnotes.utils import get_site_base_path
	import os
	
	# check if doctype exists
	opts = webnotes.conn.get_value("DocType", doctype, ["name", "module", "plugin"])
	if not opts:
		raise webnotes.DoesNotExistError("""DocType "{doctype}" does not exist""".format(doctype=doctype))
	
	name, module, doctype_plugin = opts
	if not plugin:
		plugin = doctype_plugin or os.path.basename(get_site_base_path())
	
	# site_abs_path/plugin_name/module_name/doctype/doctype_name/doctype_name.py
	path = os.path.join(get_plugin_path(scrub(plugin)), scrub(module),
		"doctype", scrub(doctype), scrub(doctype) + ".py")
		
	return path