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> </div>
[[end]] [[end]]
<br/><p/> <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> <a href="index.html">*&nbsp;Layer Index</a>
<br/><p/> <br/><p/>
<a href="interfaces.html">*&nbsp;Interface Index</a> <a href="interfaces.html">*&nbsp;Interface&nbsp;Index</a>
<br/><p/> <br/><p/>
<a href="templates.html">*&nbsp;Template Index</a> <a href="templates.html">*&nbsp;Template&nbsp;Index</a>
</div> </div>

View File

@ -185,6 +185,19 @@ def temp_cmp(a, b):
return cmp(a["template_name"], b["template_name"]) 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): def gen_doc_menu(mod_layer, module_list):
""" """
Generates the HTML document menu. Generates the HTML document menu.
@ -277,6 +290,12 @@ def gen_docs(doc, working_dir, templatedir):
templistfile = open(templatedir + "/temp_list.html", "r") templistfile = open(templatedir + "/temp_list.html", "r")
templistdata = templistfile.read() templistdata = templistfile.read()
templistfile.close() 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: except:
error("Could not open templates") error("Could not open templates")
@ -504,40 +523,86 @@ def gen_docs(doc, working_dir, templatedir):
module_fh.close() module_fh.close()
menu = gen_doc_menu(None, module_list) menu = gen_doc_menu(None, module_list)
menu_args = { "menulist" : menu, menu_args = { "menulist" : menu,
"mod_layer" : None } "mod_layer" : None }
menu_tpl = pyplate.Template(menudata) menu_tpl = pyplate.Template(menudata)
menu_buf = menu_tpl.execute_string(menu_args) menu_buf = menu_tpl.execute_string(menu_args)
#build the interface index #build the interface index
all_interfaces.sort(int_cmp) all_interfaces.sort(int_cmp)
interface_tpl = pyplate.Template(intlistdata) interface_tpl = pyplate.Template(intlistdata)
interface_buf = interface_tpl.execute_string({"interfaces" : all_interfaces}) interface_buf = interface_tpl.execute_string({"interfaces" : all_interfaces})
int_file = "interfaces.html" int_file = "interfaces.html"
int_fh = open(int_file, "w") int_fh = open(int_file, "w")
body_tpl = pyplate.Template(bodydata) body_tpl = pyplate.Template(bodydata)
body_args = { "menu" : menu_buf, body_args = { "menu" : menu_buf,
"content" : interface_buf } "content" : interface_buf }
body_tpl.execute(int_fh, body_args) body_tpl.execute(int_fh, body_args)
int_fh.close() int_fh.close()
#build the template index #build the template index
all_templates.sort(temp_cmp) all_templates.sort(temp_cmp)
template_tpl = pyplate.Template(templistdata) template_tpl = pyplate.Template(templistdata)
template_buf = template_tpl.execute_string({"templates" : all_templates}) template_buf = template_tpl.execute_string({"templates" : all_templates})
temp_file = "templates.html" temp_file = "templates.html"
temp_fh = open(temp_file, "w") temp_fh = open(temp_file, "w")
body_tpl = pyplate.Template(bodydata) 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): def error(error):
""" """