summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2009-08-31 00:59:53 -0400
committerOwen W. Taylor <otaylor@fishsoup.net>2009-08-31 01:02:10 -0400
commit75b0cbb957510053760c1ae4f519cd6601040e96 (patch)
tree0db4207d99bb89835c7736334f06838c3dc1aefa
parent3f21f465880443b846c219675c1f4b50c5a568ac (diff)
downloadgit-bz-75b0cbb957510053760c1ae4f519cd6601040e96.tar.gz
Fix checking for missing fields in XML response
token = bug.find("token") self.token = token.text if token else None Was behaving strangely: apparently ElementTree can be logically false when non-None. Switch to the more explicit: self.token = None if token is None else token.text
-rwxr-xr-xgit-bz6
1 files changed, 3 insertions, 3 deletions
diff --git a/git-bz b/git-bz
index 86814ed..2316310 100755
--- a/git-bz
+++ b/git-bz
@@ -939,7 +939,7 @@ class Bug(object):
if self.bug_status == "RESOLVED":
self.resolution = bug.find("resolution").text
token = bug.find("token")
- self.token = token.text if token else None
+ self.token = None if token is None else token.text
for attachment in bug.findall("attachment"):
if attachment.get("ispatch") == "1" and not attachment.get("isobsolete") == "1" :
@@ -951,11 +951,11 @@ class Bug(object):
patch.description = attachment.find("desc").text
patch.date = attachment.find("date").text
status = attachment.find("status")
- patch.status = status.text if status else None
+ patch.status = None if status is None else status.text
patch.filename = attachment.find("filename").text
patch.isprivate = attachment.get("isprivate") == "1"
token = attachment.find("token")
- patch.token = token.text if token else None
+ patch.token = None if token is None else token.text
if attachmentdata:
data = attachment.find("data").text