← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-testopenid-testing-helpers into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-testopenid-testing-helpers into launchpad:master.

Commit message:
Port lp.testopenid.testing.helpers to Python 3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/391440
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-testopenid-testing-helpers into launchpad:master.
diff --git a/lib/lp/testopenid/testing/helpers.py b/lib/lp/testopenid/testing/helpers.py
index 99cd52d..fd92520 100644
--- a/lib/lp/testopenid/testing/helpers.py
+++ b/lib/lp/testopenid/testing/helpers.py
@@ -3,6 +3,8 @@
 
 """Helpers for TestOpenID page tests."""
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 __all__ = [
     'complete_from_browser',
@@ -11,7 +13,7 @@ __all__ = [
     'ZopeFetcher',
     ]
 
-from StringIO import StringIO
+import io
 
 from openid import fetchers
 from openid.consumer.discover import (
@@ -30,11 +32,11 @@ class EchoView(LaunchpadView):
     """A view which just echoes its form arguments in the response."""
 
     def render(self):
-        out = StringIO()
-        print >> out, 'Request method: %s' % self.request.method
+        out = io.StringIO()
+        print(u'Request method: %s' % self.request.method, file=out)
         keys = sorted(self.request.form.keys())
         for key in keys:
-            print >> out, '%s:%s' % (key, self.request.form[key])
+            print(u'%s:%s' % (key, self.request.form[key]), file=out)
         return out.getvalue()