commit cce3f0082140e351c9aa70a148946c90e1ca2dc7
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Wed Sep 4 11:04:19 2013 +0200
XmlProcessing: Fix warnings from the lxml module
In case you test for None using an instance associated with the lxml
module like this
if obj:
the module will output "future warnings". This patch changes those
checks to:
if obj is not None:
Reported-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/XmlProcessing.py | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/lnst/Common/XmlProcessing.py b/lnst/Common/XmlProcessing.py
index f4d9105..5ea297d 100644
--- a/lnst/Common/XmlProcessing.py
+++ b/lnst/Common/XmlProcessing.py
@@ -24,16 +24,15 @@ class XmlProcessingError(Exception):
super(XmlProcessingError, self).__init__()
self._msg = msg
- if obj and hasattr(obj, "loc"):
+ if obj is not None and hasattr(obj, "loc"):
self.set_loc(obj.loc)
loc = {}
- if obj:
- if hasattr(obj, "base") and obj.base != None:
- loc["file"] = os.path.basename(obj.base)
- if hasattr(obj, "sourceline"):
- loc["line"] = obj.sourceline
- self.set_loc(loc)
+ if obj is not None and hasattr(obj, "base") and obj.base != None:
+ loc["file"] = os.path.basename(obj.base)
+ if hasattr(obj, "sourceline"):
+ loc["line"] = obj.sourceline
+ self.set_loc(loc)
def set_loc(self, loc):
Show replies by date