Exemple #1
0
def prepare_args(page_name):

	has_app = True
	try:
		from startup.webutils import update_template_args, get_home_page
	except ImportError:
		has_app = False

	if page_name == 'index':
		if has_app:
			page_name = get_home_page()
		else:
			page_name = "login"
	
	pages = get_page_settings()
	
	if page_name in pages:
		page_info = pages[page_name]
		args = webnotes._dict({
			'template': page_info["template"],
			'name': page_name,
		})

		# additional args
		if "args_method" in page_info:
			args.update(webnotes.get_method(page_info["args_method"])())
		elif "args_doctype" in page_info:
			bean = webnotes.bean(page_info["args_doctype"])
			bean.run_method("onload")
			args.obj = bean.make_controller()
	else:
		args = get_doc_fields(page_name)
	
	if not args:
		return False
	
	if has_app:
		args = update_template_args(page_name, args)
	
	return args	
Exemple #2
0
def make():
    from startup.webutils import get_home_page

    if not webnotes.conn:
        webnotes.connect()

    home_page = get_home_page()

    fname = 'js/wn-web.js'
    if os.path.basename(os.path.abspath('.')) != 'public':
        fname = os.path.join('public', fname)

    with open(fname, 'w') as f:
        f.write(get_web_script())

    fname = 'css/wn-web.css'
    if os.path.basename(os.path.abspath('.')) != 'public':
        fname = os.path.join('public', fname)

    # style - wn.css
    with open(fname, 'w') as f:
        f.write(get_web_style())
def make():
    from startup.webutils import get_home_page

    if not webnotes.conn:
        webnotes.connect()

    home_page = get_home_page()

    fname = "js/wn-web.js"
    if os.path.basename(os.path.abspath(".")) != "public":
        fname = os.path.join("public", fname)

    with open(fname, "w") as f:
        f.write(get_web_script())

    fname = "css/wn-web.css"
    if os.path.basename(os.path.abspath(".")) != "public":
        fname = os.path.join("public", fname)

        # style - wn.css
    with open(fname, "w") as f:
        f.write(get_web_style())