~nkarageuzian/mailman/bug-1312884

« back to all changes in this revision

Viewing changes to src/mailman/mta/docs/decorating.rst

  • Committer: Barry Warsaw
  • Date: 2014-04-28 15:23:35 UTC
  • Revision ID: barry@list.org-20140428152335-uomli7adnqf3h6dm
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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
    >>> myheader_path = os.path.join(site_dir, 'myheader.txt')
37
37
    >>> with open(myheader_path, 'w') as fp:
38
 
    ...     print >> fp, """\
 
38
    ...     print("""\
39
39
    ... Delivery address: $user_address
40
40
    ... Subscribed address: $user_delivered_to
41
 
    ... """
 
41
    ... """, file=fp)
42
42
    >>> myfooter_path = os.path.join(site_dir, 'myfooter.txt')
43
43
    >>> with open(myfooter_path, 'w') as fp:
44
 
    ...     print >> fp, """\
 
44
    ...     print("""\
45
45
    ... User name: $user_name
46
46
    ... Language: $user_language
47
47
    ... Options: $user_optionsurl
48
 
    ... """
 
48
    ... """, file=fp)
49
49
 
50
50
Then create a mailing list which will use this header and footer.  Because
51
51
these are site-global templates, we can use a shorted URL.
108
108
 
109
109
    >>> from operator import itemgetter
110
110
    >>> for message in sorted(messages, key=itemgetter('x-rcptto')):
111
 
    ...     print message.as_string()
112
 
    ...     print '----------'
 
111
    ...     print(message.as_string())
 
112
    ...     print('----------')
113
113
    From: aperson@example.org
114
114
    To: test@example.com
115
115
    Subject: test one
181
181
    3
182
182
 
183
183
    >>> for message in sorted(messages, key=itemgetter('x-rcptto')):
184
 
    ...     print message.as_string()
185
 
    ...     print '----------'
 
184
    ...     print(message.as_string())
 
185
    ...     print('----------')
186
186
    From: aperson@example.org
187
187
    To: test@example.com
188
188
    Subject: test one