mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-07-29 12:09:37 +00:00
Set the template's basehref from cfg.server_dir.
Previously, the cfg.base_href variable was never set (it's not even in the sample.config file!). Now, Plinth uses the specified root directory (from the *--server_dir* argument) in each URL reference.
This commit is contained in:
parent
e3f1297711
commit
2af1617f51
12
util.py
12
util.py
@ -40,11 +40,11 @@ def slurp(filespec):
|
||||
def unslurp(filespec, msg):
|
||||
with open(filespec, 'w') as x:
|
||||
x.write(msg)
|
||||
|
||||
|
||||
def find_in_seq(func, seq):
|
||||
"Return first item in seq for which func(item) returns True."
|
||||
for i in seq:
|
||||
if func(i):
|
||||
if func(i):
|
||||
return i
|
||||
|
||||
def find_keys(dic, val):
|
||||
@ -63,7 +63,7 @@ def page_template(template='login_nav', **kwargs):
|
||||
kwargs[k] = ''
|
||||
|
||||
if kwargs['basehref'] == '':
|
||||
kwargs['basehref'] = cfg.base_href
|
||||
kwargs['basehref'] = cfg.server_dir
|
||||
#if template=='base' and kwargs['sidebar_right']=='':
|
||||
# template='two_col'
|
||||
if isinstance(template, basestring):
|
||||
@ -80,10 +80,10 @@ def page_template(template='login_nav', **kwargs):
|
||||
kwargs['username'] = cherrypy.session.get(cfg.session_key)
|
||||
|
||||
if not kwargs['nav'] and submenu:
|
||||
kwargs['nav'] = """ <script type="text/javascript">
|
||||
kwargs['nav'] = """ <script type="text/javascript">
|
||||
<!--
|
||||
side_menu(sub_menu_items);
|
||||
// -->
|
||||
side_menu(sub_menu_items);
|
||||
// -->
|
||||
</script>"""
|
||||
|
||||
return str(template(searchList=[kwargs]))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user