[Kimchi-devel] [PATCH] Use dedicate function to remove unused namespace

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Tue Nov 18 09:07:30 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

c5cb1515 used "cleanup_namespaces=True" to clean unused namespace.
But on rhel lxml library, this argument is not supported and result
in error:
File "./src/kimchi/model/utils.py", line 145,
        in _kimchi_get_metadata_node
    objectify.deannotate(kimchi, cleanup_namespaces=True)
  File "lxml.objectify.pyx", line 1728,
      in lxml.objectify.deannotate (src/lxml/lxml.objectify.c:17914)
TypeError: deannotate() got an unexpected keyword argument 'cleanup_namespaces'

So use a dedicate function to clean the unused namespace.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/model/utils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/kimchi/model/utils.py b/src/kimchi/model/utils.py
index dc911a9..9896289 100644
--- a/src/kimchi/model/utils.py
+++ b/src/kimchi/model/utils.py
@@ -142,7 +142,8 @@ def _kimchi_get_metadata_node(dom, tag):
             if i >= 0:
                 elem.tag = elem.tag[i+1:]
 
-        objectify.deannotate(kimchi, cleanup_namespaces=True)
+        objectify.deannotate(kimchi)
+        etree.cleanup_namespaces(kimchi)
         return kimchi
     return None
 
-- 
1.8.3.2




More information about the Kimchi-devel mailing list