diff options
| author | Barry Warsaw | 2014-04-28 11:23:35 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2014-04-28 11:23:35 -0400 |
| commit | d4d71f71f08d6d440b17482eecc5472dcfe6cbae (patch) | |
| tree | 71f08b3d60f698883294eaa6d1bf366a095da011 /src/mailman/rest/docs | |
| parent | 7536530dcd8d6303c0a869e8c9c2cb2517b9b018 (diff) | |
| download | mailman-d4d71f71f08d6d440b17482eecc5472dcfe6cbae.tar.gz mailman-d4d71f71f08d6d440b17482eecc5472dcfe6cbae.tar.zst mailman-d4d71f71f08d6d440b17482eecc5472dcfe6cbae.zip | |
Use print functions consistently through, and update all __future__ imports to
reflect this.
Also, mock out sys.stderr on some tests so that their nose2 output is quieter.
A few other minor coding style consistencies.
Diffstat (limited to 'src/mailman/rest/docs')
| -rw-r--r-- | src/mailman/rest/docs/__init__.py | 2 | ||||
| -rw-r--r-- | src/mailman/rest/docs/basic.rst | 4 | ||||
| -rw-r--r-- | src/mailman/rest/docs/configuration.rst | 6 | ||||
| -rw-r--r-- | src/mailman/rest/docs/helpers.rst | 18 | ||||
| -rw-r--r-- | src/mailman/rest/docs/lists.rst | 4 | ||||
| -rw-r--r-- | src/mailman/rest/docs/membership.rst | 4 | ||||
| -rw-r--r-- | src/mailman/rest/docs/moderation.rst | 10 |
7 files changed, 24 insertions, 24 deletions
diff --git a/src/mailman/rest/docs/__init__.py b/src/mailman/rest/docs/__init__.py index 794f5f034..2daf8a681 100644 --- a/src/mailman/rest/docs/__init__.py +++ b/src/mailman/rest/docs/__init__.py @@ -17,7 +17,7 @@ """Doctest layer setup.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ diff --git a/src/mailman/rest/docs/basic.rst b/src/mailman/rest/docs/basic.rst index cf02fa4ec..51b287c90 100644 --- a/src/mailman/rest/docs/basic.rst +++ b/src/mailman/rest/docs/basic.rst @@ -57,7 +57,7 @@ an appropriate HTTP 401 Unauthorized error. >>> from httplib2 import Http >>> response, content = Http().request(url, 'GET', None, headers) - >>> print content + >>> print(content) 401 Unauthorized <BLANKLINE> User is not authorized for the REST API @@ -69,7 +69,7 @@ But with the right headers, the request succeeds. ... config.webservice.admin_pass)) >>> headers['Authorization'] = 'Basic ' + auth >>> response, content = Http().request(url, 'GET', None, headers) - >>> print response.status + >>> print(response.status) 200 diff --git a/src/mailman/rest/docs/configuration.rst b/src/mailman/rest/docs/configuration.rst index 68644ff88..53ad172e9 100644 --- a/src/mailman/rest/docs/configuration.rst +++ b/src/mailman/rest/docs/configuration.rst @@ -177,7 +177,7 @@ Using ``PATCH``, you can change just one attribute. These values are changed permanently. - >>> print mlist.display_name + >>> print(mlist.display_name) My List @@ -224,7 +224,7 @@ Aliases are returned as a list on the ``aliases`` key. ... 'http://localhost:9001/3.0/lists/' ... 'ant@example.com/config/acceptable_aliases') >>> for alias in response['acceptable_aliases']: - ... print alias + ... print(alias) bar@example.net foo@example.com @@ -233,6 +233,6 @@ The mailing list has its aliases set. >>> from mailman.interfaces.mailinglist import IAcceptableAliasSet >>> aliases = IAcceptableAliasSet(mlist) >>> for alias in sorted(aliases.aliases): - ... print alias + ... print(alias) bar@example.net foo@example.com diff --git a/src/mailman/rest/docs/helpers.rst b/src/mailman/rest/docs/helpers.rst index 3e8092f4e..7405fc98f 100644 --- a/src/mailman/rest/docs/helpers.rst +++ b/src/mailman/rest/docs/helpers.rst @@ -13,7 +13,7 @@ They only need to know where they are relative to the root URI, and this function can return them the full path to the resource. >>> from mailman.rest.helpers import path_to - >>> print path_to('system') + >>> print(path_to('system')) http://localhost:9001/3.0/system Parameters like the ``scheme``, ``host``, ``port``, and API version number can @@ -29,7 +29,7 @@ be set in the configuration file. ... """) >>> cleanups.append((config.pop, 'helpers')) - >>> print path_to('system') + >>> print(path_to('system')) https://geddy:2112/4.2/system @@ -44,7 +44,7 @@ gets modified to contain the etag under the ``http_etag`` key. >>> from mailman.rest.helpers import etag >>> resource = dict(geddy='bass', alex='guitar', neil='drums') >>> json_data = etag(resource) - >>> print resource['http_etag'] + >>> print(resource['http_etag']) "43942176d8d5bb4414ccf35e2720ccd5251e66da" For convenience, the etag function also returns the JSON representation of the @@ -79,7 +79,7 @@ their values. On valid input, the validator can be used as a ``**keyword`` argument. >>> def print_request(one, two, three): - ... print repr(one), repr(two), repr(three) + ... print(repr(one), repr(two), repr(three)) >>> print_request(**validator(FakeRequest)) 1 u'two' True @@ -126,7 +126,7 @@ However, if optional keys are missing, it's okay. >>> FakeRequest.POST = dict(one='1', two='two', three='yes', ... four='4', five='5') >>> def print_request(one, two, three, four=None, five=None): - ... print repr(one), repr(two), repr(three), repr(four), repr(five) + ... print(repr(one), repr(two), repr(three), repr(four), repr(five)) >>> print_request(**validator(FakeRequest)) 1 u'two' True 4 5 @@ -183,9 +183,9 @@ And a validator to pull it all together. >>> validator = Validator(one=must_be_scalar, many=must_be_list) >>> FakeRequest.POST = form_data >>> values = validator(FakeRequest) - >>> print values['one'] + >>> print(values['one']) 1 - >>> print values['many'] + >>> print(values['many']) [3, 4, 5] The list values are guaranteed to be in the same order they show up in the @@ -197,7 +197,7 @@ form data. >>> form_data.add('many', '4') >>> FakeRequest.POST = form_data >>> values = validator(FakeRequest) - >>> print values['one'] + >>> print(values['one']) 1 - >>> print values['many'] + >>> print(values['many']) [3, 5, 4] diff --git a/src/mailman/rest/docs/lists.rst b/src/mailman/rest/docs/lists.rst index 27503c1c1..aa03de039 100644 --- a/src/mailman/rest/docs/lists.rst +++ b/src/mailman/rest/docs/lists.rst @@ -210,7 +210,7 @@ Existing mailing lists can be deleted through the API, by doing an HTTP The mailing list does not exist. - >>> print list_manager.get('bee@example.com') + >>> print(list_manager.get('bee@example.com')) None .. Abort the Storm transaction. @@ -228,7 +228,7 @@ address as well. The mailing list does not exist. - >>> print list_manager.get('ant@example.com') + >>> print(list_manager.get('ant@example.com')) None diff --git a/src/mailman/rest/docs/membership.rst b/src/mailman/rest/docs/membership.rst index 7c92d8343..30e69d9f5 100644 --- a/src/mailman/rest/docs/membership.rst +++ b/src/mailman/rest/docs/membership.rst @@ -706,7 +706,7 @@ Fred is getting MIME deliveries. >>> memberships[0] <Member: Fred Person <fperson@example.com> on ant@example.com as MemberRole.member> - >>> print memberships[0].delivery_mode + >>> print(memberships[0].delivery_mode) DeliveryMode.mime_digests >>> dump_json('http://localhost:9001/3.0/members/10') @@ -825,7 +825,7 @@ Herb must iterate through his memberships explicitly. ... 'herb@example.com/memberships') >>> memberships = [entry['self_link'] for entry in content['entries']] >>> for url in sorted(memberships): - ... print url + ... print(url) http://localhost:9001/3.0/members/11 http://localhost:9001/3.0/members/12 diff --git a/src/mailman/rest/docs/moderation.rst b/src/mailman/rest/docs/moderation.rst index 1b08b8d06..44182eb23 100644 --- a/src/mailman/rest/docs/moderation.rst +++ b/src/mailman/rest/docs/moderation.rst @@ -158,7 +158,7 @@ moderation. >>> transaction.commit() >>> results = call_http(url(request_id)) - >>> print results['message_id'] + >>> print(results['message_id']) <bravo> >>> dump_json(url(request_id), { @@ -173,7 +173,7 @@ moderation. >>> messages = get_queue_messages('pipeline') >>> len(messages) 1 - >>> print messages[0].msg['message-id'] + >>> print(messages[0].msg['message-id']) <bravo> Messages can be rejected via the REST API too. These bounce the message back @@ -186,7 +186,7 @@ to the original author. >>> transaction.commit() >>> results = call_http(url(request_id)) - >>> print results['message_id'] + >>> print(results['message_id']) <charlie> >>> dump_json(url(request_id), { @@ -201,7 +201,7 @@ to the original author. >>> messages = get_queue_messages('virgin') >>> len(messages) 1 - >>> print messages[0].msg['subject'] + >>> print(messages[0].msg['subject']) Request to mailing list "Ant" rejected @@ -358,7 +358,7 @@ Bart's unsubscription request is discarded. Bart is still a member of the mailing list. >>> transaction.abort() - >>> print ant.members.get_member('bart@example.com') + >>> print(ant.members.get_member('bart@example.com')) <Member: Bart Person <bart@example.com> on ant@example.com as MemberRole.member> >>> transaction.abort() |
