summaryrefslogtreecommitdiff
path: root/src/mailman/app/docs/hooks.rst
diff options
context:
space:
mode:
authorBarry Warsaw2014-04-28 11:23:35 -0400
committerBarry Warsaw2014-04-28 11:23:35 -0400
commitd4d71f71f08d6d440b17482eecc5472dcfe6cbae (patch)
tree71f08b3d60f698883294eaa6d1bf366a095da011 /src/mailman/app/docs/hooks.rst
parent7536530dcd8d6303c0a869e8c9c2cb2517b9b018 (diff)
downloadmailman-d4d71f71f08d6d440b17482eecc5472dcfe6cbae.tar.gz
mailman-d4d71f71f08d6d440b17482eecc5472dcfe6cbae.tar.zst
mailman-d4d71f71f08d6d440b17482eecc5472dcfe6cbae.zip
Diffstat (limited to 'src/mailman/app/docs/hooks.rst')
-rw-r--r--src/mailman/app/docs/hooks.rst18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mailman/app/docs/hooks.rst b/src/mailman/app/docs/hooks.rst
index a29c7ee10..ca33f55fe 100644
--- a/src/mailman/app/docs/hooks.rst
+++ b/src/mailman/app/docs/hooks.rst
@@ -14,7 +14,7 @@ Hooks name an importable callable so it must be accessible on ``sys.path``.
>>> hook_path = os.path.join(config_directory, 'hooks.py')
>>> with open(hook_path, 'w') as fp:
- ... print >> fp, """\
+ ... print("""\
... counter = 1
... def pre_hook():
... global counter
@@ -25,7 +25,7 @@ Hooks name an importable callable so it must be accessible on ``sys.path``.
... global counter
... print 'post-hook:', counter
... counter += 1
- ... """
+ ... """, file=fp)
>>> fp.close()
@@ -36,13 +36,13 @@ We can set the pre-hook in the configuration file.
>>> config_path = os.path.join(config_directory, 'hooks.cfg')
>>> with open(config_path, 'w') as fp:
- ... print >> fp, """\
+ ... print("""\
... [meta]
... extends: test.cfg
...
... [mailman]
... pre_hook: hooks.pre_hook
- ... """
+ ... """, file=fp)
The hooks are run in the second and third steps of initialization. However,
we can't run those initialization steps in process, so call a command line
@@ -61,7 +61,7 @@ script that will produce no output to force the hooks to run.
... stdout=subprocess.PIPE, stderr=subprocess.PIPE)
... stdout, stderr = proc.communicate()
... assert proc.returncode == 0, stderr
- ... print stdout
+ ... print(stdout)
>>> call()
pre-hook: 1
@@ -77,13 +77,13 @@ We can set the post-hook in the configuration file.
::
>>> with open(config_path, 'w') as fp:
- ... print >> fp, """\
+ ... print("""\
... [meta]
... extends: test.cfg
...
... [mailman]
... post_hook: hooks.post_hook
- ... """
+ ... """, file=fp)
>>> call()
post-hook: 1
@@ -99,14 +99,14 @@ We can set the pre- and post-hooks in the configuration file.
::
>>> with open(config_path, 'w') as fp:
- ... print >> fp, """\
+ ... print("""\
... [meta]
... extends: test.cfg
...
... [mailman]
... pre_hook: hooks.pre_hook
... post_hook: hooks.post_hook
- ... """
+ ... """, file=fp)
>>> call()
pre-hook: 1