Skip to content

Commit

Permalink
fix issue with missing longdesc
Browse files Browse the repository at this point in the history
  • Loading branch information
mvcisback committed Jul 19, 2014
1 parent 9ca33e0 commit 458e9b4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bugwarrior/services/bz.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _parse_body(obj):
(
_parse_author(c['author']),
_parse_body(c)
) for c in issue['longdescs']
) for c in comments
)

def issues(self):
Expand All @@ -160,17 +160,17 @@ def issues(self):
emailtype1="substring",
)


if self.advanced:
# Required for new bugzilla
# https://bugzilla.redhat.com/show_bug.cgi?id=825370
query['query_format'] = 'advanced'

bugs = self.bz.query(query)

# Convert to dicts
bugs = [
dict(
((col, getattr(bug, col)) for col in self.COLUMN_LIST)
((col, _get_bug_attr(bug, col)) for col in self.COLUMN_LIST)
) for bug in bugs
]

Expand All @@ -185,3 +185,10 @@ def issues(self):
'annotations': self.annotations(tag, issue),
}
yield self.get_issue_for_record(issue, extra)


def _get_bug_attr(bug, attr):
"""Default only the longdescs case to [] since it may not be present."""
if attr == "longdescs":
return getattr(bug, attr, [])
return getattr(bug, attr)

0 comments on commit 458e9b4

Please sign in to comment.