From 94c2dc0bae9cf14cc6a5548119933e4477d07042 Mon Sep 17 00:00:00 2001 From: cguardia Date: Mon, 18 Apr 2011 15:14:24 -0500 Subject: test adding theme as a submodule --- docs/.gitignore | 1 - docs/Makefile | 3 ++- docs/_themes | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 160000 docs/_themes (limited to 'docs') diff --git a/docs/.gitignore b/docs/.gitignore index 1e9e0413c..d4e11e5ea 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,3 +1,2 @@ _build -_themes diff --git a/docs/Makefile b/docs/Makefile index 1d032cf45..3fbf56d0a 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -85,4 +85,5 @@ epub: @echo "Build finished. The epub file is in _build/epub." _themes: - git clone git://github.com/Pylons/pylons_sphinx_theme.git _themes + git submodule init + git submodule update diff --git a/docs/_themes b/docs/_themes new file mode 160000 index 000000000..53898ec57 --- /dev/null +++ b/docs/_themes @@ -0,0 +1 @@ +Subproject commit 53898ec579a1c31e8780824c0a255eca004e0e56 -- cgit v1.2.3 From f2d5cb59deba682d7c1d461ab5e90ba1802d42ac Mon Sep 17 00:00:00 2001 From: cguardia Date: Mon, 18 Apr 2011 21:41:37 -0500 Subject: fixed makefile to update theme submodule correctly --- docs/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/Makefile b/docs/Makefile index 3fbf56d0a..21e91d114 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -25,7 +25,7 @@ help: clean: -rm -rf _build/* -html: _themes +html: theme mkdir -p _build/html _build/doctrees $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html @echo @@ -47,7 +47,7 @@ pickle: web: pickle -htmlhelp: _themes +htmlhelp: theme mkdir -p _build/htmlhelp _build/doctrees $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp @echo @@ -84,6 +84,5 @@ epub: @echo @echo "Build finished. The epub file is in _build/epub." -_themes: - git submodule init - git submodule update +theme: + cd ..;git submodule update --init;cd docs -- cgit v1.2.3 From 8abf0a3c996a22dbf9b3ed4602df026a87686a74 Mon Sep 17 00:00:00 2001 From: cguardia Date: Wed, 4 May 2011 15:11:59 -0500 Subject: code refactoring for showing route->view relationship more correctly; tests and docs for pull request --- docs/narr/urldispatch.rst | 4 ++ docs/narr/viewconfig.rst | 97 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) (limited to 'docs') diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index 1024dd188..a180003d0 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -1121,6 +1121,10 @@ a developer to understand either of them in detail. It also means that we can allow a developer to combine :term:`URL dispatch` and :term:`traversal` in various exceptional cases as documented in :ref:`hybrid_chapter`. +To gain a better understanding of how routes and views are associated in a +real application, you can use the ``paster pviews`` command, as documented +in :ref:`displaying_matching_views`. + References ---------- diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst index 743cc016e..d99e5bed5 100644 --- a/docs/narr/viewconfig.rst +++ b/docs/narr/viewconfig.rst @@ -732,3 +732,100 @@ found will be printed to ``stderr``, and the browser representation of the error will include the same information. See :ref:`environment_chapter` for more information about how, and where to set these values. +.. index:: + pair: matching views; printing + single: paster pviews + +.. _displaying_matching_views: + +Displaying Matching Views for a Given URL +----------------------------------------- + +For a big application with several views, it can be hard to keep the view +configuration details in your head, even if you defined all the views +yourself. You can use the ``paster pviews`` command in a terminal window to +print a summary of matching routes and views for a given URL in your +application. The ``paster pviews`` command accepts three arguments. The +first argument to ``pviews`` 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. The third is the URL to test for matching views. + +Here is an example for a simple view configuration using :term:`traversal`: + +.. code-block:: text + :linenos: + + $ ../bin/paster pviews development.ini tutorial /FrontPage + + URL = /FrontPage + + context: + view name: + + View: + ----- + tutorial.views.view_page + required permission = view + +The output always has the requested URL at the top and below that all the +views that matched with their view configuration details. In this example +only one view matches, so there is just a single *View* section. For each +matching view, the full code path to the associated view callable is shown, +along with any permissions and predicates that are part of that view +configuration. + +A more complex configuration might generate something like this: + +.. code-block:: text + :linenos: + + $ ../bin/paster pviews development.ini shootout /about + + URL = /about + + context: + view name: about + + Route: + ------ + route name: about + route pattern: /about + route path: /about + subpath: + route predicates (request method = GET) + + View: + ----- + shootout.views.about_view + required permission = view + view predicates (request_param testing, header X/header) + + Route: + ------ + route name: about_post + route pattern: /about + route path: /about + subpath: + route predicates (request method = POST) + + View: + ----- + shootout.views.about_view_post + required permission = view + view predicates (request_param test) + + View: + ----- + shootout.views.about_view_post2 + required permission = view + view predicates (request_param test2) + +In this case, we are dealing with a :term:`URL dispatch` application. This +specific URL has two matching routes. The matching route information is +displayed first, followed by any views that are associated with that route. +As you can see from the second matching route output, a route can be +associated with more than one view. + +For a URL that doesn't match any views, ``paster pviews`` will simply print +out a *Not found* message. + -- cgit v1.2.3 From c570d82c02687ef6264b83cfd51c229acfeffb3b Mon Sep 17 00:00:00 2001 From: cguardia Date: Wed, 4 May 2011 15:24:02 -0500 Subject: Revert "fixed makefile to update theme submodule correctly" This reverts commit f2d5cb59deba682d7c1d461ab5e90ba1802d42ac. --- docs/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/Makefile b/docs/Makefile index 21e91d114..3fbf56d0a 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -25,7 +25,7 @@ help: clean: -rm -rf _build/* -html: theme +html: _themes mkdir -p _build/html _build/doctrees $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html @echo @@ -47,7 +47,7 @@ pickle: web: pickle -htmlhelp: theme +htmlhelp: _themes mkdir -p _build/htmlhelp _build/doctrees $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp @echo @@ -84,5 +84,6 @@ epub: @echo @echo "Build finished. The epub file is in _build/epub." -theme: - cd ..;git submodule update --init;cd docs +_themes: + git submodule init + git submodule update -- cgit v1.2.3 From e87f1885d78df1c4f832912a2031291093517fa0 Mon Sep 17 00:00:00 2001 From: cguardia Date: Wed, 4 May 2011 15:25:05 -0500 Subject: Revert "test adding theme as a submodule" This reverts commit 94c2dc0bae9cf14cc6a5548119933e4477d07042. --- docs/.gitignore | 1 + docs/Makefile | 3 +-- docs/_themes | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) delete mode 160000 docs/_themes (limited to 'docs') diff --git a/docs/.gitignore b/docs/.gitignore index d4e11e5ea..1e9e0413c 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,2 +1,3 @@ _build +_themes diff --git a/docs/Makefile b/docs/Makefile index 3fbf56d0a..1d032cf45 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -85,5 +85,4 @@ epub: @echo "Build finished. The epub file is in _build/epub." _themes: - git submodule init - git submodule update + git clone git://github.com/Pylons/pylons_sphinx_theme.git _themes diff --git a/docs/_themes b/docs/_themes deleted file mode 160000 index 53898ec57..000000000 --- a/docs/_themes +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 53898ec579a1c31e8780824c0a255eca004e0e56 -- cgit v1.2.3