Colin Watson has proposed merging ~cjwatson/launchpad:py3-webapp-notifications-print-function into launchpad:master.
Commit message: Port lp.services.webapp.notifications to print_function Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394405 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-webapp-notifications-print-function into launchpad:master.
diff --git a/lib/lp/services/webapp/notifications.py b/lib/lp/services/webapp/notifications.py index 5eecc90..a0fb1c2 100644 --- a/lib/lp/services/webapp/notifications.py +++ b/lib/lp/services/webapp/notifications.py @@ -12,6 +12,8 @@ to do this correctly is by passing a token in the URL to identify the browser window the request came from. """ +from __future__ import absolute_import, print_function + __metaclass__ = type from datetime import datetime @@ -126,7 +128,7 @@ class NotificationResponse: True >>> for notification in response.notifications: - ... print "%d -- %s" % (notification.level, notification.message) + ... print("%d -- %s" % (notification.level, notification.message)) 20 -- <b><Fnord></b> 10 -- Whatever 10 -- Debug @@ -141,7 +143,7 @@ class NotificationResponse: are stored in the session >>> for notification in ISession(request)[SESSION_KEY]['notifications']: - ... print "%d -- %s" % (notification.level, notification.message) + ... print("%d -- %s" % (notification.level, notification.message)) ... break 20 -- <b><Fnord></b> @@ -261,7 +263,7 @@ class NotificationList(list): >>> notifications.append(Notification(error, u'An error')) >>> notifications.append(Notification(debug, u'A debug message')) >>> for notification in notifications: - ... print repr(notification.message) + ... print(repr(notification.message)) u'An error' u'A debug message' @@ -270,7 +272,7 @@ class NotificationList(list): notification level. >>> for notification in notifications['debug']: - ... print repr(notification.message) + ... print(repr(notification.message)) u'A debug message' """ diff --git a/lib/lp/services/webapp/tests/test_notifications.py b/lib/lp/services/webapp/tests/test_notifications.py index 7473838..d3f48ee 100644 --- a/lib/lp/services/webapp/tests/test_notifications.py +++ b/lib/lp/services/webapp/tests/test_notifications.py @@ -3,6 +3,8 @@ """Module docstring goes here.""" +from __future__ import absolute_import, print_function + __metaclass__ = type from doctest import DocTestSuite @@ -57,7 +59,7 @@ class MockHTTPApplicationResponse: """Just report the redirection to the doctest""" if status is None: status = 302 - print '%d: %s' % (status, location) + print('%d: %s' % (status, location)) def adaptNotificationRequestToResponse(request):
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp