summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt6
-rw-r--r--HISTORY.txt2
-rw-r--r--docs/api/request.rst4
-rw-r--r--docs/narr/i18n.rst4
-rw-r--r--docs/narr/introduction.rst2
-rw-r--r--docs/narr/project.rst12
-rw-r--r--docs/narr/sessions.rst17
-rw-r--r--docs/narr/traversal.rst2
-rw-r--r--docs/narr/urldispatch.rst2
-rw-r--r--docs/narr/viewconfig.rst2
-rw-r--r--docs/whatsnew-1.1.rst4
-rw-r--r--pyramid/config/adapters.py4
-rw-r--r--pyramid/interfaces.py2
-rw-r--r--pyramid/renderers.py4
-rw-r--r--pyramid/scripts/pserve.py43
-rw-r--r--pyramid/tests/test_scripts/test_pserve.py2
16 files changed, 68 insertions, 44 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 8292a2382..457bfc7b7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -121,6 +121,12 @@ Features
https://github.com/Pylons/pyramid/pull/1004 and
https://github.com/Pylons/pyramid/pull/1046
+- The ``pserve`` command now takes a ``-v`` (or ``--verbose``) flag and a
+ ``-q`` (or ``--quiet``) flag. Output from running ``pserve`` can be
+ controlled using these flags. ``-v`` can be specified multiple times to
+ increase verbosity. ``-q`` sets verbosity to ``0`` unconditionally. The
+ default verbosity level is ``1``.
+
Bug Fixes
---------
diff --git a/HISTORY.txt b/HISTORY.txt
index 67de56998..bf054f9ed 100644
--- a/HISTORY.txt
+++ b/HISTORY.txt
@@ -2150,7 +2150,7 @@ Features
- Add ``wild_domain`` argument to AuthTktAuthenticationPolicy, which defaults
to ``True``. If it is set to ``False``, the feature of the policy which
- sets a cookie with a wilcard domain will be turned off.
+ sets a cookie with a wildcard domain will be turned off.
- Add a ``MANIFEST.in`` file to each paster template. See
https://github.com/Pylons/pyramid/issues#issue/95
diff --git a/docs/api/request.rst b/docs/api/request.rst
index b1f5918d7..a90cb1ac0 100644
--- a/docs/api/request.rst
+++ b/docs/api/request.rst
@@ -156,7 +156,7 @@
.. attribute:: matched_route
If a :term:`route` has matched during this request, this attribute will
- be an obect representing the route matched by the URL pattern
+ be an object representing the route matched by the URL pattern
associated with the route. If a route has not matched during this
request, the value of this attribute will be ``None``. See
:ref:`matched_route`.
@@ -238,7 +238,7 @@
.. attribute:: response_*
In Pyramid 1.0, you could set attributes on a
- :class:`pyramid.request.Request` which influenced the behavor of
+ :class:`pyramid.request.Request` which influenced the behavior of
*rendered* responses (views which use a :term:`renderer` and which
don't directly return a response). These attributes began with
``response_``, such as ``response_headerlist``. If you needed to
diff --git a/docs/narr/i18n.rst b/docs/narr/i18n.rst
index 74765f8e2..2964686d3 100644
--- a/docs/narr/i18n.rst
+++ b/docs/narr/i18n.rst
@@ -808,7 +808,7 @@ If this setting is supplied within the :app:`Pyramid` application
default_locale_name = settings['pyramid.default_locale_name']
.. index::
- single: detecting langauges
+ single: detecting languages
"Detecting" Available Languages
-------------------------------
@@ -984,7 +984,7 @@ requires no additional coding or configuration.
The default locale negotiator implementation named
:class:`~pyramid.i18n.default_locale_negotiator` uses the following
-set of steps to dermine the locale name.
+set of steps to determine the locale name.
- First, the negotiator looks for the ``_LOCALE_`` attribute of the
request object (possibly set directly by view code or by a listener
diff --git a/docs/narr/introduction.rst b/docs/narr/introduction.rst
index fa2646134..032f4be6b 100644
--- a/docs/narr/introduction.rst
+++ b/docs/narr/introduction.rst
@@ -859,7 +859,7 @@ It's our goal that no Pyramid question go unanswered. Whether you ask a
question on IRC, on the Pylons-discuss maillist, or on StackOverflow, you're
likely to get a reasonably prompt response. We don't tolerate "support
trolls" or other people who seem to get their rocks off by berating fellow
-users in our various offical support channels. We try to keep it well-lit
+users in our various official support channels. We try to keep it well-lit
and new-user-friendly.
Example: Visit irc\://freenode.net#pyramid (the ``#pyramid`` channel on
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 9d69a65a5..e25f3012a 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -1005,12 +1005,12 @@ Pyramid application based on the data in the file.
application. As we saw in :ref:`firstapp_chapter`, ``pserve`` needn't be
invoked at all to run a :app:`Pyramid` application. The use of ``pserve`` to
run a :app:`Pyramid` application is purely conventional based on the output
-of its scaffolding. But we strongly recommend using while developing your
-application, because many other convenience introspection commands (such as
-``pviews``, ``prequest``, ``proutes`` and others) are also implemented in
-terms of configuration availability of this ``.ini`` file format. It also
-configures Pyramid logging and provides the ``--reload`` switch for
-convenient restarting of the server when code changes.
+of its scaffolding. But we strongly recommend using ``pserve`` while
+developing your application, because many other convenience introspection
+commands (such as ``pviews``, ``prequest``, ``proutes`` and others) are also
+implemented in terms of configuration availability of this ``.ini`` file
+format. It also configures Pyramid logging and provides the ``--reload``
+switch for convenient restarting of the server when code changes.
.. _alternate_wsgi_server:
diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst
index 7ec280c8a..82440060c 100644
--- a/docs/narr/sessions.rst
+++ b/docs/narr/sessions.rst
@@ -148,6 +148,7 @@ Some gotchas:
.. index::
single: pyramid_beaker
single: Beaker
+ single: pyramid_redis_sessions
single: session factory (alternates)
.. _using_alternate_session_factories:
@@ -155,11 +156,17 @@ Some gotchas:
Using Alternate Session Factories
---------------------------------
-At the time of this writing, exactly one alternate session factory
-implementation exists, named ``pyramid_beaker``. This is a session factory
-that uses the `Beaker <http://beaker.groovie.org/>`_ library as a backend.
-Beaker has support for file-based sessions, database based sessions, and
-encrypted cookie-based sessions. See `the pyramid_beaker documentation
+At the time of this writing, exactly two alternate session factories
+exist.
+
+The first is named ``pyramid_redis_sessions``. It can be downloaded from PyPI.
+It uses Redis as a backend. It is the recommended persistent session solution
+at the time of this writing.
+
+The second is named ``pyramid_beaker``. This is a session factory that uses the
+`Beaker <http://beaker.groovie.org/>`_ library as a backend. Beaker has
+support for file-based sessions, database based sessions, and encrypted
+cookie-based sessions. See `the pyramid_beaker documentation
<http://docs.pylonsproject.org/projects/pyramid_beaker/en/latest/>`_ for more
information about ``pyramid_beaker``.
diff --git a/docs/narr/traversal.rst b/docs/narr/traversal.rst
index 2eb6ece13..a60c5ba56 100644
--- a/docs/narr/traversal.rst
+++ b/docs/narr/traversal.rst
@@ -289,7 +289,7 @@ system uses this algorithm to find a :term:`context` resource and a
return resource "C".
#. Traversal ends when a) the entire path is exhausted or b) when any
- resouce raises a :exc:`KeyError` from its ``__getitem__`` or c) when any
+ resource raises a :exc:`KeyError` from its ``__getitem__`` or c) when any
non-final path element traversal does not have a ``__getitem__`` method
(resulting in a :exc:`AttributeError`) or d) when any path element is
prefixed with the set of characters ``@@`` (indicating that the characters
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst
index 18cb3e4db..310c160c0 100644
--- a/docs/narr/urldispatch.rst
+++ b/docs/narr/urldispatch.rst
@@ -865,7 +865,7 @@ Debugging Route Matching
------------------------
It's useful to be able to take a peek under the hood when requests that enter
-your application arent matching your routes as you expect them to. To debug
+your application aren't matching your routes as you expect them to. To debug
route matching, use the ``PYRAMID_DEBUG_ROUTEMATCH`` environment variable or the
``pyramid.debug_routematch`` configuration file setting (set either to ``true``).
Details of the route matching decision for a particular request to the
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst
index fd3229339..6a064c209 100644
--- a/docs/narr/viewconfig.rst
+++ b/docs/narr/viewconfig.rst
@@ -831,7 +831,7 @@ of this:
config.add_view(
RESTView, route_name='rest', attr='delete', request_method='DELETE')
-To reduce the amount of repetion in the ``config.add_view`` statements, we
+To reduce the amount of repetition in the ``config.add_view`` statements, we
can move the ``route_name='rest'`` argument to a ``@view_default`` class
decorator on the RESTView class:
diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst
index 5cba8dd3e..cc63017df 100644
--- a/docs/whatsnew-1.1.rst
+++ b/docs/whatsnew-1.1.rst
@@ -13,7 +13,7 @@ Terminology Changes
The term "template" used by the Pyramid documentation used to refer to both
"paster templates" and "rendered templates" (templates created by a rendering
engine. i.e. Mako, Chameleon, Jinja, etc.). "Paster templates" will now be
-refered to as "scaffolds", whereas the name for "rendered templates" will
+referred to as "scaffolds", whereas the name for "rendered templates" will
remain as "templates."
Major Feature Additions
@@ -397,7 +397,7 @@ Deprecations and Behavior Differences
shell you use to invoke ``paster serve`` to see these warnings, e.g. on
UNIX, ``PYTHONWARNINGS=all $VENV/bin/paster serve development.ini``.
Python 2.5 and 2.6 show deprecation warnings by default,
- so this is unecessary there.
+ so this is unnecessary there.
All deprecation warnings are emitted to the console.
- The :class:`pyramid.view.static` class has been deprecated in favor of the
diff --git a/pyramid/config/adapters.py b/pyramid/config/adapters.py
index fe8e973b1..5573b6748 100644
--- a/pyramid/config/adapters.py
+++ b/pyramid/config/adapters.py
@@ -216,7 +216,7 @@ class AdaptersConfiguratorMixin(object):
config.add_traverser(MyCustomTraverser)
This would cause the Pyramid superdefault traverser to never be used;
- intead all traversal would be done using your ``MyCustomTraverser``
+ instead all traversal would be done using your ``MyCustomTraverser``
class, no matter which object was returned by the :term:`root
factory` of this application. Note that we passed no arguments to
the ``iface`` keyword parameter. The default value of ``iface``,
@@ -228,7 +228,7 @@ class AdaptersConfiguratorMixin(object):
time. The traverser used can depend on the result of the :term:`root
factory`. For instance, if your root factory returns more than one
type of object conditionally, you could claim that an alternate
- traverser adapter should be used agsinst one particular class or
+ traverser adapter should be used against one particular class or
interface returned by that root factory. When the root factory
returned an object that implemented that class or interface, a custom
traverser would be used. Otherwise, the default traverser would be
diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py
index a57f61ddb..275209737 100644
--- a/pyramid/interfaces.py
+++ b/pyramid/interfaces.py
@@ -915,7 +915,7 @@ class ISession(IDict):
by ``queue``. An alternate flash message queue can used by passing
an optional ``queue``, which must be a string. If
``allow_duplicate`` is false, if the ``msg`` already exists in the
- queue, it will not be readded."""
+ queue, it will not be re-added."""
def pop_flash(queue=''):
""" Pop a queue from the flash storage. The queue is removed from
diff --git a/pyramid/renderers.py b/pyramid/renderers.py
index 64951a6ba..602655be8 100644
--- a/pyramid/renderers.py
+++ b/pyramid/renderers.py
@@ -114,7 +114,7 @@ def render_to_response(renderer_name, value, request=None, package=None):
top-level system names, such as ``request``, ``context``,
``renderer_name``, and ``view``. See :ref:`renderer_system_values` for
the full list. If :term:`renderer globals` have been specified, these
- will also be used to agument the value.
+ will also be used to argument the value.
Supply a ``request`` parameter in order to provide the renderer
with the most correct 'system' values (``request`` and ``context``
@@ -200,7 +200,7 @@ class JSON(object):
The default serializer uses ``json.JSONEncoder``. A different
serializer can be specified via the ``serializer`` argument.
Custom serializers should accept the object, a callback
- ``default``, and any extra ``kw`` keyword argments passed during
+ ``default``, and any extra ``kw`` keyword arguments passed during
renderer construction.
.. versionadded:: 1.4
diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py
index b840fbdb9..cc368d721 100644
--- a/pyramid/scripts/pserve.py
+++ b/pyramid/scripts/pserve.py
@@ -65,7 +65,7 @@ class PServeCommand(object):
You can also include variable assignments like 'http_port=8080'
and then use %(http_port)s in your config files.
"""
- verbose = 1
+ default_verbosity = 1
parser = optparse.OptionParser(
usage,
@@ -125,6 +125,18 @@ class PServeCommand(object):
action='store_true',
dest='show_status',
help="Show the status of the (presumably daemonized) server")
+ parser.add_option(
+ '-v', '--verbose',
+ default=default_verbosity,
+ dest='verbose',
+ action='count',
+ help="Set verbose level (default "+str(default_verbosity)+")")
+ parser.add_option(
+ '-q', '--quiet',
+ action='store_const',
+ const=0,
+ dest='verbose',
+ help="Suppress verbose output")
if hasattr(os, 'setuid'):
# I don't think these are available on Windows
@@ -148,19 +160,18 @@ class PServeCommand(object):
_scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)
- default_verbosity = 1
-
_reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'
_monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'
possible_subcommands = ('start', 'stop', 'restart', 'status')
def __init__(self, argv, quiet=False):
- self.quiet = quiet
self.options, self.args = self.parser.parse_args(argv[1:])
+ if quiet:
+ self.options.verbose = 0
def out(self, msg): # pragma: no cover
- if not self.quiet:
+ if self.options.verbose > 0:
print(msg)
def get_options(self):
@@ -197,7 +208,7 @@ class PServeCommand(object):
if self.options.reload:
if os.environ.get(self._reloader_environ_key):
- if self.verbose > 1:
+ if self.options.verbose > 1:
self.out('Running reloading file monitor')
install_reloader(int(self.options.reload_interval), [app_spec])
# if self.requires_config_file:
@@ -271,7 +282,7 @@ class PServeCommand(object):
try:
self.daemonize()
except DaemonizeException as ex:
- if self.verbose > 0:
+ if self.options.verbose > 0:
self.out(str(ex))
return 2
@@ -303,7 +314,7 @@ class PServeCommand(object):
app = self.loadapp(app_spec, name=app_name, relative_to=base,
global_conf=vars)
- if self.verbose > 0:
+ if self.options.verbose > 0:
if hasattr(os, 'getpid'):
msg = 'Starting server in PID %i.' % os.getpid()
else:
@@ -314,7 +325,7 @@ class PServeCommand(object):
try:
server(app)
except (SystemExit, KeyboardInterrupt) as e:
- if self.verbose > 1:
+ if self.options.verbose > 1:
raise
if str(e):
msg = ' ' + str(e)
@@ -358,7 +369,7 @@ class PServeCommand(object):
"Daemon is already running (PID: %s from PID file %s)"
% (pid, self.options.pid_file))
- if self.verbose > 0:
+ if self.options.verbose > 0:
self.out('Entering daemon mode')
pid = os.fork()
if pid:
@@ -433,11 +444,11 @@ class PServeCommand(object):
def record_pid(self, pid_file):
pid = os.getpid()
- if self.verbose > 1:
+ if self.options.verbose > 1:
self.out('Writing PID %s to %s' % (pid, pid_file))
with open(pid_file, 'w') as f:
f.write(str(pid))
- atexit.register(self._remove_pid_file, pid, pid_file, self.verbose)
+ atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)
def stop_daemon(self): # pragma: no cover
pid_file = self.options.pid_file or 'pyramid.pid'
@@ -490,7 +501,7 @@ class PServeCommand(object):
self.restart_with_monitor(reloader=True)
def restart_with_monitor(self, reloader=False): # pragma: no cover
- if self.verbose > 0:
+ if self.options.verbose > 0:
if reloader:
self.out('Starting subprocess with file monitor')
else:
@@ -511,7 +522,7 @@ class PServeCommand(object):
proc = None
except KeyboardInterrupt:
self.out('^C caught in monitor process')
- if self.verbose > 1:
+ if self.options.verbose > 1:
raise
return 1
finally:
@@ -527,7 +538,7 @@ class PServeCommand(object):
# a monitor, any exit code will restart
if exit_code != 3:
return exit_code
- if self.verbose > 0:
+ if self.options.verbose > 0:
self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))
def change_user_group(self, user, group): # pragma: no cover
@@ -559,7 +570,7 @@ class PServeCommand(object):
if not gid:
gid = entry.pw_gid
uid = entry.pw_uid
- if self.verbose > 0:
+ if self.options.verbose > 0:
self.out('Changing user to %s:%s (%s:%s)' % (
user, group or '(unknown)', uid, gid))
if gid:
diff --git a/pyramid/tests/test_scripts/test_pserve.py b/pyramid/tests/test_scripts/test_pserve.py
index 6e4b0f17d..107ff4c0a 100644
--- a/pyramid/tests/test_scripts/test_pserve.py
+++ b/pyramid/tests/test_scripts/test_pserve.py
@@ -156,7 +156,7 @@ class TestPServeCommand(unittest.TestCase):
self.pid_file = tempfile.mktemp()
pid = os.getpid()
inst = self._makeOne()
- inst.verbose = verbosity
+ inst.options.verbose = verbosity
try:
atexit.register = fake_atexit