initial global booleans and tunables support. also fix index

building, as it was being rebuilt for every module, rather then
once after all modules are loaded.
This commit is contained in:
Chris PeBenito 2005-07-08 21:02:59 +00:00
parent a42ca7ebec
commit 249d461f23
4 changed files with 115 additions and 30 deletions

View File

@ -0,0 +1,8 @@
<h3>Global booleans:</h3>
[[for bool in booleans]]
<div id="interfacesmall">
Name: [[bool['bool_name']]]<p/>
Default Value: [[bool['def_val']]]<p/>
</div>
[[end]]

View File

@ -0,0 +1,8 @@
<h3>Global tunables:</h3>
[[for tun in tunables]]
<div id="interfacesmall">
Name: [[tun['tun_name']]]<p/>
Default Value: [[tun['def_val']]]<p/>
</div>
[[end]]

View File

@ -10,9 +10,13 @@
</div>
[[end]]
<br/><p/>
<a href="global_booleans.html">*&nbsp;Global&nbsp;Booleans&nbsp;</a>
<br/><p/>
<a href="global_tunables.html">*&nbsp;Global&nbsp;Tunables&nbsp;</a>
<p/><br/><p/>
<a href="index.html">*&nbsp;Layer Index</a>
<br/><p/>
<a href="interfaces.html">*&nbsp;Interface Index</a>
<a href="interfaces.html">*&nbsp;Interface&nbsp;Index</a>
<br/><p/>
<a href="templates.html">*&nbsp;Template Index</a>
<a href="templates.html">*&nbsp;Template&nbsp;Index</a>
</div>

View File

@ -184,7 +184,20 @@ def temp_cmp(a, b):
"""
return cmp(a["template_name"], b["template_name"])
def tun_cmp(a, b):
"""
Compares two tunables.
"""
return cmp(a["tun_name"], b["tun_name"])
def bool_cmp(a, b):
"""
Compares two booleans.
"""
return cmp(a["bool_name"], b["bool_name"])
def gen_doc_menu(mod_layer, module_list):
"""
Generates the HTML document menu.
@ -277,6 +290,12 @@ def gen_docs(doc, working_dir, templatedir):
templistfile = open(templatedir + "/temp_list.html", "r")
templistdata = templistfile.read()
templistfile.close()
boollistfile = open(templatedir + "/global_bool_list.html", "r")
boollistdata = boollistfile.read()
boollistfile.close()
tunlistfile = open(templatedir + "/global_tun_list.html", "r")
tunlistdata = tunlistfile.read()
tunlistfile.close()
except:
error("Could not open templates")
@ -504,40 +523,86 @@ def gen_docs(doc, working_dir, templatedir):
module_fh.close()
menu = gen_doc_menu(None, module_list)
menu_args = { "menulist" : menu,
"mod_layer" : None }
menu_tpl = pyplate.Template(menudata)
menu_buf = menu_tpl.execute_string(menu_args)
menu = gen_doc_menu(None, module_list)
menu_args = { "menulist" : menu,
"mod_layer" : None }
menu_tpl = pyplate.Template(menudata)
menu_buf = menu_tpl.execute_string(menu_args)
#build the interface index
all_interfaces.sort(int_cmp)
interface_tpl = pyplate.Template(intlistdata)
interface_buf = interface_tpl.execute_string({"interfaces" : all_interfaces})
int_file = "interfaces.html"
int_fh = open(int_file, "w")
body_tpl = pyplate.Template(bodydata)
#build the interface index
all_interfaces.sort(int_cmp)
interface_tpl = pyplate.Template(intlistdata)
interface_buf = interface_tpl.execute_string({"interfaces" : all_interfaces})
int_file = "interfaces.html"
int_fh = open(int_file, "w")
body_tpl = pyplate.Template(bodydata)
body_args = { "menu" : menu_buf,
"content" : interface_buf }
body_args = { "menu" : menu_buf,
"content" : interface_buf }
body_tpl.execute(int_fh, body_args)
int_fh.close()
body_tpl.execute(int_fh, body_args)
int_fh.close()
#build the template index
all_templates.sort(temp_cmp)
template_tpl = pyplate.Template(templistdata)
template_buf = template_tpl.execute_string({"templates" : all_templates})
temp_file = "templates.html"
temp_fh = open(temp_file, "w")
body_tpl = pyplate.Template(bodydata)
#build the template index
all_templates.sort(temp_cmp)
template_tpl = pyplate.Template(templistdata)
template_buf = template_tpl.execute_string({"templates" : all_templates})
temp_file = "templates.html"
temp_fh = open(temp_file, "w")
body_tpl = pyplate.Template(bodydata)
body_args = { "menu" : menu_buf,
"content" : template_buf }
body_tpl.execute(temp_fh, body_args)
temp_fh.close()
#build the global tunable index
global_tun_buf = []
for tunable in doc.getElementsByTagName("tunable"):
if tunable.parentNode.nodeName == "policy":
tunable_name = tunable.getAttribute("name")
default_value = tunable.getAttribute("dftval")
global_tun_buf.append( { "tun_name" : tunable_name,
"def_val" : default_value } )
global_tun_buf.sort(tun_cmp)
global_tun_tpl = pyplate.Template(tunlistdata)
global_tun_buf = global_tun_tpl.execute_string({"tunables" : global_tun_buf})
global_tun_file = "global_tunables.html"
global_tun_fh = open(global_tun_file, "w")
body_tpl = pyplate.Template(bodydata)
body_args = { "menu" : menu_buf,
"content" : global_tun_buf }
body_tpl.execute(global_tun_fh, body_args)
global_tun_fh.close()
#build the global boolean index
global_bool_buf = []
for boolean in doc.getElementsByTagName("boolean"):
if boolean.parentNode.nodeName == "policy":
bool_name = boolean.getAttribute("name")
default_value = boolean.getAttribute("dftval")
global_bool_buf.append( { "bool_name" : bool_name,
"def_val" : default_value } )
global_bool_buf.sort(bool_cmp)
global_bool_tpl = pyplate.Template(boollistdata)
global_bool_buf = global_bool_tpl.execute_string({"booleans" : global_bool_buf})
global_bool_file = "global_booleans.html"
global_bool_fh = open(global_bool_file, "w")
body_tpl = pyplate.Template(bodydata)
body_args = { "menu" : menu_buf,
"content" : global_bool_buf }
body_tpl.execute(global_bool_fh, body_args)
global_bool_fh.close()
body_args = { "menu" : menu_buf,
"content" : template_buf }
body_tpl.execute(temp_fh, body_args)
temp_fh.close()
def error(error):
"""