85a820031f
- Improve sedispatch performance Requires audit >= 3.0.1 - Improve Python 3.10 compatibility https://pagure.io/setroubleshoot/issue/58
69 lines
2.3 KiB
Diff
69 lines
2.3 KiB
Diff
From 15c8f55d85fc5b314b8a00cd5e9432e8d2726d7a Mon Sep 17 00:00:00 2001
|
|
From: Adam Williamson <awilliam@redhat.com>
|
|
Date: Mon, 26 Jul 2021 13:18:29 -0700
|
|
Subject: [PATCH] html_util: remove html_document
|
|
|
|
I suspect this can safely be removed, because I don't think it
|
|
has worked for six years. Since dbaaf0f it uses `six.string_types`
|
|
but does not `import six`; if the function were ever called, it
|
|
would crash immediately. I suggest this is reasonable proof that
|
|
it's useless. Nothing in setroubleshoot itself calls it.
|
|
|
|
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
|
---
|
|
src/setroubleshoot/html_util.py | 34 ---------------------------------
|
|
1 file changed, 34 deletions(-)
|
|
|
|
diff --git a/framework/src/setroubleshoot/html_util.py b/framework/src/setroubleshoot/html_util.py
|
|
index d24632b7e44c..d16b78934c85 100644
|
|
--- a/framework/src/setroubleshoot/html_util.py
|
|
+++ b/framework/src/setroubleshoot/html_util.py
|
|
@@ -22,8 +22,6 @@ __all__ = [
|
|
'escape_html',
|
|
'unescape_html',
|
|
'html_to_text',
|
|
-
|
|
- 'html_document',
|
|
]
|
|
|
|
import syslog
|
|
@@ -81,35 +79,3 @@ def html_to_text(html, maxcol=80):
|
|
except Exception as e:
|
|
syslog.syslog(syslog.LOG_ERR, 'cannot convert html to text: %s' % e)
|
|
return None
|
|
-
|
|
-
|
|
-def html_document(*body_components):
|
|
- '''Wrap the body components in a HTML document structure with a valid header.
|
|
- Accepts a variable number of arguments of of which canb be:
|
|
- * string
|
|
- * a sequences of strings (tuple or list).
|
|
- * a callable object taking no parameters and returning a string or sequence of strings.
|
|
- '''
|
|
- head = '<html>\n <head>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\n </head>\n <body>\n'
|
|
- tail = '\n </body>\n</html>'
|
|
-
|
|
- doc = head
|
|
-
|
|
- for body_component in body_components:
|
|
- if isinstance(body_component, six.string_types):
|
|
- doc += body_component
|
|
- elif isinstance(body_component, (tuple, list)):
|
|
- for item in body_component:
|
|
- doc += item
|
|
- elif callable(body_component):
|
|
- result = body_component()
|
|
- if isinstance(result, (tuple, list)):
|
|
- for item in result:
|
|
- doc += item
|
|
- else:
|
|
- doc += result
|
|
- else:
|
|
- doc += body_component
|
|
-
|
|
- doc += tail
|
|
- return doc
|
|
--
|
|
2.32.0
|
|
|