summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Anderson <sontek@gmail.com>2015-01-20 18:34:27 -0800
committerJohn Anderson <sontek@gmail.com>2015-01-20 18:34:27 -0800
commit8724ab8301c9d5808d781bab0af1df56909c9236 (patch)
tree34fa963e424bae500e6bc010a7d2012c3d9bc89d
parentae7bcd7cabc53e0b500c6a79f30606e67217ad1d (diff)
parent6c867a84ed7d7a1307811fba0cf1e1575b9dbefb (diff)
downloadpyramid-8724ab8301c9d5808d781bab0af1df56909c9236.tar.gz
pyramid-8724ab8301c9d5808d781bab0af1df56909c9236.tar.bz2
pyramid-8724ab8301c9d5808d781bab0af1df56909c9236.zip
Merge branch 'master' of https://github.com/Pylons/pyramid into support_more_features_in_routes
Conflicts: CHANGES.txt
-rw-r--r--CHANGES.txt3
-rw-r--r--HISTORY.txt2
-rw-r--r--docs/narr/hooks.rst2
-rw-r--r--docs/narr/hybrid.rst2
-rw-r--r--docs/narr/introspector.rst16
-rw-r--r--docs/narr/sessions.rst4
-rw-r--r--pyramid/scripts/pserve.py18
7 files changed, 34 insertions, 13 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 0381c1820..b1bd36904 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -68,6 +68,9 @@ Features
possible to return bytes or unicode.
See https://github.com/Pylons/pyramid/pull/1417
+- ``pserve`` can now take a ``-b`` or ``--browser`` option to open the server
+ URL in a web browser. See https://github.com/Pylons/pyramid/pull/1533
+
- Overall improvments for the ``proutes`` command. Added ``--format`` and
``--glob`` arguments to the command, introduced the ``method``
column for displaying available request methods, and improved the ``view``
diff --git a/HISTORY.txt b/HISTORY.txt
index 6aad221a8..242568e98 100644
--- a/HISTORY.txt
+++ b/HISTORY.txt
@@ -1327,7 +1327,7 @@ Bug Fixes
- Make test suite pass on 32-bit systems; closes #286. closes #306.
See also https://github.com/Pylons/pyramid/issues/286
-- The ``pryamid.view.view_config`` decorator did not accept a ``match_params``
+- The ``pyramid.view.view_config`` decorator did not accept a ``match_params``
predicate argument. See https://github.com/Pylons/pyramid/pull/308
- The AuthTktCookieHelper could potentially generate Unicode headers
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index e250c2d7e..5bba0d143 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -777,7 +777,7 @@ If you want to implement your own Response object instead of using the
:class:`pyramid.response.Response` object in any capacity at all, you'll have
to make sure the object implements every attribute and method outlined in
:class:`pyramid.interfaces.IResponse` and you'll have to ensure that it uses
-``zope.interface.implementer(IResponse)`` as a class decoratoror.
+``zope.interface.implementer(IResponse)`` as a class decorator.
.. code-block:: python
:linenos:
diff --git a/docs/narr/hybrid.rst b/docs/narr/hybrid.rst
index 4a3258d35..1c324d22b 100644
--- a/docs/narr/hybrid.rst
+++ b/docs/narr/hybrid.rst
@@ -453,7 +453,7 @@ commonly in route declarations that look like this:
.. code-block:: python
:linenos:
- from pryamid.static import static_view
+ from pyramid.static import static_view
www = static_view('mypackage:static', use_subpath=True)
diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst
index a7bde4cf7..8caba522c 100644
--- a/docs/narr/introspector.rst
+++ b/docs/narr/introspector.rst
@@ -121,7 +121,7 @@ introspectables in categories not described here.
``subscriber``
The subscriber callable object (the resolution of the ``subscriber``
- argument passed to ``add_susbcriber``).
+ argument passed to ``add_subscriber``).
``interfaces``
@@ -137,12 +137,12 @@ introspectables in categories not described here.
``predicates``
The predicate objects created as the result of passing predicate arguments
- to ``add_susbcriber``
+ to ``add_subscriber``
``derived_predicates``
Wrappers around the predicate objects created as the result of passing
- predicate arguments to ``add_susbcriber`` (to be used when predicates take
+ predicate arguments to ``add_subscriber`` (to be used when predicates take
only one value but must be passed more than one).
``response adapters``
@@ -450,9 +450,9 @@ introspectables in categories not described here.
The :class:`pyramid.interfaces.IRendererInfo` object which represents
this template's renderer.
-``view mapper``
+``view mappers``
- Each introspectable in the ``permissions`` category represents a call to
+ Each introspectable in the ``view mappers`` category represents a call to
:meth:`pyramid.config.Configurator.add_view` that has an explicit
``mapper`` argument to *or* a call to
:meth:`pyramid.config.Configurator.set_view_mapper`; each will have
@@ -481,8 +481,8 @@ introspectables in categories not described here.
``translation directories``
- Each introspectable in the ``asset overrides`` category represents an
- individual element in a ``specs`` argument passed to
+ Each introspectable in the ``translation directories`` category represents
+ an individual element in a ``specs`` argument passed to
:meth:`pyramid.config.Configurator.add_translation_dirs`; each will have
the following data.
@@ -511,7 +511,7 @@ introspectables in categories not described here.
``type``
- ``implict`` or ``explicit`` as a string.
+ ``implicit`` or ``explicit`` as a string.
``under``
diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst
index 8da743a01..5c103405a 100644
--- a/docs/narr/sessions.rst
+++ b/docs/narr/sessions.rst
@@ -44,7 +44,7 @@ It is digitally signed, however, and thus its data cannot easily be
tampered with.
You can configure this session factory in your :app:`Pyramid` application
-by using the :meth:`pyramid.config.Configurator.set_session_factory`` method.
+by using the :meth:`pyramid.config.Configurator.set_session_factory` method.
.. code-block:: python
:linenos:
@@ -380,7 +380,7 @@ Checking CSRF Tokens Manually
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In request handling code, you can check the presence and validity of a CSRF
-token with :func:`pyramid.session.check_csrf_token(request)``. If the token is
+token with :func:`pyramid.session.check_csrf_token`. If the token is
valid, it will return ``True``, otherwise it will raise ``HTTPBadRequest``.
Optionally, you can specify ``raises=False`` to have the check return ``False``
instead of raising an exception.
diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py
index ea125a0dd..314efd839 100644
--- a/pyramid/scripts/pserve.py
+++ b/pyramid/scripts/pserve.py
@@ -21,9 +21,11 @@ import textwrap
import threading
import time
import traceback
+import webbrowser
from paste.deploy import loadserver
from paste.deploy import loadapp
+from paste.deploy.loadwsgi import loadcontext, SERVER
from pyramid.compat import PY3
from pyramid.compat import WIN
@@ -122,6 +124,11 @@ class PServeCommand(object):
action='store_true',
help="Auto-restart server if it dies")
parser.add_option(
+ '-b', '--browser',
+ dest='browser',
+ action='store_true',
+ help="Open a web browser to server url")
+ parser.add_option(
'--status',
action='store_true',
dest='show_status',
@@ -334,6 +341,17 @@ class PServeCommand(object):
msg = ''
self.out('Exiting%s (-v to see traceback)' % msg)
+ if self.options.browser:
+ def open_browser():
+ context = loadcontext(SERVER, app_spec, name=app_name, relative_to=base,
+ global_conf=vars)
+ url = 'http://{host}:{port}/'.format(**context.config())
+ time.sleep(1)
+ webbrowser.open(url)
+ t = threading.Thread(target=open_browser)
+ t.setDaemon(True)
+ t.start()
+
serve()
def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover