From 2293f704a2fc0ea7918dd8c8ba54b7aa4f660eec Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 29 Aug 2012 10:00:00 -0400 Subject: [PATCH] bug: fix leading comment indentation in Bug.xml(). --- libbe/bug.py | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/libbe/bug.py b/libbe/bug.py index d77c8c3..c91dfb8 100644 --- a/libbe/bug.py +++ b/libbe/bug.py @@ -332,8 +332,7 @@ class Bug (settings_object.SavedSettingsObject): >>> commC = commB.new_reply(body='comment C') >>> commC.uuid = 'commC' >>> commC.date = 'Thu, 01 Jan 1970 00:03:00 +0000' - >>> xml = bugA.xml(show_comments=True) - >>> print(xml) # doctest: +REPORT_UDIFF + >>> print(bugA.xml(show_comments=True)) # doctest: +REPORT_UDIFF bugA /bug @@ -370,6 +369,44 @@ class Bug (settings_object.SavedSettingsObject): comment C + >>> print(bugA.xml(show_comments=True, indent=2)) + ... # doctest: +REPORT_UDIFF + + bugA + /bug + minor + open + Frank + Thu, 01 Jan 1970 00:00:00 +0000 + Need to test Bug.xml() + TAG: very helpful + + commA + /bug/commA + + Thu, 01 Jan 1970 00:01:00 +0000 + text/plain + comment A + + + commB + /bug/commB + commA + + Thu, 01 Jan 1970 00:02:00 +0000 + text/plain + comment B + + + commC + /bug/commC + commB + + Thu, 01 Jan 1970 00:03:00 +0000 + text/plain + comment C + + """ if self.time == None: timestring = "" @@ -393,7 +430,8 @@ class Bug (settings_object.SavedSettingsObject): lines.append(' %s' % estr) if show_comments == True: comout = self.comment_root.xml_thread(indent=indent+2) - if len(comout) > 0: + if comout: + comout = comout[indent:] # strip leading indent spaces lines.append(comout) lines.append('') istring = ' '*indent -- 2.26.2