[selinux-policy: 438/3172] make interfaces or templates section not shown if empty

Daniel J Walsh dwalsh at fedoraproject.org
Thu Oct 7 19:42:36 UTC 2010


commit 06c9680d7869dcf8a2fba814ec7b27338c8debec
Author: Chris PeBenito <cpebenito at tresys.com>
Date:   Wed Jun 29 14:48:13 2005 +0000

    make interfaces or templates section not shown if empty

 refpolicy/support/sedoctool.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/refpolicy/support/sedoctool.py b/refpolicy/support/sedoctool.py
index 37839e8..eed2f5a 100755
--- a/refpolicy/support/sedoctool.py
+++ b/refpolicy/support/sedoctool.py
@@ -431,6 +431,21 @@ def gen_docs(doc, dir, templatedir):
 		menu_tpl = pyplate.Template(menudata)
 		menu_buf = menu_tpl.execute_string({ "menulist" : menu })
 
+
+		# pyplate's execute_string gives us a line of whitespace in
+		# template_buf or interface_buf if there are no interfaces or
+		# templates for this module. This is problematic because the
+		# HTML templates use a conditional if on interface_buf or
+		# template_buf being 'None' to decide if the "Template:" or
+		# "Interface:" headers need to be printed in the module pages.
+		# This detects if either of these are just whitespace, and sets
+		# their values to 'None' so that when applying it to the
+		# templates, they are properly recognized as not existing.
+		if not interface_buf.strip():
+			interface_buf = None
+		if not template_buf.strip():
+			template_buf = None
+
 		module_args = { "mod_layer" : mod_layer,
 			      "mod_name" : mod_name,	
 			      "mod_summary" : mod_summary,


More information about the scm-commits mailing list