aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/bug.py
diff options
context:
space:
mode:
authorThomas Habets <thomas@habets.pp.se>2009-01-07 19:39:32 +0100
committerThomas Habets <thomas@habets.pp.se>2009-01-07 19:39:32 +0100
commitbd8d5fdc0d37970824daac68f8d7c76975e9d36d (patch)
treec26dee19db15395c991c8f2bfa645eb19d56a689 /libbe/bug.py
parenta711ecf10df62e30d83c1941065404c53fecd35b (diff)
downloadbugseverywhere-bd8d5fdc0d37970824daac68f8d7c76975e9d36d.tar.gz
XML output for "be show"
Diffstat (limited to 'libbe/bug.py')
-rw-r--r--libbe/bug.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/libbe/bug.py b/libbe/bug.py
index c75c968..afa9e09 100644
--- a/libbe/bug.py
+++ b/libbe/bug.py
@@ -128,6 +128,43 @@ class Bug(object):
def __repr__(self):
return "Bug(uuid=%r)" % self.uuid
+ def xml(self, show_comments=False):
+ if self.bugdir == None:
+ shortname = self.uuid
+ else:
+ shortname = self.bugdir.bug_shortname(self)
+
+ if self.time == None:
+ timestring = ""
+ else:
+ htime = utility.handy_time(self.time)
+ ftime = utility.time_to_str(self.time)
+ timestring = "%s (%s)" % (htime, ftime)
+
+ info = [("uuid", self.uuid),
+ ("short-name", shortname),
+ ("severity", self.severity),
+ ("status", self.status),
+ ("assigned", self.assigned),
+ ("target", self.target),
+ ("creator", self.creator),
+ ("created", timestring),
+ ("summary", self.summary)]
+ ret = '<bug>\n'
+ for (k,v) in info:
+ if v is not None:
+ ret += ' <%s>%s</%s>\n' % (k,v,k)
+
+ if show_comments:
+ if self._comments_loaded == False:
+ self.load_comments()
+ comout = self.comment_root.xml_thread(auto_name_map=True,
+ bug_shortname=shortname)
+ ret += comout
+
+ ret += '</bug>'
+ return ret
+
def string(self, shortlist=False, show_comments=False):
if self.bugdir == None:
shortname = self.uuid