From 462dd07d32f7542dd48be08ba38f47cb13632871 Mon Sep 17 00:00:00 2001 From: Tim Harder Date: Tue, 27 Jul 2010 22:32:04 -0700 Subject: [PATCH] fix future warnings when using python-2.7 --- bugz/bugzilla.py | 2 +- bugz/cli.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bugz/bugzilla.py b/bugz/bugzilla.py index 2134de6..e143f69 100644 --- a/bugz/bugzilla.py +++ b/bugz/bugzilla.py @@ -465,7 +465,7 @@ class Bugz: etree = ElementTree.parse(fd, parser) bug = etree.find('.//bug') - if bug and bug.attrib.has_key('error'): + if bug is not None and bug.attrib.has_key('error'): return None else: return etree diff --git a/bugz/cli.py b/bugz/cli.py index 8f25450..4a9dc8c 100644 --- a/bugz/cli.py +++ b/bugz/cli.py @@ -242,7 +242,7 @@ class PrettyBugz(Bugz): for field, name in FIELDS + MORE_FIELDS: try: - value = result.find('//%s' % field).text + value = result.find('.//%s' % field).text except AttributeError: continue print '%-12s: %s' % (name, value.encode(self.enc)) @@ -260,8 +260,8 @@ class PrettyBugz(Bugz): if blocked: print '%-12s: %s' % ('Blocked', blocked) - bug_comments = result.findall('//long_desc') - bug_attachments = result.findall('//attachment') + bug_comments = result.findall('.//long_desc') + bug_attachments = result.findall('.//attachment') print '%-12s: %d' % ('Comments', len(bug_comments)) print '%-12s: %d' % ('Attachments', len(bug_attachments)) -- 1.7.2