From 0b21799a72d42299d36cdbb1b092a53120e8ae5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Thu, 16 Jun 2005 10:32:10 +0000 Subject: [PATCH] =?UTF-8?q?Unittestler=20birka=C3=A7=20hata=20daha=20yakal?= =?UTF-8?q?ad=C4=B1.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit her spec dosyası içerisinde dependency tanımları ve patch olmak zorunda değil. specfile içerisinde bunun için gerekli düzenleme yapıldı. xmlfile içerisine xml hata-yakalama eklendi. --- src/pisi/xmlfile.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pisi/xmlfile.py b/src/pisi/xmlfile.py index 7ebd9958..0fa18117 100644 --- a/src/pisi/xmlfile.py +++ b/src/pisi/xmlfile.py @@ -20,6 +20,8 @@ def getNodeText(node): child = node.childNodes[0] except IndexError: return None + except AttributeError: # no node by that name + return None if child.nodeType == child.TEXT_NODE: return child.data else: @@ -126,7 +128,10 @@ class XmlFile(object): def getChildElts(self, tagpath): """ returns the children of the given path, only with given type """ node = self.getNode(tagpath) - return filter(lambda x:x.nodeType==x.ELEMENT_NODE, node.childNodes) + try: + return filter(lambda x:x.nodeType==x.ELEMENT_NODE, node.childNodes) + except AttributeError: + return None def getChildText(self, tagpath): node = self.getNode(tagpath)