From 509ca0fd906304b7fc672fcc7cb7a59527f1ba86 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 12 Sep 2015 05:19:46 -0700 Subject: Fix possessive form, from PR by @uralbash --- docs/narr/viewconfig.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst index 46b2c4f76..484350b31 100644 --- a/docs/narr/viewconfig.rst +++ b/docs/narr/viewconfig.rst @@ -108,7 +108,7 @@ Non-Predicate Arguments function) to obtain a response. The ``attr`` value allows you to vary the method attribute used to obtain the response. For example, if your view was a class, and the class has a method named ``index`` and you wanted to - use this method instead of the class' ``__call__`` method to return the + use this method instead of the class's ``__call__`` method to return the response, you'd say ``attr="index"`` in the view configuration for the view. This is most useful when the view definition is a class. -- cgit v1.2.3 From 1363db83ae9fb02c50c700691ee0ba75b604960a Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 20 Apr 2015 01:37:38 -0500 Subject: deprecate pserve daemonization --- CHANGES.txt | 11 +++++++++++ pyramid/scripts/pserve.py | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 98fa7f85a..7c8a9080a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -209,6 +209,17 @@ Bug Fixes Deprecations ------------ +- The ``pserve`` command's daemonization features have been deprecated. This + includes the ``[start,stop,restart,status]`` subcommands as well as the + ``--daemon``, ``--stop-server``, ``--pid-file``, and ``--status`` flags. + + Please use a real process manager in the future instead of relying on the + ``pserve`` to daemonize itself. Many options exist including your Operating + System's services such as systemd or upstart, as well as the excellent + and simple supervisord. + + See https://github.com/Pylons/pyramid/pull/1641 + - Renamed the ``principal`` argument to ``pyramid.security.remember()`` to ``userid`` in order to clarify its intended purpose. See https://github.com/Pylons/pyramid/pull/1399 diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py index e97bdcd48..a30ea5985 100644 --- a/pyramid/scripts/pserve.py +++ b/pyramid/scripts/pserve.py @@ -200,6 +200,7 @@ class PServeCommand(object): def run(self): # pragma: no cover if self.options.stop_daemon: + self._warn_daemon_deprecated() return self.stop_daemon() if not hasattr(self.options, 'set_user'): @@ -239,9 +240,11 @@ class PServeCommand(object): return 2 if cmd == 'status' or self.options.show_status: + self._warn_daemon_deprecated() return self.show_status() if cmd == 'restart' or cmd == 'stop': + self._warn_daemon_deprecated() result = self.stop_daemon() if result: if cmd == 'restart': @@ -271,6 +274,10 @@ class PServeCommand(object): server_spec = app_spec base = os.getcwd() + # warn before setting a default + if self.options.pid_file: + self._warn_daemon_deprecated() + if getattr(self.options, 'daemon', False): if not self.options.pid_file: self.options.pid_file = 'pyramid.pid' @@ -296,6 +303,7 @@ class PServeCommand(object): writeable_pid_file.close() if getattr(self.options, 'daemon', False): + self._warn_daemon_deprecated() try: self.daemonize() except DaemonizeException as ex: @@ -610,6 +618,15 @@ class PServeCommand(object): if uid: os.setuid(uid) + def _warn_daemon_deprecated(self): + self.out('''\ +The daemon options have been deprecated in Pyramid 1.6. They will be removed +in a future release per Pyramid's deprecation policy. Please consider using +a real process manager for handling your processes like supervisord or systemd. + +The following commands are deprecated: + [start,stop,restart,status] --daemon, --stop-server, --status, --pid-file +''') class LazyWriter(object): -- cgit v1.2.3 From 7d5d899f5043b381348bd349792fda6da957ab50 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 13 Sep 2015 02:55:03 -0400 Subject: fix broken tests --- pyramid/tests/test_scripts/test_pserve.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyramid/tests/test_scripts/test_pserve.py b/pyramid/tests/test_scripts/test_pserve.py index 75d4f5bef..2d4c4e1c0 100644 --- a/pyramid/tests/test_scripts/test_pserve.py +++ b/pyramid/tests/test_scripts/test_pserve.py @@ -180,14 +180,14 @@ class TestPServeCommand(unittest.TestCase): inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path) inst.run() msg = 'No PID file exists in %s' % path - self.assertEqual(self.out_.getvalue(), msg) + self.assertTrue(msg in self.out_.getvalue()) def test_run_stop_daemon_bad_pid_file(self): path = __file__ inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path) inst.run() msg = 'Not a valid PID file in %s' % path - self.assertEqual(self.out_.getvalue(), msg) + self.assertTrue(msg in self.out_.getvalue()) def test_run_stop_daemon_invalid_pid_in_file(self): fn = tempfile.mktemp() @@ -197,7 +197,7 @@ class TestPServeCommand(unittest.TestCase): inst = self._makeOne('--stop-daemon', '--pid-file=%s' % fn) inst.run() msg = 'PID in %s is not valid (deleting)' % fn - self.assertEqual(self.out_.getvalue(), msg) + self.assertTrue(msg in self.out_.getvalue()) def test_get_options_with_command(self): inst = self._makeOne() -- cgit v1.2.3