Merge lp:~allenap/launchpad/ec2-test-remote-non-ascii-issue-bug-447247 into lp:launchpad

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~allenap/launchpad/ec2-test-remote-non-ascii-issue-bug-447247
Merge into: lp:launchpad
Diff against target: 69 lines
1 file modified
lib/devscripts/ec2test/ec2test-remote.py (+15/-8)
To merge this branch: bzr merge lp:~allenap/launchpad/ec2-test-remote-non-ascii-issue-bug-447247
Reviewer Review Type Date Requested Status
Abel Deuring (community) Approve
Review via email: mp+13126@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Encode the summary before appending it to the log files. I also fixed some lint.

Revision history for this message
Gavin Panella (allenap) wrote :

The following diff was also needed because branch.revno() is an int, and can't be escaped directly, nor does it need to be.

=== modified file 'lib/devscripts/ec2test/ec2test-remote.py'
--- lib/devscripts/ec2test/ec2test-remote.py 2009-10-09 14:50:33 +0000
+++ lib/devscripts/ec2test/ec2test-remote.py 2009-10-09 15:04:24 +0000
@@ -339,8 +339,9 @@
                         'revno': branch.revno()}
                 write(
                     '- %(name)s\n %(branch)s\n %(revno)d\n' % data)
- escaped_data = dict(
- (key, escape(value)) for (key, value) in data.iteritems())
+ escaped_data = {'name': escape(name),
+ 'branch': escape(branch.get_parent()),
+ 'revno': branch.revno()}
                 index_file.write(textwrap.dedent('''\
                     <dt>%(name)s</dt>
                       <dd>%(branch)s</dd>

Revision history for this message
Abel Deuring (adeuring) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/devscripts/ec2test/ec2test-remote.py'
--- lib/devscripts/ec2test/ec2test-remote.py 2009-09-14 22:59:32 +0000
+++ lib/devscripts/ec2test/ec2test-remote.py 2009-10-09 15:06:12 +0000
@@ -17,6 +17,8 @@
17import time17import time
18import traceback18import traceback
1919
20from xml.sax.saxutils import escape
21
20import bzrlib.branch22import bzrlib.branch
21import bzrlib.config23import bzrlib.config
22import bzrlib.email_message24import bzrlib.email_message
@@ -140,7 +142,8 @@
140 # since someone else might try to write to them later.142 # since someone else might try to write to them later.
141 summary_file.close()143 summary_file.close()
142 if self.email is not None:144 if self.email is not None:
143 subject = 'Test results: %s' % (result and 'FAILURE' or 'SUCCESS')145 subject = 'Test results: %s' % (
146 result and 'FAILURE' or 'SUCCESS')
144 summary_file = open(self.logger.summary_filename, 'r')147 summary_file = open(self.logger.summary_filename, 'r')
145 bzrlib.email_message.EmailMessage.send(148 bzrlib.email_message.EmailMessage.send(
146 config, self.email[0], self.email,149 config, self.email[0], self.email,
@@ -299,7 +302,7 @@
299 'trunk_revno': branch.revno()}302 'trunk_revno': branch.revno()}
300 index_file.write(textwrap.dedent('''\303 index_file.write(textwrap.dedent('''\
301 <p><strong>%s</strong></p>304 <p><strong>%s</strong></p>
302 ''' % (msg,)))305 ''' % (escape(msg),)))
303 write(msg)306 write(msg)
304 tree = bzrlib.workingtree.WorkingTree.open(self.test_dir)307 tree = bzrlib.workingtree.WorkingTree.open(self.test_dir)
305 parent_ids = tree.get_parent_ids()308 parent_ids = tree.get_parent_ids()
@@ -309,15 +312,16 @@
309 index_file.write('<p>(no merged branch)</p>\n')312 index_file.write('<p>(no merged branch)</p>\n')
310 write('(no merged branch)')313 write('(no merged branch)')
311 else:314 else:
312 summary = branch.repository.get_revision(parent_ids[1]).get_summary()315 summary = (
316 branch.repository.get_revision(parent_ids[1]).get_summary())
313 data = {'name': self.public_branch.encode('utf-8'),317 data = {'name': self.public_branch.encode('utf-8'),
314 'revno': self.public_branch_revno,318 'revno': self.public_branch_revno,
315 'commit': summary}319 'commit': summary.encode('utf-8')}
316320 msg = ('%(name)s, revision %(revno)d '
317 msg = '%(name)s, revision %(revno)d (commit message: %(commit)s)\n' % data321 '(commit message: %(commit)s)\n' % data)
318 index_file.write(textwrap.dedent('''\322 index_file.write(textwrap.dedent('''\
319 <p>Merged with<br />%(msg)s</p>323 <p>Merged with<br />%(msg)s</p>
320 ''' % {'msg': msg}))324 ''' % {'msg': escape(msg)}))
321 write("Merged with")325 write("Merged with")
322 write(msg)326 write(msg)
323327
@@ -335,11 +339,14 @@
335 'revno': branch.revno()}339 'revno': branch.revno()}
336 write(340 write(
337 '- %(name)s\n %(branch)s\n %(revno)d\n' % data)341 '- %(name)s\n %(branch)s\n %(revno)d\n' % data)
342 escaped_data = {'name': escape(name),
343 'branch': escape(branch.get_parent()),
344 'revno': branch.revno()}
338 index_file.write(textwrap.dedent('''\345 index_file.write(textwrap.dedent('''\
339 <dt>%(name)s</dt>346 <dt>%(name)s</dt>
340 <dd>%(branch)s</dd>347 <dd>%(branch)s</dd>
341 <dd>%(revno)s</dd>348 <dd>%(revno)s</dd>
342 ''' % data))349 ''' % escaped_data))
343 index_file.write(textwrap.dedent('''\350 index_file.write(textwrap.dedent('''\
344 </dl>351 </dl>
345 </body>352 </body>