[Buildbot-commits] [Buildbot] #2598: Code Snippet From BuildBot Documentation Incorrect

Buildbot trac trac at buildbot.net
Wed Nov 27 15:49:24 UTC 2013


#2598: Code Snippet From BuildBot Documentation Incorrect
---------------------------+-----------------------
Reporter:  Jeremy.Cornett  |      Owner:
    Type:  defect          |     Status:  new
Priority:  minor           |  Milestone:  undecided
 Version:  0.8.7p1         |   Keywords:  mail
---------------------------+-----------------------
 http://docs.buildbot.net/latest/manual/cfg-statustargets.html#mailnotifier

 http://docs.buildbot.net/0.8.7p1/manual/cfg-
 statustargets.html#mailnotifier

 This problem is present in the documentation for at least 0.8.7.p1 and
 0.8.8. I haven't checked the previous versions.

 An example of a function delivering a customized html email containing the
 last 80 log lines of logs of the last build step is given, and it contains
 a bug. Near the end of the snippet, these lines are given:

 {{{
 text.append(u'<pre>'.join([uniline for uniline in unilist]))
 text.append(u'</pre>')
 }}}

 The idea being that we take lines from the STDIO log and include them in
 the email sent by the MailNotifier object. Unfortunately, using a join
 there will introduce multiple instances of the <pre> tag.

 Example:

 {{{
 >>> text = []
 >>> unilist = ["blah", "apple", "rose"]
 >>> text.append(u'<pre>'.join([uniline for uniline in unilist]))
 >>> text.append(u'</pre>')
 >>> print text
 [u'blah<pre>apple<pre>rose', u'</pre>']
 }}}

 Here is a suggested fix:

 {{{
 text.append(u'<pre>')
 text.extend(unilist)
 text.append(u'</pre>')
 }}}

-- 
Ticket URL: <http://trac.buildbot.net/ticket/2598>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list