[PATCH 6/6] Remove iutil.strip_markup.

David Shea dshea at redhat.com
Thu Jan 9 18:31:13 UTC 2014


This function is no longer used
---
 pyanaconda/iutil.py                  | 16 ----------------
 tests/pyanaconda_tests/iutil_test.py | 27 ---------------------------
 2 files changed, 43 deletions(-)

diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index e278e96..b68c69a 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -294,22 +294,6 @@ def isConsoleOnVirtualTerminal(dev="console"):
     consoletype = console.rstrip('0123456789') # remove the number
     return consoletype == 'tty'
 
-def strip_markup(text):
-    if text.find("<") == -1:
-        return text
-    r = ""
-    inTag = False
-    for c in text:
-        if c == ">" and inTag:
-            inTag = False
-            continue
-        elif c == "<" and not inTag:
-            inTag = True
-            continue
-        elif not inTag:
-            r += c
-    return r.encode("utf-8")
-
 def reIPL(ipldev):
     try:
         rc = execWithRedirect("chreipl", ["node", "/dev/" + ipldev])
diff --git a/tests/pyanaconda_tests/iutil_test.py b/tests/pyanaconda_tests/iutil_test.py
index 10458c2..ea1cd57 100644
--- a/tests/pyanaconda_tests/iutil_test.py
+++ b/tests/pyanaconda_tests/iutil_test.py
@@ -174,33 +174,6 @@ class RunProgramTests(unittest.TestCase):
         # at least check if a bool is returned
         self.assertIsInstance(iutil.isConsoleOnVirtualTerminal(), bool)
 
-    def strip_markup_test(self):
-        """Test strip_markup."""
-
-        # list of tuples representing a markup and its correct parsing
-        markups = [
-            ("", ""),
-            ("a", "a"),
-            ("č", "č"),
-            ("<č>", ""),
-            ("<a>", ""),
-            ("<a><a>", ""),
-            ("<a></a>", ""),
-            ("<a>abc</a>", "abc"),
-            ("<abc", ""),  # unclosed tag
-            ("a>bc", "a>bc"),  # not a valid tag
-            ("<i><b>bold</b></i>", "bold"),  # nesting
-            ("<p><b>bold</b> <i>italic</i></p>", "bold italic"),
-            ("  <a>text</a>", "  text"),
-            (" <a> </a> ", "   "),
-            ('<span color="blue">text</span>', 'text'),
-            ("<<<<<<<<<<<<<<<", ""),
-        ]
-
-        # check if markup is parsed properly
-        for markup, output in markups:
-            self.assertEqual(iutil.strip_markup(markup), output)
-
     def parse_nfs_url_test(self):
         """Test parseNfsUrl."""
 
-- 
1.8.5.2



More information about the anaconda-patches mailing list