Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Pylons/pyramid
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Jun 5, 2015
2 parents 7b4ed30 + c1dbb50 commit f3c67a4
Show file tree
Hide file tree
Showing 216 changed files with 4,676 additions and 6,527 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,5 @@ Contributors
- David Glick, 2015/02/12

- Donald Stufft, 2015/03/15

- Karen Dalton, 2015/06/01
2 changes: 1 addition & 1 deletion docs/api/request.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:exclude-members: add_response_callback, add_finished_callback,
route_url, route_path, current_route_url,
current_route_path, static_url, static_path,
model_url, resource_url, set_property,
model_url, resource_url, resource_path, set_property,
effective_principals, authenticated_userid,
unauthenticated_userid, has_permission

Expand Down
8 changes: 4 additions & 4 deletions docs/conventions.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Typographical Conventions
=========================

Literals, filenames and function arguments are presented using the
Literals, filenames, and function arguments are presented using the
following style:

``argument1``

Warnings, which represent limitations and need-to-know information
Warnings which represent limitations and need-to-know information
related to a topic or concept are presented in the following style:

.. warning::

This is a warning.

Notes, which represent additional information related to a topic or
Notes which represent additional information related to a topic or
concept are presented in the following style:

.. note::
Expand Down Expand Up @@ -105,7 +105,7 @@ It may look unusual, but it has advantages:

* It allows one to swap out the higher-level package ``foo`` for something
else that provides the similar API. An example would be swapping out
one Database for another (e.g. graduating from SQLite to PostgreSQL).
one Database for another (e.g., graduating from SQLite to PostgreSQL).

* Looks more neat in cases where a large number of objects get imported from
that package.
Expand Down
6 changes: 3 additions & 3 deletions docs/copyright.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ any trademark or service mark.

Every effort has been made to make this book as complete and as
accurate as possible, but no warranty or fitness is implied. The
information provided is on as "as-is" basis. The author and the
information provided is on an "as-is" basis. The author and the
publisher shall have neither liability nor responsibility to any
person or entity with respect to any loss or damages arising from the
information contained in this book. No patent liability is assumed
Expand Down Expand Up @@ -89,14 +89,14 @@ Contacting The Publisher
Please send documentation licensing inquiries, translation inquiries,
and other business communications to `Agendaless Consulting
<mailto:[email protected]>`_. Please send software and other
technical queries to the `Pylons-devel maillist
technical queries to the `Pylons-devel mailing list
<http://groups.google.com/group/pylons-devel>`_.

HTML Version and Source Code
----------------------------

An HTML version of this book is freely available via
http://docs.pylonsproject.org
http://docs.pylonsproject.org/projects/pyramid/en/latest/

The source code for the examples used in this book are available
within the :app:`Pyramid` software distribution, always available
Expand Down
165 changes: 83 additions & 82 deletions docs/narr/introduction.rst

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions docs/narr/sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ by using the :meth:`pyramid.config.Configurator.set_session_factory` method.
config = Configurator()
config.set_session_factory(my_session_factory)
.. warning::
.. warning::

By default the :func:`~pyramid.session.SignedCookieSessionFactory`
implementation is *unencrypted*. You should not use it
Expand Down Expand Up @@ -112,7 +112,7 @@ Extra attributes:
An integer timestamp indicating the time that this session was created.

``new``
A boolean. If ``new`` is True, this session is new. Otherwise, it has
A boolean. If ``new`` is True, this session is new. Otherwise, it has
been constituted from data that was already serialized.

Extra methods:
Expand Down Expand Up @@ -225,7 +225,7 @@ method:
request.session.flash('mymessage')
The ``flash()`` method appends a message to a flash queue, creating the queue
if necessary.
if necessary.

``flash()`` accepts three arguments:

Expand Down Expand Up @@ -406,14 +406,20 @@ Checking CSRF Tokens With A View Predicate

A convenient way to require a valid CSRF Token for a particular view is to
include ``check_csrf=True`` as a view predicate.
See :meth:`pyramid.config.Configurator.add_route`.
See :meth:`pyramid.config.Configurator.add_view`.

.. code-block:: python
@view_config(request_method='POST', check_csrf=True, ...)
def myview(request):
...
.. note::
A mismatch of CSRF token is treated like any other predicate miss, and the
predicate system, when it doesn't find a view, raises ``HTTPNotFound``
instead of ``HTTPBadRequest``, so ``check_csrf=True`` behavior is different
from calling :func:`pyramid.session.check_csrf_token`.


Using the ``session.new_csrf_token`` Method
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
15 changes: 15 additions & 0 deletions docs/narr/viewconfig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,21 @@ Non-Predicate Arguments
def myview(request):
...

All view callables in the decorator chain must return a response object
implementing :class:`pyramid.interfaces.IResponse` or raise an exception:

.. code-block:: python
def log_timer(wrapped):
def wrapper(context, request):
start = time.time()
response = wrapped(context, request)
duration = time.time() - start
response.headers['X-View-Time'] = '%.3f' % (duration,)
log.info('view took %.3f seconds', duration)
return response
return wrapper
``mapper``
A Python object or :term:`dotted Python name` which refers to a :term:`view
mapper`, or ``None``. By default it is ``None``, which indicates that the
Expand Down
Loading

0 comments on commit f3c67a4

Please sign in to comment.