summaryrefslogtreecommitdiff
path: root/docs/narr
diff options
context:
space:
mode:
authorCasey Duncan <casey.duncan@gmail.com>2010-12-31 13:48:13 -0700
committerCasey Duncan <casey.duncan@gmail.com>2010-12-31 13:48:13 -0700
commit22642d73056f06a1834dce8970922951fa18c5a1 (patch)
treee56037a9d48e7900b5ec3396b1ae28a2723ca623 /docs/narr
parentf4c5f1a60612749ef36aae01d9a3a559b6acdfff (diff)
parentadfcf6d579496495fb71f8c1af293a953b3a13cb (diff)
downloadpyramid-22642d73056f06a1834dce8970922951fa18c5a1.tar.gz
pyramid-22642d73056f06a1834dce8970922951fa18c5a1.tar.bz2
pyramid-22642d73056f06a1834dce8970922951fa18c5a1.zip
Merge https://github.com/Pylons/pyramid
Diffstat (limited to 'docs/narr')
-rw-r--r--docs/narr/assets.rst4
-rw-r--r--docs/narr/csrf.rst2
-rw-r--r--docs/narr/flash.rst14
-rw-r--r--docs/narr/introduction.rst2
-rw-r--r--docs/narr/project.rst2
-rw-r--r--docs/narr/renderers.rst1
-rw-r--r--docs/narr/resources.rst6
-rw-r--r--docs/narr/urldispatch.rst44
8 files changed, 60 insertions, 15 deletions
diff --git a/docs/narr/assets.rst b/docs/narr/assets.rst
index f147426ce..f73ff231a 100644
--- a/docs/narr/assets.rst
+++ b/docs/narr/assets.rst
@@ -98,7 +98,7 @@ directory on a filesystem to an application user's browser. Use the
mechanism makes a directory of static files available at a name relative to
the application root URL, e.g. ``/static`` or as an external URL.
-.. note:: `~pyramid.config.Configurator.add_static_view` cannot serve a
+.. note:: :meth:`~pyramid.config.Configurator.add_static_view` cannot serve a
single file, nor can it serve a directory of static files directly
relative to the root URL of a :app:`Pyramid` application. For these
features, see :ref:`advanced_static`.
@@ -282,7 +282,7 @@ create such a circumstance, we suggest using the
in the application ``.ini`` file named ``media_location``. Then set the
value of ``media_location`` to either a prefix or a URL depending on whether
the application is being run in development or in production (use a different
-`.ini`` file for production than you do for development). This is just a
+``.ini`` file for production than you do for development). This is just a
suggestion for a pattern; any setting name other than ``media_location``
could be used.
diff --git a/docs/narr/csrf.rst b/docs/narr/csrf.rst
index 7586b0ed7..2f545fb4f 100644
--- a/docs/narr/csrf.rst
+++ b/docs/narr/csrf.rst
@@ -9,7 +9,7 @@ phenomenon whereby a user with an identity on your website might click on a
URL or button on another website which unwittingly redirects the user to your
application to perform some command that requires elevated privileges.
-You can avoid most of these attacks by making sure that a the correct *CSRF
+You can avoid most of these attacks by making sure that the correct *CSRF
token* has been set in an :app:`Pyramid` session object before performing any
actions in code which requires elevated privileges and is invoked via a form
post. To use CSRF token support, you must enable a :term:`session factory`
diff --git a/docs/narr/flash.rst b/docs/narr/flash.rst
index d41c2cdaf..037bfc416 100644
--- a/docs/narr/flash.rst
+++ b/docs/narr/flash.rst
@@ -38,7 +38,7 @@ provide is not modified in any way.
The ``queue`` argument allows you to choose a queue to which to append the
message you provide. This can be used to push different kinds of messages
-into flash storage for later display in different places on a page. You cam
+into flash storage for later display in different places on a page. You can
pass any name for your queue, but it must be a string. The default value is
the empty string, which chooses the default queue. Each queue is independent,
and can be popped by ``pop_flash`` or examined via ``peek_flash`` separately.
@@ -49,20 +49,22 @@ default flash message queue.
request.session.flash(msg, 'myappsqueue')
-The ``allow_duplicate`` argument, which defaults to ``True``. If this is
+The ``allow_duplicate`` argument defaults to ``True``. If this is
``False``, if you attempt to add a message to a queue which is already
present in the queue, it will not be added.
Using the ``session.pop_flash`` Method
--------------------------------------
-Once one or more messages has been added to a flash queue by the
+Once one or more messages have been added to a flash queue by the
``session.flash`` API, the ``session.pop_flash`` API can be used to pop that
queue and return it for use.
To pop a particular queue of messages from the flash object, use the session
object's ``pop_flash`` method.
+.. method:: pop_flash(queue='')
+
.. code-block:: python
:linenos:
@@ -85,14 +87,16 @@ been popped.
The object returned from ``pop_flash`` is a list.
-Using the ``session.pop_flash`` Method
---------------------------------------
+Using the ``session.peek_flash`` Method
+---------------------------------------
Once one or more messages has been added to a flash queue by the
``session.flash`` API, the ``session.peek_flash`` API can be used to "peek"
at that queue. Unlike ``session.pop_flash``, the queue is not popped from
flash storage.
+.. method:: peek_flash(queue='')
+
.. code-block:: python
:linenos:
diff --git a/docs/narr/introduction.rst b/docs/narr/introduction.rst
index 3ade3726c..c61ef21d4 100644
--- a/docs/narr/introduction.rst
+++ b/docs/narr/introduction.rst
@@ -63,7 +63,7 @@ A Sense of Fun
Minimalism
:app:`Pyramid` provides only the very basics: *URL to code
- mapping*, *templating*, *security*, and *resources*. There is not
+ mapping*, *templating*, *security*, and *assets*. There is not
much more to the framework than these pieces: you are expected to
provide the rest.
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 36f2d6975..55a2711f3 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -256,6 +256,8 @@ create`` -generated project. Within a project generated by the
single: IPython
single: paster pshell
+.. _interactive_shell:
+
The Interactive Shell
---------------------
diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst
index 3804fcf42..76e9562fa 100644
--- a/docs/narr/renderers.rst
+++ b/docs/narr/renderers.rst
@@ -22,6 +22,7 @@ response. For example:
from pyramid.response import Response
from pyramid.view import view_config
+ @view_config(renderer='json')
def hello_world(request):
return {'content':'Hello!'}
diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst
index 3b9efe108..b892cf3cd 100644
--- a/docs/narr/resources.rst
+++ b/docs/narr/resources.rst
@@ -533,7 +533,7 @@ declares that the blog entry implements an :term:`interface`.
implements(IBlogEntry)
def __init__(self, title, body, author):
self.title = title
- self.body = body
+ self.body = body
self.author = author
self.created = datetime.datetime.now()
@@ -568,7 +568,7 @@ To do so, use the :func:`zope.interface.directlyProvides` function:
class BlogEntry(object):
def __init__(self, title, body, author):
self.title = title
- self.body = body
+ self.body = body
self.author = author
self.created = datetime.datetime.now()
@@ -596,7 +596,7 @@ the :func:`zope.interface.alsoProvides` function:
class BlogEntry(object):
def __init__(self, title, body, author):
self.title = title
- self.body = body
+ self.body = body
self.author = author
self.created = datetime.datetime.now()
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst
index 76eca454d..0d28a0e96 100644
--- a/docs/narr/urldispatch.rst
+++ b/docs/narr/urldispatch.rst
@@ -533,12 +533,12 @@ neither predicates nor view configuration information.
callables. Use custom predicates when no set of predefined predicates does
what you need. Custom predicates can be combined with predefined
predicates as necessary. Each custom predicate callable should accept two
- arguments: ``context`` and ``request`` and should return either ``True`` or
+ arguments: ``info`` and ``request`` and should return either ``True`` or
``False`` after doing arbitrary evaluation of the context resource and/or
the request. If all callables return ``True``, the associated route will
be considered viable for a given request. If any custom predicate returns
- ``False``, route matching continues. Note that the value ``context`` will
- always be ``None`` when passed to a custom route predicate.
+ ``False``, route matching continues. See :ref:`custom_route_predicates`
+ for more information.
**View-Related Arguments**
@@ -1231,6 +1231,44 @@ which you started the application from. For example:
See :ref:`environment_chapter` for more information about how, and where to
set these values.
+.. index::
+ pair: routes; printing
+ single: paster proutes
+
+Displaying All Application Routes
+---------------------------------
+
+You can use the ``paster proutes`` command in a terminal window to print a
+summary of routes related to your application. Much like the ``paster
+pshell`` command (see :ref:`interactive shell`), the ``paster proutes``
+command accepts two arguments. The first argument to ``proutes`` is the path
+to your application's ``.ini`` file. The second is the ``app`` section name
+inside the ``.ini`` file which points to your application.
+
+For example:
+
+.. code-block:: text
+ :linenos:
+
+ [chrism@thinko MyProject]$ ../bin/paster proutes development.ini MyProject
+ Name Pattern View
+ ---- ------- ----
+ home / <function my_view>
+ home2 / <function my_view>
+ another /another None
+ static/ static/*subpath <static_view object>
+ catchall /*subpath <function static_view>
+
+``paster proutes`` generates a table. The table has three columns: a Name
+name column, a Pattern column, and a View column. The items listed in the
+Name column are route names, the items listen in the Pattern column are route
+patterns, and the items listed in the View column are representations of the
+view callable that will be invoked when a request matches the associated
+route pattern. The view column may show ``None`` if no associated view
+callable could be found. If no routes are configured within your
+application, nothing will be printed to the console when ``paster proutes``
+is executed.
+
References
----------