コード例 #1
0
def make(site=None):
    """make public folder symlinks if missing"""
    from webnotes.utils import get_site_base_path, get_base_path, get_path

    webnotes.init(site=site)

    site_path = get_site_base_path() if site else get_base_path()

    # setup standard folders
    for param in (("public_path", "public"), ("backup_path", "public/backups"),
                  ("files_path", "public/files")):
        path = os.path.join(site_path, webnotes.conf.get(param[0], param[1]))
        if not os.path.exists(path):
            os.mkdir(path)

    # setup js and css folders
    if not site:
        for folder in ("js", "css"):
            path = get_path(webnotes.conf.get("public_path", "public"), folder)
            if not os.path.exists(path):
                os.mkdir(path)

        os.chdir(webnotes.conf.get("public_path", "public"))
        symlinks = [
            ["app", "../app/public"],
            ["lib", "../lib/public"],
        ]

        for link in symlinks:
            if not os.path.exists(link[0]) and os.path.exists(link[1]):
                os.symlink(link[1], link[0])

        os.chdir("..")
コード例 #2
0
ファイル: plugins.py プロジェクト: saurabh6790/OFF-RISLIB
def get_plugin_name(doctype=None, docname=None):
	import os
	from webnotes.utils import get_site_base_path
	plugin = None
	
	if doctype:
		meta = webnotes.get_doctype(doctype)
		if meta.get_field("plugin"):
			plugin = webnotes.conn.get_value(doctype, docname, "plugin")
	
	if not plugin:
		plugin = os.path.basename(get_site_base_path())

	return plugin
コード例 #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
コード例 #4
0
def get_conf_path(sites_dir, site):
    from webnotes.utils import get_site_base_path
    return os.path.join(get_site_base_path(sites_dir=sites_dir, hostname=site),
                        'site_config.json')
コード例 #5
0
ファイル: __init__.py プロジェクト: Halfnhav/wnframework
def get_conf_path(sites_dir, site):
	from webnotes.utils import get_site_base_path
	return os.path.join(get_site_base_path(sites_dir=sites_dir,
			hostname=site), 'site_config.json')