summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/Makefile69
-rw-r--r--docs/_static/directory_structure_generic.pngbin11845 -> 0 bytes
-rw-r--r--docs/_static/directory_structure_initial.pngbin7752 -> 0 bytes
-rw-r--r--docs/_static/directory_structure_pyramid.pngbin16746 -> 0 bytes
-rw-r--r--docs/_static/pyramid_request_processing.graffle9748
-rw-r--r--docs/_static/pyramid_request_processing.pngbin0 -> 122854 bytes
-rw-r--r--docs/_static/pyramid_request_processing.svg3
-rw-r--r--docs/_static/pyramid_router.graffle1621
-rw-r--r--docs/_static/pyramid_router.pngbin0 -> 120643 bytes
-rw-r--r--docs/_static/pyramid_router.svg3
m---------docs/_themes0
-rw-r--r--docs/api/config.rst5
-rw-r--r--docs/api/exceptions.rst12
-rw-r--r--docs/api/httpexceptions.rst94
-rw-r--r--docs/api/index.rst12
-rw-r--r--docs/api/interfaces.rst5
-rw-r--r--docs/api/registry.rst12
-rw-r--r--docs/api/request.rst44
-rw-r--r--docs/api/security.rst2
-rw-r--r--docs/api/session.rst1
-rw-r--r--docs/api/static.rst8
-rw-r--r--docs/conf.py86
-rw-r--r--docs/conventions.rst12
-rw-r--r--docs/copyright.rst6
-rw-r--r--docs/designdefense.rst1155
-rw-r--r--docs/glossary.rst76
-rw-r--r--docs/index.rst164
-rw-r--r--docs/narr/MyProject/development.ini6
-rw-r--r--docs/narr/MyProject/myproject/templates/mytemplate.pt13
-rw-r--r--docs/narr/MyProject/myproject/tests.py12
-rw-r--r--docs/narr/MyProject/production.ini2
-rw-r--r--docs/narr/advconfig.rst136
-rw-r--r--docs/narr/assets.rst654
-rw-r--r--docs/narr/commandline.rst594
-rw-r--r--docs/narr/configuration.rst96
-rw-r--r--docs/narr/environment.rst504
-rw-r--r--docs/narr/events.rst156
-rw-r--r--docs/narr/extconfig.rst313
-rw-r--r--docs/narr/extending.rst194
-rw-r--r--docs/narr/firstapp.rst191
-rw-r--r--docs/narr/hellotraversal.rst67
-rw-r--r--docs/narr/hooks.rst683
-rw-r--r--docs/narr/hybrid.rst541
-rw-r--r--docs/narr/i18n.rst656
-rw-r--r--docs/narr/install.rst45
-rw-r--r--docs/narr/introduction.rst715
-rw-r--r--docs/narr/introspector.rst131
-rw-r--r--docs/narr/logging.rst350
-rw-r--r--docs/narr/muchadoabouttraversal.rst341
-rw-r--r--docs/narr/paste.rst96
-rw-r--r--docs/narr/project-debug.pngbin106878 -> 202464 bytes
-rw-r--r--docs/narr/project-show-toolbar.pngbin0 -> 11050 bytes
-rw-r--r--docs/narr/project.pngbin91662 -> 133242 bytes
-rw-r--r--docs/narr/project.rst773
-rw-r--r--docs/narr/renderers.rst323
-rw-r--r--docs/narr/resources.rst390
-rw-r--r--docs/narr/router.rst87
-rw-r--r--docs/narr/scaffolding.rst105
-rw-r--r--docs/narr/security.rst526
-rw-r--r--docs/narr/sessions.rst245
-rw-r--r--docs/narr/startup.rst129
-rw-r--r--docs/narr/subrequest.rst156
-rw-r--r--docs/narr/tb_introspector.pngbin95962 -> 181225 bytes
-rw-r--r--docs/narr/templates.rst312
-rw-r--r--docs/narr/testing.rst346
-rw-r--r--docs/narr/threadlocals.rst226
-rw-r--r--docs/narr/traversal.rst425
-rw-r--r--docs/narr/upgrading.rst184
-rw-r--r--docs/narr/urldispatch.rst570
-rw-r--r--docs/narr/vhosting.rst117
-rw-r--r--docs/narr/viewconfig.rst572
-rw-r--r--docs/narr/views.rst296
-rw-r--r--docs/narr/webob.rst451
-rw-r--r--docs/narr/zca.rst257
-rw-r--r--docs/pscripts/index.rst12
-rw-r--r--docs/pscripts/pcreate.rst13
-rw-r--r--docs/pscripts/pdistreport.rst13
-rw-r--r--docs/pscripts/prequest.rst13
-rw-r--r--docs/pscripts/proutes.rst13
-rw-r--r--docs/pscripts/pserve.rst13
-rw-r--r--docs/pscripts/pshell.rst13
-rw-r--r--docs/pscripts/ptweens.rst13
-rw-r--r--docs/pscripts/pviews.rst13
-rw-r--r--docs/quick_tour.rst903
-rw-r--r--docs/quick_tour/awesome/CHANGES.txt4
-rw-r--r--docs/quick_tour/awesome/MANIFEST.in2
-rw-r--r--docs/quick_tour/awesome/README.txt4
-rw-r--r--docs/quick_tour/awesome/awesome/__init__.py23
-rw-r--r--docs/quick_tour/awesome/awesome/locale/awesome.pot21
-rw-r--r--docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.mobin460 -> 0 bytes
-rw-r--r--docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.po21
-rw-r--r--docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.mobin461 -> 0 bytes
-rw-r--r--docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.po21
-rw-r--r--docs/quick_tour/awesome/awesome/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/quick_tour/awesome/awesome/static/logo.pngbin6641 -> 0 bytes
-rw-r--r--docs/quick_tour/awesome/awesome/static/pylons.css73
-rw-r--r--docs/quick_tour/awesome/awesome/templates/mytemplate.jinja287
-rw-r--r--docs/quick_tour/awesome/awesome/tests.py21
-rw-r--r--docs/quick_tour/awesome/awesome/views.py6
-rw-r--r--docs/quick_tour/awesome/development.ini49
-rw-r--r--docs/quick_tour/awesome/message-extraction.ini3
-rw-r--r--docs/quick_tour/awesome/setup.py36
-rw-r--r--docs/quick_tour/hello_world/app.py2
-rw-r--r--docs/quick_tour/jinja2/app.py2
-rw-r--r--docs/quick_tour/jinja2/views.py2
-rw-r--r--docs/quick_tour/json/app.py4
-rw-r--r--docs/quick_tour/json/hello_world.jinja24
-rw-r--r--docs/quick_tour/json/hello_world.pt17
-rw-r--r--docs/quick_tour/json/views.py4
-rw-r--r--docs/quick_tour/package/MANIFEST.in2
-rw-r--r--docs/quick_tour/package/development.ini63
-rw-r--r--docs/quick_tour/package/hello_world/__init__.py14
-rw-r--r--docs/quick_tour/package/hello_world/init.py34
-rw-r--r--docs/quick_tour/package/hello_world/models.py8
-rw-r--r--docs/quick_tour/package/hello_world/resources.py (renamed from docs/quick_tour/awesome/awesome/models.py)4
-rw-r--r--docs/quick_tour/package/hello_world/static/logo.pngbin6641 -> 0 bytes
-rw-r--r--docs/quick_tour/package/hello_world/static/pylons.css73
-rw-r--r--docs/quick_tour/package/hello_world/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/quick_tour/package/hello_world/static/pyramid.pngbin0 -> 12901 bytes
-rw-r--r--docs/quick_tour/package/hello_world/static/theme.css153
-rw-r--r--docs/quick_tour/package/hello_world/templates/mytemplate.jinja2158
-rw-r--r--docs/quick_tour/package/hello_world/views.py10
-rw-r--r--docs/quick_tour/package/setup.cfg28
-rw-r--r--docs/quick_tour/package/setup.py27
-rw-r--r--docs/quick_tour/requests/app.py2
-rw-r--r--docs/quick_tour/routing/app.py2
-rw-r--r--docs/quick_tour/routing/views.py2
-rw-r--r--docs/quick_tour/sqla_demo/README.txt6
-rw-r--r--docs/quick_tour/sqla_demo/development.ini2
-rw-r--r--docs/quick_tour/sqla_demo/production.ini2
-rw-r--r--docs/quick_tour/sqla_demo/setup.cfg27
-rw-r--r--docs/quick_tour/sqla_demo/setup.py11
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo.sqlitebin3072 -> 0 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/__init__.py1
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/models.py10
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/scripts/initializedb.py9
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/theme.css154
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/theme.min.css1
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/templates/mytemplate.pt131
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/tests.py26
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/views.py5
-rw-r--r--docs/quick_tour/static_assets/app.py4
-rw-r--r--docs/quick_tour/static_assets/hello_world.jinja22
-rw-r--r--docs/quick_tour/static_assets/hello_world.pt16
-rw-r--r--docs/quick_tour/static_assets/hello_world_static.jinja210
-rw-r--r--docs/quick_tour/static_assets/views.py2
-rw-r--r--docs/quick_tour/templating/app.py3
-rw-r--r--docs/quick_tour/templating/views.py2
-rw-r--r--docs/quick_tour/view_classes/app.py6
-rw-r--r--docs/quick_tour/view_classes/hello.jinja28
-rw-r--r--docs/quick_tour/view_classes/views.py2
-rw-r--r--docs/quick_tour/views/app.py2
-rw-r--r--docs/quick_tutorial/authentication.rst5
-rw-r--r--docs/quick_tutorial/authentication/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/authentication/tutorial/login.pt4
-rw-r--r--docs/quick_tutorial/authorization.rst9
-rw-r--r--docs/quick_tutorial/authorization/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/authorization/tutorial/login.pt4
-rw-r--r--docs/quick_tutorial/databases.rst44
-rw-r--r--docs/quick_tutorial/databases/development.ini36
-rw-r--r--docs/quick_tutorial/databases/tutorial/tests.py6
-rw-r--r--docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt6
-rw-r--r--docs/quick_tutorial/debugtoolbar.rst76
-rw-r--r--docs/quick_tutorial/forms.rst8
-rw-r--r--docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt2
-rw-r--r--docs/quick_tutorial/functional_testing.rst9
-rw-r--r--docs/quick_tutorial/hello_world.rst2
-rw-r--r--docs/quick_tutorial/ini.rst14
-rw-r--r--docs/quick_tutorial/jinja2.rst15
-rw-r--r--docs/quick_tutorial/jinja2/tutorial/home.jinja24
-rw-r--r--docs/quick_tutorial/jinja2/tutorial/tests.py8
-rw-r--r--docs/quick_tutorial/json/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/logging.rst23
-rw-r--r--docs/quick_tutorial/logging/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/more_view_classes.rst21
-rw-r--r--docs/quick_tutorial/more_view_classes/tutorial/delete.pt4
-rw-r--r--docs/quick_tutorial/more_view_classes/tutorial/edit.pt4
-rw-r--r--docs/quick_tutorial/more_view_classes/tutorial/hello.pt4
-rw-r--r--docs/quick_tutorial/more_view_classes/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/more_view_classes/tutorial/views.py6
-rw-r--r--docs/quick_tutorial/package.rst4
-rw-r--r--docs/quick_tutorial/request_response.rst3
-rw-r--r--docs/quick_tutorial/requirements.rst40
-rw-r--r--docs/quick_tutorial/routing.rst2
-rw-r--r--docs/quick_tutorial/routing/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/sessions.rst2
-rw-r--r--docs/quick_tutorial/sessions/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/static_assets.rst2
-rw-r--r--docs/quick_tutorial/static_assets/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/templating.rst2
-rw-r--r--docs/quick_tutorial/templating/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/unit_testing.rst2
-rw-r--r--docs/quick_tutorial/view_classes.rst4
-rw-r--r--docs/quick_tutorial/views.rst2
-rw-r--r--docs/tutorials/wiki/authorization.rst374
-rw-r--r--docs/tutorials/wiki/basiclayout.rst49
-rw-r--r--docs/tutorials/wiki/definingmodels.rst25
-rw-r--r--docs/tutorials/wiki/definingviews.rst298
-rw-r--r--docs/tutorials/wiki/design.rst45
-rw-r--r--docs/tutorials/wiki/distributing.rst34
-rw-r--r--docs/tutorials/wiki/index.rst8
-rw-r--r--docs/tutorials/wiki/installation.rst266
-rw-r--r--docs/tutorials/wiki/src/authorization/setup.py4
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/templates/edit.pt120
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/templates/login.pt118
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt127
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/templates/view.pt121
-rw-r--r--docs/tutorials/wiki/src/basiclayout/setup.py4
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt127
-rw-r--r--docs/tutorials/wiki/src/models/setup.py4
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt127
-rw-r--r--docs/tutorials/wiki/src/tests/setup.py4
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/templates/edit.pt120
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/templates/login.pt118
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt127
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/templates/view.pt121
-rw-r--r--docs/tutorials/wiki/src/views/setup.py4
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/templates/edit.pt115
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt130
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/templates/view.pt120
-rw-r--r--docs/tutorials/wiki/tests.rst44
-rw-r--r--docs/tutorials/wiki2/authorization.rst411
-rw-r--r--docs/tutorials/wiki2/background.rst8
-rw-r--r--docs/tutorials/wiki2/basiclayout.rst24
-rw-r--r--docs/tutorials/wiki2/definingmodels.rst115
-rw-r--r--docs/tutorials/wiki2/definingviews.rst227
-rw-r--r--docs/tutorials/wiki2/design.rst28
-rw-r--r--docs/tutorials/wiki2/distributing.rst28
-rw-r--r--docs/tutorials/wiki2/index.rst3
-rw-r--r--docs/tutorials/wiki2/installation.rst172
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/templates/edit.pt122
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/templates/login.pt122
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt130
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/templates/view.pt125
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/models.py3
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt127
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt127
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/templates/edit.pt120
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt127
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/templates/view.pt123
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/favicon.icobin1406 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/footerbg.pngbin333 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/headerbg.pngbin203 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/ie6.css8
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/middlebg.pngbin2797 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/pylons.css372
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/pyramid-16x16.pngbin0 -> 1319 bytes
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/pyramid-small.pngbin7044 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/pyramid.pngbin33055 -> 12901 bytes
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/theme.css154
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/theme.min.css1
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/static/transparent.gifbin49 -> 0 bytes
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/templates/edit.pt111
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt127
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/templates/view.pt114
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/views.py1
-rw-r--r--docs/tutorials/wiki2/tests.rst47
-rw-r--r--docs/whatsnew-1.0.rst2
-rw-r--r--docs/whatsnew-1.1.rst2
-rw-r--r--docs/whatsnew-1.2.rst2
-rw-r--r--docs/whatsnew-1.3.rst13
-rw-r--r--docs/whatsnew-1.4.rst2
-rw-r--r--docs/whatsnew-1.5.rst4
-rw-r--r--docs/whatsnew-1.6.rst248
374 files changed, 24976 insertions, 14927 deletions
diff --git a/docs/Makefile b/docs/Makefile
index 12dc88bf8..546deb30a 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -5,11 +5,12 @@
SPHINXOPTS = -W
SPHINXBUILD = sphinx-build
PAPER =
+BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html web pickle htmlhelp latex changes linkcheck
@@ -23,71 +24,69 @@ help:
@echo " linkcheck to check all external links for integrity"
clean:
- -rm -rf _build/*
+ -rm -rf $(BUILDDIR)/*
-html: themes
- mkdir -p _build/html _build/doctrees
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
+html:
+ mkdir -p $(BUILDDIR)/html $(BUILDDIR)/doctrees
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
- @echo "Build finished. The HTML pages are in _build/html."
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
text:
- mkdir -p _build/text _build/doctrees
- $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) _build/text
+ mkdir -p $(BUILDDIR)/text $(BUILDDIR)/doctrees
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
- @echo "Build finished. The HTML pages are in _build/text."
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/text."
pickle:
- mkdir -p _build/pickle _build/doctrees
- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
+ mkdir -p $(BUILDDIR)/pickle $(BUILDDIR)/doctrees
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files or run"
- @echo " sphinx-web _build/pickle"
+ @echo " sphinx-web $(BUILDDIR)/pickle"
@echo "to start the sphinx-web server."
web: pickle
-htmlhelp: themes
- mkdir -p _build/htmlhelp _build/doctrees
- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
+htmlhelp:
+ mkdir -p $(BUILDDIR)/htmlhelp $(BUILDDIR)/doctrees
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
- ".hhp project file in _build/htmlhelp."
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
latex:
- mkdir -p _build/latex _build/doctrees
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
- cp _static/*.png _build/latex
+ mkdir -p $(BUILDDIR)/latex $(BUILDDIR)/doctrees
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ cp _static/*.png $(BUILDDIR)/latex
./convert_images.sh
- cp _static/latex-warning.png _build/latex
- cp _static/latex-note.png _build/latex
+ cp _static/latex-warning.png $(BUILDDIR)/latex
+ cp _static/latex-note.png $(BUILDDIR)/latex
@echo
- @echo "Build finished; the LaTeX files are in _build/latex."
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make latexpdf' to build a PDF file from them."
latexpdf:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
- $(MAKE) -C _build/latex all-pdf
- @echo "pdflatex finished; the PDF file is in _build/latex."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF file is in $(BUILDDIR)/latex."
changes:
- mkdir -p _build/changes _build/doctrees
- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
+ mkdir -p $(BUILDDIR)/changes $(BUILDDIR)/doctrees
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
- @echo "The overview file is in _build/changes."
+ @echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
- mkdir -p _build/linkcheck _build/doctrees
- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
+ mkdir -p $(BUILDDIR)/linkcheck $(BUILDDIR)/doctrees
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
- "or in _build/linkcheck/output.txt."
+ "or in $(BUILDDIR)/linkcheck/output.txt."
epub:
- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) _build/epub
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
- @echo "Build finished. The epub file is in _build/epub."
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
-themes:
- cd ..; git submodule update --init --recursive; cd docs;
diff --git a/docs/_static/directory_structure_generic.png b/docs/_static/directory_structure_generic.png
deleted file mode 100644
index c6d1a5b03..000000000
--- a/docs/_static/directory_structure_generic.png
+++ /dev/null
Binary files differ
diff --git a/docs/_static/directory_structure_initial.png b/docs/_static/directory_structure_initial.png
deleted file mode 100644
index 000f1bb27..000000000
--- a/docs/_static/directory_structure_initial.png
+++ /dev/null
Binary files differ
diff --git a/docs/_static/directory_structure_pyramid.png b/docs/_static/directory_structure_pyramid.png
deleted file mode 100644
index 74edd6533..000000000
--- a/docs/_static/directory_structure_pyramid.png
+++ /dev/null
Binary files differ
diff --git a/docs/_static/pyramid_request_processing.graffle b/docs/_static/pyramid_request_processing.graffle
new file mode 100644
index 000000000..71319610b
--- /dev/null
+++ b/docs/_static/pyramid_request_processing.graffle
@@ -0,0 +1,9748 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>ActiveLayerIndex</key>
+ <integer>0</integer>
+ <key>ApplicationVersion</key>
+ <array>
+ <string>com.omnigroup.OmniGrafflePro</string>
+ <string>139.18.0.187838</string>
+ </array>
+ <key>AutoAdjust</key>
+ <true/>
+ <key>BackgroundGraphic</key>
+ <dict>
+ <key>Bounds</key>
+ <string>{{0, 0}, {576, 733}}</string>
+ <key>Class</key>
+ <string>SolidGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>2</integer>
+ <key>Style</key>
+ <dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ </dict>
+ <key>BaseZoom</key>
+ <integer>0</integer>
+ <key>CanvasOrigin</key>
+ <string>{0, 0}</string>
+ <key>ColumnAlign</key>
+ <integer>1</integer>
+ <key>ColumnSpacing</key>
+ <real>36</real>
+ <key>CreationDate</key>
+ <string>2014-11-18 08:33:33 +0000</string>
+ <key>Creator</key>
+ <string>Steve Piercy</string>
+ <key>DisplayScale</key>
+ <string>1 0/72 in = 1 0/72 in</string>
+ <key>GraphDocumentVersion</key>
+ <integer>8</integer>
+ <key>GraphicsList</key>
+ <array>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169389</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169504</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{344.41667175292969, 402.88506673894034}</string>
+ <string>{375.5, 402.27232108797347}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169428</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169382</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169433</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{155.00000254313238, 459.27667544230695}</string>
+ <string>{238.5002713470962, 456.52468399152298}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169370</integer>
+ <key>Position</key>
+ <real>0.28820157051086426</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169383</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169432</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{155.00000254313238, 482.12574895537085}</string>
+ <string>{238.52297468463752, 508.35839132916635}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169370</integer>
+ <key>Position</key>
+ <real>0.5668826699256897</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>Group</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.8333613077798, 284.99999999999994}, {105.66668701171875, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169425</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{0.50000000000000089, -0.49999999999999645}</string>
+ <string>{-0.49526813868737474, -0.4689979626999552}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 authorization}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.75000762939453, 412.15071036499205}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169426</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{0.50000000000000089, 0.5}</string>
+ <string>{-0.49999999999999911, 0.49999999999999289}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 decorators egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.75000762939453, 303.65604172230951}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169427</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{0.50000000000000089, -0.49999999999999645}</string>
+ <string>{-0.49526813868737474, -0.4689979626999552}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 decorators ingress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.75000762939453, 393.55704269887212}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169428</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 response adapter}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.75000762939453, 374.90099016834085}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169429</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view mapper egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.75000762939453, 341.36561209044055}, {105.66666412353516, 33.089282989501953}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169430</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.75000762939453, 322.26348241170439}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169431</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view mapper ingress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>ID</key>
+ <integer>169424</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169422</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169423</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{155.00000254313238, 470.25295298442387}</string>
+ <string>{238.33861159880226, 482.4262543949045}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169370</integer>
+ <key>Position</key>
+ <real>0.42701038718223572</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83336130777977, 471.22620192028251}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169422</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 NewResponse}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169420</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169421</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{154.99998733539806, 128.68025330008533}</string>
+ <string>{239.83340199788393, 128.59152244387357}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169386</integer>
+ <key>Position</key>
+ <real>0.35945424437522888</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{239.83340199788395, 117.31920169649808}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169420</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 NewRequest}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>TableGroup</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.1666056315114, 148.28868579864499}, {105.66669464111328, 33.08929443359375}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169418</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 URL dispatch}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.1666056315114, 181.37798023223874}, {105.66669464111328, 17.244049072265625}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169419</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 route predicates}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>GridH</key>
+ <array>
+ <integer>169418</integer>
+ <integer>169419</integer>
+ <array/>
+ </array>
+ <key>ID</key>
+ <integer>169417</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>TableGroup</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.16666158040482, 272}, {105.66666412353516, 33.08929443359375}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169412</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view lookup}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.16666158040482, 305.08929443359375}, {105.66666412353516, 17.244049072265625}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169413</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 predicates}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>GridH</key>
+ <array>
+ <integer>169412</integer>
+ <integer>169413</integer>
+ <array/>
+ </array>
+ <key>ID</key>
+ <integer>169411</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169407</integer>
+ <key>Info</key>
+ <integer>7</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169410</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{238.75000762939462, 430.80675844512831}</string>
+ <string>{207.66666666666765, 385.656005859375}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169426</integer>
+ <key>Info</key>
+ <integer>6</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169407</integer>
+ <key>Info</key>
+ <integer>8</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169409</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{239.33336141608385, 285.57837549845181}</string>
+ <string>{207.66666666666777, 353.07514659563753}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169425</integer>
+ <key>Info</key>
+ <integer>6</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -8.9999999999999432}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169381</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169408</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{155.00000254313238, 386.66442959065108}</string>
+ <string>{155.00000254313238, 422.21209462483216}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169407</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.16667048136482, 353.07514659563753}, {105.66666412353516, 33.089282989501953}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169407</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{-0.49211360058019871, -0.49251945318722434}</string>
+ <string>{-0.49211360058019871, 0.49470854679786669}</string>
+ <string>{0.4984227008620481, 0.48463479169597612}</string>
+ <string>{0.49842270086204898, -0.5}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view pipeline}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169380</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169399</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{154.9999936421724, 258.44082431579938}</string>
+ <string>{238.8333613077798, 258.45536063967575}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169372</integer>
+ <key>Position</key>
+ <real>0.51973581314086914</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>Group</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{383.66662216186666, 130.51770718892479}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169393</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 internal process}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{383.66662216186666, 91.940789540609359}, {105.66666412353516, 33.089282989501953}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169394</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 external process (middleware, tween)}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{383.66662216186666, 158.54998334248924}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169395</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{383.66662216186666, 186.58225949605369}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169396</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.327428</string>
+ <key>g</key>
+ <string>0.81823</string>
+ <key>r</key>
+ <string>0.995566</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 callback}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{383.66662216186666, 63.908513387045019}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169397</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 event}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{370.9999504089372, 42.910746256511771}, {132.66667175292969, 184.08924865722656}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169398</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{1, 0.5}</string>
+ <string>{1, -0.5}</string>
+ <string>{-1, 0.5}</string>
+ <string>{-1, -0.5}</string>
+ <string>{0.5, 1}</string>
+ <string>{-0.5, 1}</string>
+ <string>{0.5, -1}</string>
+ <string>{-0.5, -1}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>CornerRadius</key>
+ <real>5</real>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Align</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
+
+\f0\b\fs20 \cf0 Legend}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ <key>TextPlacement</key>
+ <integer>0</integer>
+ </dict>
+ </array>
+ <key>ID</key>
+ <integer>169391</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{233.5000012715667, 20.000000000000934}, {116, 14}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>YES</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>169390</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Pad</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
+
+\f0\b\fs24 \cf0 &lt;%Canvas%&gt;}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ <key>Wrap</key>
+ <string>NO</string>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{375.5, 391}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169389</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 BeforeRender}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 7.05596923828125}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169418</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169386</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{155.00000170434049, 119.22767858295661}</string>
+ <string>{154.99995295206804, 148.28868579864499}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169378</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169378</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169385</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{155.00000254313238, 67.727678571434836}</string>
+ <string>{155.00000254313238, 96.18303707668386}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169377</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.16667048136482, 509.6179466247504}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169384</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 middleware egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{239, 497.23589324949899}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169383</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.327428</string>
+ <key>g</key>
+ <string>0.81823</string>
+ <key>r</key>
+ <string>0.995566</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 finished callbacks}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{239, 445.23589324949717}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169382</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.327428</string>
+ <key>g</key>
+ <string>0.81823</string>
+ <key>r</key>
+ <string>0.995566</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 response callbacks}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.16667048136482, 422.21209462483216}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169381</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 tween egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83336130777977, 247.18303989230026}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169380</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 ContextFound}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.16667048136482, 222.18303707668389}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169379</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 traversal}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.16667048136482, 96.18303707668386}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169378</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 tween ingress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{102.16667048136482, 45.18303707668386}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169377</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 middleware ingress }</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169379</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169373</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{154.99995295206804, 198.62202930450437}</string>
+ <string>{155.00000254313238, 222.18303707668389}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169419</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 7.05596923828125}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169412</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169372</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{154.9999936421724, 245.22767856643924}</string>
+ <string>{154.9999936421724, 272}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169379</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -8.9999999999999432}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169407</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169371</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{154.9999936421724, 322.33334350585938}</string>
+ <string>{155.00000254313238, 353.07514659563753}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169413</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9839935302734375}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169384</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169370</integer>
+ <key>Layer</key>
+ <integer>0</integer>
+ <key>Points</key>
+ <array>
+ <string>{155.00000254313238, 444.75673611958314}</string>
+ <string>{155.00000254313238, 509.6179466247504}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169381</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169444</integer>
+ <key>Info</key>
+ <integer>6</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169503</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{272.4166717529298, 537.32234122436705}</string>
+ <string>{420.4999504089364, 515.08928491955714}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169494</integer>
+ <key>Info</key>
+ <integer>5</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169444</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169502</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{272.50004831949906, 391.51558277923863}</string>
+ <string>{420.4999504089364, 472.78869058972316}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169493</integer>
+ <key>Info</key>
+ <integer>5</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169450</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169501</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 592.81693102013151}</string>
+ <string>{239, 583.78422005970799}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169438</integer>
+ <key>Position</key>
+ <real>0.28820157051086426</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169451</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169500</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 629.80996162681686}</string>
+ <string>{239, 640.78422005970981}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169438</integer>
+ <key>Position</key>
+ <real>0.5668826699256897</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>Group</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.8333613077798, 391.51558277923863}, {105.66668701171875, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169493</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{0.50000000000000089, -0.49999999999999645}</string>
+ <string>{-0.49526813868737474, -0.4689979626999552}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 authorization}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 518.66629314423074}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169494</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{0.50000000000000089, 0.5}</string>
+ <string>{-0.49999999999999911, 0.49999999999999289}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 decorators egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 410.17162450154819}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169495</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{0.50000000000000089, -0.49999999999999645}</string>
+ <string>{-0.49526813868737474, -0.4689979626999552}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 decorators ingress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 500.07262547811081}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169496</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 response adapter}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 481.41657294757954}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169497</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view mapper egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 447.88119486967923}, {105.66666412353516, 33.089282989501953}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169498</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 428.77906519094307}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169499</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view mapper ingress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>ID</key>
+ <integer>169492</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169490</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169491</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.166643778483959, 611.77452873049333}</string>
+ <string>{238.8333613077798, 611.77452873049333}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83336130777977, 600.50220798311784}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169490</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 NewResponse}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169488</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169489</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999986314263907, 140.3328574622312}</string>
+ <string>{239.83340199788393, 141.59152244387357}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169454</integer>
+ <key>Position</key>
+ <real>0.35945424437522888</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{239.83340199788395, 130.31920169649808}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169488</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 NewRequest}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>TableGroup</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166605631511416, 166.28868579864499}, {105.66668701171875, 33.08929443359375}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169486</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 URL dispatch}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166605631511416, 199.37798023223874}, {105.66668701171875, 17.244049072265625}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169487</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 route predicates}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>GridH</key>
+ <array>
+ <integer>169486</integer>
+ <integer>169487</integer>
+ <array/>
+ </array>
+ <key>ID</key>
+ <integer>169485</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>TableGroup</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{420.5000406901047, 338.15028762817326}, {105.66668701171875, 33.08929443359375}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169483</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view lookup}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{420.5000406901047, 371.23958206176701}, {105.66668701171875, 17.244049072265625}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169484</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 predicates}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>GridH</key>
+ <array>
+ <integer>169483</integer>
+ <integer>169484</integer>
+ <array/>
+ </array>
+ <key>ID</key>
+ <integer>169482</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>TableGroup</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166661580404835, 335}, {105.66667175292969, 33.08929443359375}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169480</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view lookup}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166661580404835, 368.08929443359375}, {105.66667175292969, 17.244049072265625}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169481</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 predicates}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>GridH</key>
+ <array>
+ <integer>169480</integer>
+ <integer>169481</integer>
+ <array/>
+ </array>
+ <key>ID</key>
+ <integer>169479</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169475</integer>
+ <key>Info</key>
+ <integer>7</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169478</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{166.75000762939462, 537.32234122436694}</string>
+ <string>{135.66666666666765, 485}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169494</integer>
+ <key>Info</key>
+ <integer>6</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169475</integer>
+ <key>Info</key>
+ <integer>8</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169477</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{167.33336141608385, 392.09395827769049}</string>
+ <string>{135.66666666666777, 452.41914073626253}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169493</integer>
+ <key>Info</key>
+ <integer>6</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -8.9999999999999432}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169449</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169476</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 485.50842372576449}</string>
+ <string>{83.000002543132396, 548.10604731241608}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169475</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 452.41914073626253}, {105.66666412353516, 33.089282989501953}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169475</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{-0.49211360058019871, -0.49251945318722434}</string>
+ <string>{-0.49211360058019871, 0.49470854679786669}</string>
+ <string>{0.4984227008620481, 0.48463479169597612}</string>
+ <string>{0.49842270086204898, -0.5}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view pipeline}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{51.333333333333314, 0}</string>
+ <string>{-0.66666666666662877, 58.666666666666686}</string>
+ <string>{0.66673293066804717, -58.666850540458825}</string>
+ <string>{-16.306719354194399, 0.26652623861849634}</string>
+ </array>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169443</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169474</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{369.66666666666669, 541}</string>
+ <string>{404.00000000000023, 362}</string>
+ <string>{420.36749776329049, 302.42112495959606}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.75663</string>
+ <key>g</key>
+ <string>0.756618</string>
+ <key>r</key>
+ <string>0.75664</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>Pattern</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{69.833333333332462, -0.72767857143483639}</string>
+ <string>{-0.66690523835279691, -51.044605218028948}</string>
+ <string>{0.66666666666674246, 51.044637362162291}</string>
+ <string>{-24.333271383961971, -0.13425428344572765}</string>
+ </array>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169443</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169473</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{310.66666666666754, 118.72767857143484}</string>
+ <string>{399.33333333333417, 216.62202930450439}</string>
+ <string>{420.37955338188368, 301.45369961823752}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.75663</string>
+ <key>g</key>
+ <string>0.756618</string>
+ <key>r</key>
+ <string>0.75664</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>Pattern</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{-3.9999491373696401, 78.910715080442856}</string>
+ <string>{92.666683130060392, 0.22547126950667007}</string>
+ </array>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169490</integer>
+ <key>Info</key>
+ <integer>3</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169472</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{473.33328247070392, 515.08928491955714}</string>
+ <string>{344.50002543131501, 611.77452873049333}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169444</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{31.999987284342428, -14.081351280212308}</string>
+ <string>{-32.166667938232536, 10.244050343831077}</string>
+ </array>
+ <key>ID</key>
+ <integer>169471</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{344.96346869509995, 346.26317428240412}</string>
+ <string>{389.8333346048999, 328.08928298950207}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169456</integer>
+ <key>Info</key>
+ <integer>3</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{31.999987284342428, -14.081351280212308}</string>
+ <string>{-28.500001271565793, 8.3333333333333144}</string>
+ </array>
+ <key>ID</key>
+ <integer>169470</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{344.98861594084059, 323.71068461220347}</string>
+ <string>{391.1666679382335, 313.6666666666664}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169455</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{31.999987284342428, -14.081351280212308}</string>
+ <string>{-40, 1.5446373167492311}</string>
+ </array>
+ <key>ID</key>
+ <integer>169469</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{344.9995533451783, 301.1612218744512}</string>
+ <string>{394.50000127156665, 299.00000000000045}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169442</integer>
+ <key>Info</key>
+ <integer>3</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{8.5833282470703125, -10.244596987647753}</string>
+ <string>{0, 0}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169457</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169468</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{272.41667175292969, 509.40064951817902}</string>
+ <string>{285.5, 503.81699882234847}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>Pattern</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169496</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169448</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169467</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999997456869679, 300.27229985501288}</string>
+ <string>{238.34892458824362, 260.57913893040109}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169440</integer>
+ <key>Position</key>
+ <real>0.51973581314086914</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>Group</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 214.61452811107179}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169460</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.756045</string>
+ <key>g</key>
+ <string>0.75004</string>
+ <key>r</key>
+ <string>0.994455</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 exception}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 130.51770718892479}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169461</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 internal process}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 91.940789540609359}, {105.66666412353516, 33.089282989501953}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169462</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 external process (middleware, tween)}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 158.54998334248924}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169463</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 186.58225949605369}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169464</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.327428</string>
+ <key>g</key>
+ <string>0.81823</string>
+ <key>r</key>
+ <string>0.995566</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 callback}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 63.908513387045019}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169465</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 event}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{406.9999504089372, 42.910746256511771}, {132.66667175292969, 207.81692504882812}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169466</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{1, 0.5}</string>
+ <string>{1, -0.5}</string>
+ <string>{-1, 0.5}</string>
+ <string>{-1, -0.5}</string>
+ <string>{0.5, 1}</string>
+ <string>{-0.5, 1}</string>
+ <string>{0.5, -1}</string>
+ <string>{-0.5, -1}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>CornerRadius</key>
+ <real>5</real>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Align</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
+
+\f0\b\fs20 \cf0 Legend}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ <key>TextPlacement</key>
+ <integer>0</integer>
+ </dict>
+ </array>
+ <key>ID</key>
+ <integer>169459</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{233.5000012715667, 20.000000000000934}, {116, 14}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>YES</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>169458</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Pad</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
+
+\f0\b\fs24 \cf0 &lt;%Canvas%&gt;}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ <key>Wrap</key>
+ <string>NO</string>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{285.5, 492.544677734375}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169457</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 BeforeRender}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83337529500417, 335.17855853126167}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169456</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 HTTPForbidden}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83337529500417, 312.54463200342093}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169455</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 PredicateMismatch}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 7.05596923828125}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169486</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169454</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000001850648417, 128.2276785555359}</string>
+ <string>{82.999949137370791, 166.28868579864502}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169446</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169446</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169453</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 67.727678571434836}</string>
+ <string>{83.000002543132396, 105.18303707668386}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169445</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 671.51189931233432}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169452</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 middleware egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{239, 629.51189931233432}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169451</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.327428</string>
+ <key>g</key>
+ <string>0.81823</string>
+ <key>r</key>
+ <string>0.995566</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 finished callbacks}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{239, 572.5118993123325}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169450</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.327428</string>
+ <key>g</key>
+ <string>0.81823</string>
+ <key>r</key>
+ <string>0.995566</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 response callbacks}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 548.10604731241608}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169449</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 tween egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83336130777977, 249.18303989230026}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169448</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 ContextFound}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 240.18303707668389}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169447</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 traversal}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 105.18303707668386}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169446</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 tween ingress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 45.18303707668386}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169445</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 middleware ingress }</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{420.49995040893634, 472.78869058972316}, {105.66666412353516, 42.300594329833984}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169444</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{-0.49999999999999956, -0.5}</string>
+ <string>{-0.49999999999999956, 0.5}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 notfound_view / forbidden_view / exception_view}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{420.49995040893634, 290.66666666666691}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169443</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.756045</string>
+ <key>g</key>
+ <string>0.75004</string>
+ <key>r</key>
+ <string>0.994455</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 exception}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83336512247806, 289.91071033477789}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169442</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 HTTPNotFound}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169447</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169441</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999949137370791, 216.62202930450437}</string>
+ <string>{83.000002543132396, 240.18303707668389}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169487</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 7.05596923828125}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169480</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169440</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999997456869679, 263.22767855635425}</string>
+ <string>{82.999997456869679, 335}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169447</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -8.9999999999999432}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169475</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169439</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999997456869679, 385.33334350585938}</string>
+ <string>{83.000002543132396, 452.41914073626253}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169481</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9839935302734375}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169452</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169438</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 571.15068879140836}</string>
+ <string>{83.000002543132396, 671.51189931233421}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169449</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 7.055999755859375}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169483</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169437</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{473.33328247070392, 313.2113088426139}</string>
+ <string>{473.33338419596407, 338.15028762817326}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169443</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840011596679688}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169444</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169436</integer>
+ <key>Layer</key>
+ <integer>1</integer>
+ <key>Points</key>
+ <array>
+ <string>{473.33338359264764, 388.98363112285512}</string>
+ <string>{473.33328247070392, 472.78869058972316}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169484</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169358</integer>
+ <key>Info</key>
+ <integer>6</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169359</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{272.4166717529298, 537.32234122436705}</string>
+ <string>{420.4999504089364, 515.08928491955714}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169206</integer>
+ <key>Info</key>
+ <integer>5</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169358</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169360</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{272.50004831949906, 391.51558277923863}</string>
+ <string>{420.4999504089364, 472.78869058972316}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169205</integer>
+ <key>Info</key>
+ <integer>5</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169044</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169130</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 592.81693102013151}</string>
+ <string>{239, 583.78422005970799}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169128</integer>
+ <key>Position</key>
+ <real>0.28820157051086426</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169045</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169129</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 629.80996162681686}</string>
+ <string>{239, 640.78422005970981}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169128</integer>
+ <key>Position</key>
+ <real>0.5668826699256897</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>Group</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.8333613077798, 391.51558277923863}, {105.66668701171875, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169205</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{0.50000000000000089, -0.49999999999999645}</string>
+ <string>{-0.49526813868737474, -0.4689979626999552}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 authorization}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 518.66629314423074}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169206</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{0.50000000000000089, 0.5}</string>
+ <string>{-0.49999999999999911, 0.49999999999999289}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 decorators egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 410.17162450154819}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169207</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{0.50000000000000089, -0.49999999999999645}</string>
+ <string>{-0.49526813868737474, -0.4689979626999552}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 decorators ingress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 500.07262547811081}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169208</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 response adapter}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 481.41657294757954}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169209</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view mapper egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 447.88119486967923}, {105.66666412353516, 33.089282989501953}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169210</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{166.75000762939453, 428.77906519094307}, {105.66666412353516, 18.656048080136394}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169211</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.637876</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view mapper ingress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>ID</key>
+ <integer>169204</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169085</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169086</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.166643778483959, 611.77452873049333}</string>
+ <string>{238.8333613077798, 611.77452873049333}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83336130777977, 600.50220798311784}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169085</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 NewResponse}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169083</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169084</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999986314263907, 140.3328574622312}</string>
+ <string>{239.83340199788393, 141.59152244387357}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169048</integer>
+ <key>Position</key>
+ <real>0.35945424437522888</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{239.83340199788395, 130.31920169649808}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169083</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 NewRequest}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>TableGroup</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166605631511416, 166.28868579864499}, {105.66668701171875, 33.08929443359375}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169081</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 URL dispatch}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166605631511416, 199.37798023223874}, {105.66668701171875, 17.244049072265625}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169082</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 route predicates}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>GridH</key>
+ <array>
+ <integer>169081</integer>
+ <integer>169082</integer>
+ <array/>
+ </array>
+ <key>ID</key>
+ <integer>169080</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>TableGroup</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{420.5000406901047, 338.15028762817326}, {105.66668701171875, 33.08929443359375}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169355</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view lookup}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{420.5000406901047, 371.23958206176701}, {105.66668701171875, 17.244049072265625}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169356</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 predicates}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>GridH</key>
+ <array>
+ <integer>169355</integer>
+ <integer>169356</integer>
+ <array/>
+ </array>
+ <key>ID</key>
+ <integer>169354</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>TableGroup</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166661580404835, 335}, {105.66667175292969, 33.08929443359375}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169075</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view lookup}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166661580404835, 368.08929443359375}, {105.66667175292969, 17.244049072265625}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169076</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 predicates}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>GridH</key>
+ <array>
+ <integer>169075</integer>
+ <integer>169076</integer>
+ <array/>
+ </array>
+ <key>ID</key>
+ <integer>169074</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169070</integer>
+ <key>Info</key>
+ <integer>7</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169073</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{166.75000762939462, 537.32234122436694}</string>
+ <string>{135.66666666666765, 485}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169206</integer>
+ <key>Info</key>
+ <integer>6</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169070</integer>
+ <key>Info</key>
+ <integer>8</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169072</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{167.33336141608385, 392.09395827769049}</string>
+ <string>{135.66666666666777, 452.41914073626253}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.755269</string>
+ <key>g</key>
+ <string>0.755239</string>
+ <key>r</key>
+ <string>0.75529</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>11</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169205</integer>
+ <key>Info</key>
+ <integer>6</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -8.9999999999999432}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169043</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169071</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 485.50842372576449}</string>
+ <string>{83.000002543132396, 548.10604731241608}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169070</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 452.41914073626253}, {105.66666412353516, 33.089282989501953}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169070</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{-0.49211360058019871, -0.49251945318722434}</string>
+ <string>{-0.49211360058019871, 0.49470854679786669}</string>
+ <string>{0.4984227008620481, 0.48463479169597612}</string>
+ <string>{0.49842270086204898, -0.5}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view pipeline}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{51.333333333333314, 0}</string>
+ <string>{-0.66666666666662877, 58.666666666666686}</string>
+ <string>{0.66673293066804717, -58.666850540458825}</string>
+ <string>{-16.306719354194399, 0.26652623861849634}</string>
+ </array>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169344</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169345</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{369.66666666666669, 541}</string>
+ <string>{404.00000000000023, 362}</string>
+ <string>{420.36749776329049, 302.42112495959606}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.75663</string>
+ <key>g</key>
+ <string>0.756618</string>
+ <key>r</key>
+ <string>0.75664</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>Pattern</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{69.833333333332462, -0.72767857143483639}</string>
+ <string>{-0.66690523835279691, -51.044605218028948}</string>
+ <string>{0.66666666666674246, 51.044637362162291}</string>
+ <string>{-24.333271383961971, -0.13425428344572765}</string>
+ </array>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169344</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169346</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{310.66666666666754, 118.72767857143484}</string>
+ <string>{399.33333333333417, 216.62202930450439}</string>
+ <string>{420.37955338188368, 301.45369961823752}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.75663</string>
+ <key>g</key>
+ <string>0.756618</string>
+ <key>r</key>
+ <string>0.75664</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>Pattern</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{-3.9999491373696401, 78.910715080442856}</string>
+ <string>{92.666683130060392, 0.22547126950667007}</string>
+ </array>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169085</integer>
+ <key>Info</key>
+ <integer>3</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169361</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{473.33328247070392, 515.08928491955714}</string>
+ <string>{344.50002543131501, 611.77452873049333}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169358</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{31.999987284342428, -14.081351280212308}</string>
+ <string>{-32.166667938232536, 10.244050343831077}</string>
+ </array>
+ <key>ID</key>
+ <integer>169341</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{344.96346869509995, 346.26317428240412}</string>
+ <string>{389.8333346048999, 328.08928298950207}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169340</integer>
+ <key>Info</key>
+ <integer>3</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{31.999987284342428, -14.081351280212308}</string>
+ <string>{-28.500001271565793, 8.3333333333333144}</string>
+ </array>
+ <key>ID</key>
+ <integer>169337</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{344.98861594084059, 323.71068461220347}</string>
+ <string>{391.1666679382335, 313.6666666666664}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169336</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{31.999987284342428, -14.081351280212308}</string>
+ <string>{-40, 1.5446373167492311}</string>
+ </array>
+ <key>ID</key>
+ <integer>169333</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{344.9995533451783, 301.1612218744512}</string>
+ <string>{394.50000127156665, 299.00000000000045}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169332</integer>
+ <key>Info</key>
+ <integer>3</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{8.5833282470703125, -10.244596987647753}</string>
+ <string>{0, 0}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169051</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169062</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{272.41667175292969, 509.40064951817902}</string>
+ <string>{285.5, 503.81699882234847}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>Pattern</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169208</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169042</integer>
+ <key>Info</key>
+ <integer>4</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169061</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999997456869679, 300.27229985501288}</string>
+ <string>{238.34892458824362, 260.57913893040109}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>Legacy</key>
+ <true/>
+ <key>Pattern</key>
+ <integer>2</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169034</integer>
+ <key>Position</key>
+ <real>0.51973581314086914</real>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>Group</string>
+ <key>Graphics</key>
+ <array>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 214.61452811107179}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169054</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.756045</string>
+ <key>g</key>
+ <string>0.75004</string>
+ <key>r</key>
+ <string>0.994455</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 exception}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 130.51770718892479}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169055</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 internal process}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 91.940789540609359}, {105.66666412353516, 33.089282989501953}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169056</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 external process (middleware, tween)}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 158.54998334248924}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169057</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 view}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 186.58225949605369}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169058</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.327428</string>
+ <key>g</key>
+ <string>0.81823</string>
+ <key>r</key>
+ <string>0.995566</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 callback}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{419.66662216186666, 63.908513387045019}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169059</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 event}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{406.9999504089372, 42.910746256511771}, {132.66667175292969, 207.81692504882812}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169060</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{1, 0.5}</string>
+ <string>{1, -0.5}</string>
+ <string>{-1, 0.5}</string>
+ <string>{-1, -0.5}</string>
+ <string>{0.5, 1}</string>
+ <string>{-0.5, 1}</string>
+ <string>{0.5, -1}</string>
+ <string>{-0.5, -1}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>CornerRadius</key>
+ <real>5</real>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Align</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
+
+\f0\b\fs20 \cf0 Legend}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ <key>TextPlacement</key>
+ <integer>0</integer>
+ </dict>
+ </array>
+ <key>ID</key>
+ <integer>169053</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{233.5000012715667, 20.000000000000934}, {116, 14}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>YES</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>169052</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Pad</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
+
+\f0\b\fs24 \cf0 &lt;%Canvas%&gt;}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ <key>Wrap</key>
+ <string>NO</string>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{285.5, 492.544677734375}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169051</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 BeforeRender}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83337529500417, 335.17855853126167}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169340</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 HTTPForbidden}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83337529500417, 312.54463200342093}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169336</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 PredicateMismatch}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 7.05596923828125}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169081</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169048</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000001850648417, 128.2276785555359}</string>
+ <string>{82.999949137370791, 166.28868579864502}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169040</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169040</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169047</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 67.727678571434836}</string>
+ <string>{83.000002543132396, 105.18303707668386}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169039</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 671.51189931233432}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169046</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 middleware egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{239, 629.51189931233432}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169045</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.327428</string>
+ <key>g</key>
+ <string>0.81823</string>
+ <key>r</key>
+ <string>0.995566</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 finished callbacks}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{239, 572.5118993123325}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169044</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.327428</string>
+ <key>g</key>
+ <string>0.81823</string>
+ <key>r</key>
+ <string>0.995566</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 response callbacks}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 548.10604731241608}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169043</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 tween egress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83336130777977, 249.18303989230026}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169042</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 ContextFound}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 240.18303707668389}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169041</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 traversal}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 105.18303707668386}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169040</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 tween ingress}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{30.166670481364818, 45.18303707668386}, {105.66666412353516, 22.544641494750977}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169039</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999208</string>
+ <key>g</key>
+ <string>0.811343</string>
+ <key>r</key>
+ <string>0.644457</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 middleware ingress }</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{420.49995040893634, 472.78869058972316}, {105.66666412353516, 42.300594329833984}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169358</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ <string>{-0.49999999999999956, -0.5}</string>
+ <string>{-0.49999999999999956, 0.5}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 notfound_view / forbidden_view / exception_view}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{420.49995040893634, 290.66666666666691}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169344</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.756045</string>
+ <key>g</key>
+ <string>0.75004</string>
+ <key>r</key>
+ <string>0.994455</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 exception}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{238.83336512247806, 289.91071033477789}, {105.66666412353516, 22.544642175946908}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169332</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ <key>ShadowVector</key>
+ <string>{2, 2}</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 HTTPNotFound}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169041</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169035</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999949137370791, 216.62202930450437}</string>
+ <string>{83.000002543132396, 240.18303707668389}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169082</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 7.05596923828125}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169075</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169034</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999997456869679, 263.22767855635425}</string>
+ <string>{82.999997456869679, 335}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169041</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -8.9999999999999432}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169070</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169033</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{82.999997456869679, 385.33334350585938}</string>
+ <string>{83.000002543132396, 452.41914073626253}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169076</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9839935302734375}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169046</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169128</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{83.000002543132396, 571.15068879140836}</string>
+ <string>{83.000002543132396, 671.51189931233421}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169043</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 7.055999755859375}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169355</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169357</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{473.33328247070392, 313.2113088426139}</string>
+ <string>{473.33338419596407, 338.15028762817326}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169344</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840011596679688}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169358</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169362</integer>
+ <key>Layer</key>
+ <integer>2</integer>
+ <key>Points</key>
+ <array>
+ <string>{473.33338359264764, 388.98363112285512}</string>
+ <string>{473.33328247070392, 472.78869058972316}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169356</integer>
+ </dict>
+ </dict>
+ </array>
+ <key>GridInfo</key>
+ <dict/>
+ <key>GuidesLocked</key>
+ <string>NO</string>
+ <key>GuidesVisible</key>
+ <string>YES</string>
+ <key>HPages</key>
+ <integer>1</integer>
+ <key>ImageCounter</key>
+ <integer>3</integer>
+ <key>KeepToScale</key>
+ <false/>
+ <key>Layers</key>
+ <array>
+ <dict>
+ <key>Lock</key>
+ <string>NO</string>
+ <key>Name</key>
+ <string>no exceptions</string>
+ <key>Print</key>
+ <string>YES</string>
+ <key>View</key>
+ <string>YES</string>
+ </dict>
+ <dict>
+ <key>Lock</key>
+ <string>NO</string>
+ <key>Name</key>
+ <string>exceptions only</string>
+ <key>Print</key>
+ <string>YES</string>
+ <key>View</key>
+ <string>NO</string>
+ </dict>
+ <dict>
+ <key>Lock</key>
+ <string>NO</string>
+ <key>Name</key>
+ <string>all</string>
+ <key>Print</key>
+ <string>YES</string>
+ <key>View</key>
+ <string>NO</string>
+ </dict>
+ </array>
+ <key>LayoutInfo</key>
+ <dict>
+ <key>Animate</key>
+ <string>NO</string>
+ <key>circoMinDist</key>
+ <real>18</real>
+ <key>circoSeparation</key>
+ <real>0.0</real>
+ <key>layoutEngine</key>
+ <string>dot</string>
+ <key>neatoSeparation</key>
+ <real>0.0</real>
+ <key>twopiSeparation</key>
+ <real>0.0</real>
+ </dict>
+ <key>LinksVisible</key>
+ <string>NO</string>
+ <key>MagnetsVisible</key>
+ <string>NO</string>
+ <key>MasterSheets</key>
+ <array/>
+ <key>ModificationDate</key>
+ <string>2014-11-23 07:19:11 +0000</string>
+ <key>Modifier</key>
+ <string>Steve Piercy</string>
+ <key>NotesVisible</key>
+ <string>NO</string>
+ <key>Orientation</key>
+ <integer>2</integer>
+ <key>OriginVisible</key>
+ <string>NO</string>
+ <key>PageBreaks</key>
+ <string>YES</string>
+ <key>PrintInfo</key>
+ <dict>
+ <key>NSBottomMargin</key>
+ <array>
+ <string>float</string>
+ <string>41</string>
+ </array>
+ <key>NSHorizonalPagination</key>
+ <array>
+ <string>coded</string>
+ <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string>
+ </array>
+ <key>NSLeftMargin</key>
+ <array>
+ <string>float</string>
+ <string>18</string>
+ </array>
+ <key>NSPaperSize</key>
+ <array>
+ <string>size</string>
+ <string>{612, 792}</string>
+ </array>
+ <key>NSPrintReverseOrientation</key>
+ <array>
+ <string>int</string>
+ <string>0</string>
+ </array>
+ <key>NSRightMargin</key>
+ <array>
+ <string>float</string>
+ <string>18</string>
+ </array>
+ <key>NSTopMargin</key>
+ <array>
+ <string>float</string>
+ <string>18</string>
+ </array>
+ </dict>
+ <key>PrintOnePage</key>
+ <false/>
+ <key>ReadOnly</key>
+ <string>NO</string>
+ <key>RowAlign</key>
+ <integer>1</integer>
+ <key>RowSpacing</key>
+ <real>36</real>
+ <key>SheetTitle</key>
+ <string>Request Processing</string>
+ <key>SmartAlignmentGuidesActive</key>
+ <string>YES</string>
+ <key>SmartDistanceGuidesActive</key>
+ <string>YES</string>
+ <key>UniqueID</key>
+ <integer>1</integer>
+ <key>UseEntirePage</key>
+ <false/>
+ <key>VPages</key>
+ <integer>1</integer>
+ <key>WindowInfo</key>
+ <dict>
+ <key>CurrentSheet</key>
+ <integer>0</integer>
+ <key>ExpandedCanvases</key>
+ <array>
+ <dict>
+ <key>name</key>
+ <string>Request Processing</string>
+ </dict>
+ </array>
+ <key>Frame</key>
+ <string>{{35, 93}, {1394, 1325}}</string>
+ <key>ListView</key>
+ <true/>
+ <key>OutlineWidth</key>
+ <integer>178</integer>
+ <key>RightSidebar</key>
+ <true/>
+ <key>ShowRuler</key>
+ <true/>
+ <key>Sidebar</key>
+ <true/>
+ <key>SidebarWidth</key>
+ <integer>163</integer>
+ <key>VisibleRegion</key>
+ <string>{{-231, -226}, {1037, 1186}}</string>
+ <key>Zoom</key>
+ <real>1</real>
+ <key>ZoomValues</key>
+ <array>
+ <array>
+ <string>Request Processing</string>
+ <real>1</real>
+ <real>2</real>
+ </array>
+ </array>
+ </dict>
+</dict>
+</plist>
diff --git a/docs/_static/pyramid_request_processing.png b/docs/_static/pyramid_request_processing.png
new file mode 100644
index 000000000..2fbb1e164
--- /dev/null
+++ b/docs/_static/pyramid_request_processing.png
Binary files differ
diff --git a/docs/_static/pyramid_request_processing.svg b/docs/_static/pyramid_request_processing.svg
new file mode 100644
index 000000000..21bbcb532
--- /dev/null
+++ b/docs/_static/pyramid_request_processing.svg
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="91 11 424 533" width="424pt" height="533pt"><metadata xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:date>2014-11-23 07:19Z</dc:date><!-- Produced by OmniGraffle Professional 5.4.4 --></metadata><defs><marker orient="auto" overflow="visible" markerUnits="strokeWidth" id="SharpArrow_Marker" viewBox="-4 -4 10 8" markerWidth="10" markerHeight="8" color="#191919"><g><path d="M 5 0 L -3 -3 L 0 0 L 0 0 L -3 3 Z" fill="currentColor" stroke="currentColor" stroke-width="1"/></g></marker><font-face font-family="Helvetica" font-size="10" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="12" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="10" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face></defs><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><title>Request Processing</title><rect fill="white" width="576" height="733"/><g><title>no exceptions</title><path d="M 155 444.75674 C 155 450.64061 155 486.2592 155 502.71617" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><path d="M 154.99999 322.33334 C 154.99999 327.72413 155 337.74646 155 346.1775" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><path d="M 154.99999 245.22768 C 154.99999 250.5417 154.99999 257.93189 154.99999 265.10145" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><path d="M 154.99995 198.62203 C 154.99995 203.74682 154.99998 209.1909 154.99999 215.28222" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><rect x="102.16667" y="45.183037" width="105.666664" height="22.544641" fill="#a4cfff"/><rect x="102.16667" y="45.183037" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.16667 50.455358)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="4.7596016" y="10" textLength="88.92578">middleware ingress </tspan></text><rect x="102.16667" y="96.183037" width="105.666664" height="22.544641" fill="#a4cfff"/><rect x="102.16667" y="96.183037" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.16667 101.45536)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="16.983723" y="10" textLength="61.69922">tween ingress</tspan></text><rect x="102.16667" y="222.18304" width="105.666664" height="22.544641" fill="#d2ffd0"/><rect x="102.16667" y="222.18304" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.16667 227.45536)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="28.660969" y="10" textLength="38.344727">traversal</tspan></text><rect x="238.83336" y="247.18304" width="105.666664" height="22.544641" fill="#dfbeff"/><rect x="238.83336" y="247.18304" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(243.83336 252.45536)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="16.424641" y="10" textLength="62.817383">ContextFound</tspan></text><rect x="102.16667" y="422.2121" width="105.666664" height="22.544641" fill="#a4cfff"/><rect x="102.16667" y="422.2121" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.16667 427.48442)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="18.094563" y="10" textLength="59.47754">tween egress</tspan></text><rect x="239" y="445.2359" width="105.666664" height="22.544641" fill="#fed153"/><rect x="239" y="445.2359" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(244 450.50821)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="5.3113594" y="10" textLength="85.043945">response callbacks</tspan></text><rect x="239" y="497.2359" width="105.666664" height="22.544641" fill="#fed153"/><rect x="239" y="497.2359" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(244 502.5082)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="8.6463203" y="10" textLength="5">fi</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="13.64632" y="10" textLength="73.374023">nished callbacks</tspan></text><rect x="102.16667" y="509.61795" width="105.666664" height="22.544641" fill="#a4cfff"/><rect x="102.16667" y="509.61795" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.16667 514.89027)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="5.8704414" y="10" textLength="83.92578">middleware egress</tspan></text><path d="M 155 67.72768 C 155 73.048893 155 81.55558 155 89.2853" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><path d="M 155 119.22768 C 155 124.62026 154.99997 133.48763 154.99996 141.38632" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><rect x="375.5" y="391" width="105.666664" height="22.544642" fill="#dfbeff"/><rect x="375.5" y="391" width="105.666664" height="22.544642" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(380.5 396.27232)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="16.702961" y="10" textLength="62.260742">BeforeRender</tspan></text><text transform="translate(233.5 20)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="bold" x=".31445312" y="11" textLength="115.371094">Request Processing</tspan></text><path d="M 375.99995 42.910746 L 498.66662 42.910746 C 501.42805 42.910746 503.66662 45.149323 503.66662 47.910746 L 503.66662 222 C 503.66662 224.76142 501.42805 227 498.66662 227 L 375.99995 227 C 373.23853 227 370.99995 224.76142 370.99995 222 L 370.99995 47.910746 C 370.99995 45.149323 373.23853 42.910746 375.99995 42.910746 Z" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(375.99995 42.910746)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="0" y="10" textLength="35.55664">Legend</tspan></text><rect x="383.66662" y="63.908513" width="105.666664" height="22.544641" fill="#dfbeff"/><rect x="383.66662" y="63.908513" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(388.66662 69.180834)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="35.601887" y="10" textLength="24.46289">event</tspan></text><rect x="383.66662" y="186.58226" width="105.666664" height="22.544641" fill="#fed153"/><rect x="383.66662" y="186.58226" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(388.66662 191.85458)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="29.769367" y="10" textLength="36.12793">callback</tspan></text><rect x="383.66662" y="158.54998" width="105.666664" height="22.544641" fill="#ffff6c"/><rect x="383.66662" y="158.54998" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(388.66662 163.8223)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="37.83089" y="10" textLength="20.004883">view</tspan></text><rect x="383.66662" y="91.94079" width="105.666664" height="33.089283" fill="#a4cfff"/><rect x="383.66662" y="91.94079" width="105.666664" height="33.089283" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(388.66662 96.48543)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="11.148762" y="10" textLength="76.14746">external process </tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="2.8162422" y="22" textLength="90.03418">(middleware, tween)</tspan></text><rect x="383.66662" y="130.51771" width="105.666664" height="22.544641" fill="#d2ffd0"/><rect x="383.66662" y="130.51771" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(388.66662 135.79003)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="12.537922" y="10" textLength="70.59082">internal process</tspan></text><line x1="154.99999" y1="258.44082" x2="238.83336" y2="258.45536" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,4"/><rect x="102.16667" y="353.07515" width="105.666664" height="33.089283" fill="#ffff6c"/><rect x="102.16667" y="353.07515" width="105.666664" height="33.089283" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.16667 363.61979)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="19.205402" y="10" textLength="57.25586">view pipeline</tspan></text><path d="M 155 386.66443 C 155 392.17252 155 405.5052 155 415.30935" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><line x1="239.33336" y1="285.57838" x2="207.66667" y2="353.07515" stroke="#c1c1c1" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,3"/><line x1="238.75001" y1="430.80676" x2="207.66667" y2="385.656" stroke="#c1c1c1" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,3"/><rect x="102.16666" y="305.0893" width="105.666664" height="17.244049" fill="#d2ffd0"/><rect x="102.16666" y="305.0893" width="105.666664" height="17.244049" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.16666 307.71132)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="24.764484" y="10" textLength="46.137695">predicates</tspan></text><rect x="102.16666" y="272" width="105.666664" height="33.089294" fill="#d2ffd0"/><rect x="102.16666" y="272" width="105.666664" height="33.089294" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.16666 282.54465)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="21.707844" y="10" textLength="52.250977">view lookup</tspan></text><rect x="102.166606" y="181.37798" width="105.666695" height="17.244049" fill="#d2ffd0"/><rect x="102.166606" y="181.37798" width="105.666695" height="17.244049" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.166606 184)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="11.978855" y="10" textLength="71.708984">route predicates</tspan></text><rect x="102.166606" y="148.28869" width="105.666695" height="33.089294" fill="#d2ffd0"/><rect x="102.166606" y="148.28869" width="105.666695" height="33.089294" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(107.166606 158.83333)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="18.001804" y="10" textLength="20.004883">URL</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="37.640476" y="10" textLength="40.024414"> dispatch</tspan></text><rect x="239.8334" y="117.3192" width="105.666664" height="22.544641" fill="#dfbeff"/><rect x="239.8334" y="117.3192" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(244.8334 122.59152)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="19.207844" y="10" textLength="57.250977">NewRequest</tspan></text><line x1="154.99999" y1="128.68025" x2="239.8334" y2="128.59152" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,4"/><rect x="238.83336" y="471.2262" width="105.666664" height="22.544641" fill="#dfbeff"/><rect x="238.83336" y="471.2262" width="105.666664" height="22.544641" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(243.83336 476.49852)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="15.316242" y="10" textLength="65.03418">NewResponse</tspan></text><line x1="155" y1="470.25295" x2="238.33861" y2="482.42625" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,4"/><rect x="238.75001" y="322.26348" width="105.666664" height="18.656048" fill="#ffffa3"/><rect x="238.75001" y="322.26348" width="105.666664" height="18.656048" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(243.75001 325.5915)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="1.9812813" y="10" textLength="91.7041">view mapper ingress</tspan></text><rect x="238.75001" y="341.36561" width="105.666664" height="33.089283" fill="#ffff6c"/><rect x="238.75001" y="341.36561" width="105.666664" height="33.089283" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(243.75001 351.91025)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="37.83089" y="10" textLength="20.004883">view</tspan></text><rect x="238.75001" y="374.901" width="105.666664" height="18.656048" fill="#ffffa3"/><rect x="238.75001" y="374.901" width="105.666664" height="18.656048" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(243.75001 378.22901)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="3.0921211" y="10" textLength="89.48242">view mapper egress</tspan></text><rect x="238.75001" y="393.55704" width="105.666664" height="18.656048" fill="#ffffa3"/><rect x="238.75001" y="393.55704" width="105.666664" height="18.656048" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(243.75001 396.88507)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="8.9173164" y="10" textLength="77.83203">response adapter</tspan></text><rect x="238.75001" y="303.65604" width="105.666664" height="18.656048" fill="#ffffa3"/><rect x="238.75001" y="303.65604" width="105.666664" height="18.656048" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(243.75001 306.98407)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="6.702961" y="10" textLength="82.26074">decorators ingress</tspan></text><rect x="238.75001" y="412.1507" width="105.666664" height="18.656048" fill="#ffffa3"/><rect x="238.75001" y="412.1507" width="105.666664" height="18.656048" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(243.75001 415.47873)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="7.813801" y="10" textLength="80.039062">decorators egress</tspan></text><rect x="238.83336" y="285" width="105.66669" height="18.656048" fill="#ffffa3"/><rect x="238.83336" y="285" width="105.66669" height="18.656048" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(243.83336 288.32802)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="19.202972" y="10" textLength="57.260742">authorization</tspan></text><line x1="155" y1="482.12575" x2="238.52297" y2="508.3584" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,4"/><line x1="155" y1="459.27668" x2="238.50027" y2="456.52468" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,4"/><line x1="344.41667" y1="402.88507" x2="375.5" y2="402.27232" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,4"/></g></g></svg>
diff --git a/docs/_static/pyramid_router.graffle b/docs/_static/pyramid_router.graffle
new file mode 100644
index 000000000..217878426
--- /dev/null
+++ b/docs/_static/pyramid_router.graffle
@@ -0,0 +1,1621 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>ActiveLayerIndex</key>
+ <integer>0</integer>
+ <key>ApplicationVersion</key>
+ <array>
+ <string>com.omnigroup.OmniGrafflePro</string>
+ <string>139.18.0.187838</string>
+ </array>
+ <key>AutoAdjust</key>
+ <true/>
+ <key>BackgroundGraphic</key>
+ <dict>
+ <key>Bounds</key>
+ <string>{{0, 0}, {576, 733}}</string>
+ <key>Class</key>
+ <string>SolidGraphic</string>
+ <key>ID</key>
+ <integer>2</integer>
+ <key>Style</key>
+ <dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ </dict>
+ <key>BaseZoom</key>
+ <integer>0</integer>
+ <key>CanvasOrigin</key>
+ <string>{0, 0}</string>
+ <key>ColumnAlign</key>
+ <integer>1</integer>
+ <key>ColumnSpacing</key>
+ <real>36</real>
+ <key>CreationDate</key>
+ <string>2014-12-01 08:25:13 +0000</string>
+ <key>Creator</key>
+ <string>Steve Piercy</string>
+ <key>DisplayScale</key>
+ <string>1 0/72 in = 1 0/72 in</string>
+ <key>GraphDocumentVersion</key>
+ <integer>8</integer>
+ <key>GraphicsList</key>
+ <array>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169413</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169414</integer>
+ <key>Points</key>
+ <array>
+ <string>{202.04165903727232, 501.05557886759294}</string>
+ <string>{202.04165903727232, 528.77776209513161}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169412</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{104.41666666666686, 528.77776209513161}, {195.24998474121094, 29}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169413</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.999449</string>
+ <key>g</key>
+ <string>0.743511</string>
+ <key>r</key>
+ <string>0.872276</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 Return the
+\b response}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{104.41666666666657, 471.55557886759294}, {195.24998474121094, 29}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169412</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 Invoke the
+\b view callable
+\b0 ,\
+which returns a
+\b response}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{291.21562524160186, 379.55555343627816}, {26, 24}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>YES</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>169411</integer>
+ <key>Line</key>
+ <dict>
+ <key>ID</key>
+ <integer>169410</integer>
+ <key>Offset</key>
+ <real>7.3333320617675781</real>
+ <key>Position</key>
+ <real>0.4865129292011261</real>
+ <key>RotationType</key>
+ <integer>0</integer>
+ </dict>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
+
+\f0\fs24 \cf0 No}</string>
+ </dict>
+ <key>Wrap</key>
+ <string>NO</string>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{34.791667904111534, 0}</string>
+ <string>{-33.999994913736998, 0}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169409</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169410</integer>
+ <key>Points</key>
+ <array>
+ <string>{280.85416589389337, 398.88888549804574}</string>
+ <string>{327.47912214508739, 398.88888549804574}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169404</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{327.47912214508739, 384.38888549804574}, {156.62496948242188, 29}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169409</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.756045</string>
+ <key>g</key>
+ <string>0.75004</string>
+ <key>r</key>
+ <string>0.994455</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 Return the
+\b Forbidden View}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{175.11595161998204, 438.9999954213917}, {30, 24}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>YES</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>169408</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
+
+\f0\fs24 \cf0 Yes}</string>
+ </dict>
+ <key>Wrap</key>
+ <string>NO</string>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169412</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169407</integer>
+ <key>Points</key>
+ <array>
+ <string>{202.04165267944353, 437.33333079020139}</string>
+ <string>{202.04165903727204, 471.55557886759294}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169404</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{171.708317756653, 329.24978243601743}, {30, 24}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>YES</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>169406</integer>
+ <key>Line</key>
+ <dict>
+ <key>ID</key>
+ <integer>169405</integer>
+ <key>Offset</key>
+ <real>-15.333334922790527</real>
+ <key>Position</key>
+ <real>0.45895844697952271</real>
+ <key>RotationType</key>
+ <integer>0</integer>
+ </dict>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
+
+\f0\fs24 \cf0 Yes}</string>
+ </dict>
+ <key>Wrap</key>
+ <string>NO</string>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169404</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169405</integer>
+ <key>Points</key>
+ <array>
+ <string>{202.04165267944353, 326.72223360222029}</string>
+ <string>{202.04165267944353, 360.44446818033811}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>3</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{123.72916793823259, 360.44446818033811}, {156.62496948242188, 76.888862609863281}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169404</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Diamond</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 Current user has
+\b authorization
+\b0 to invoke the view callable?}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{283.07625736262997, 281.88889694213805}, {26, 24}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>YES</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>169403</integer>
+ <key>Line</key>
+ <dict>
+ <key>ID</key>
+ <integer>169402</integer>
+ <key>Offset</key>
+ <real>7.3333320617675781</real>
+ <key>Position</key>
+ <real>0.4865129292011261</real>
+ <key>RotationType</key>
+ <integer>0</integer>
+ </dict>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
+
+\f0\fs24 \cf0 No}</string>
+ </dict>
+ <key>Wrap</key>
+ <string>NO</string>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{34.791667904111534, 0}</string>
+ <string>{-33.999994913736998, 0}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169401</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169402</integer>
+ <key>Points</key>
+ <array>
+ <string>{265.20833208871704, 301.22222900390562}</string>
+ <string>{327.47911580403627, 301.22222900390562}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>3</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{327.47911580403627, 286.72222900390562}, {156.62496948242188, 29}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169401</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.756045</string>
+ <key>g</key>
+ <string>0.75004</string>
+ <key>r</key>
+ <string>0.994455</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 Return the
+\b Not Found View}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>3</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169400</integer>
+ <key>Points</key>
+ <array>
+ <string>{202.04165903727255, 251}</string>
+ <string>{202.04165776570633, 276.22223154703772}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169393</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{139.37498982747391, 276.22223154703778}, {125.33333587646484, 50}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>3</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Diamond</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.422927</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>1</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 View callable found?}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169393</integer>
+ <key>Info</key>
+ <integer>2</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169396</integer>
+ <key>Points</key>
+ <array>
+ <string>{202.04165903727255, 196.77777862548834}</string>
+ <string>{202.04165903727255, 222}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169392</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169392</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169395</integer>
+ <key>Points</key>
+ <array>
+ <string>{202.04165903727255, 142.55555725097662}</string>
+ <string>{202.04165903727255, 167.77777862548834}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>169391</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ControlPoints</key>
+ <array>
+ <string>{0, 6.9840087890625}</string>
+ <string>{0, -9}</string>
+ </array>
+ <key>FontInfo</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>w</key>
+ <string>0</string>
+ </dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>169391</integer>
+ </dict>
+ <key>ID</key>
+ <integer>169385</integer>
+ <key>Points</key>
+ <array>
+ <string>{202.04165903727255, 82.666667938232479}</string>
+ <string>{202.04165903727255, 107.88888931274418}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>Bezier</key>
+ <true/>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.0980392</string>
+ <key>g</key>
+ <string>0.0980392</string>
+ <key>r</key>
+ <string>0.0980392</string>
+ </dict>
+ <key>HeadArrow</key>
+ <string>SharpArrow</string>
+ <key>Legacy</key>
+ <true/>
+ <key>LineType</key>
+ <integer>1</integer>
+ <key>TailArrow</key>
+ <string>0</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>19</integer>
+ <key>Info</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{104.41666666666708, 222}, {195.24998474121094, 29}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169393</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 Look up a
+\b view callable
+\b0 in the
+\b registry
+\b0 using the
+\b context
+\b0 and
+\b view name}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{104.41666666666708, 167.77777862548834}, {195.24998474121094, 29}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169392</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\b\fs20 \cf0 Traversal
+\b0 locates\
+the
+\b context
+\b0 and
+\b view name}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{104.41666666666708, 107.88888931274418}, {195.24998474121094, 34.666667938232422}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>169391</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 Traverse the model graph\
+from the
+\b root
+\b0 using the
+\b path}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{104.41666666666708, 48.000000000000043}, {195.24998474121094, 34.666667938232422}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>19</integer>
+ <key>Magnets</key>
+ <array>
+ <string>{0, 1}</string>
+ <string>{0, -1}</string>
+ <string>{1, 0}</string>
+ <string>{-1, 0}</string>
+ </array>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Color</key>
+ <dict>
+ <key>b</key>
+ <string>0.815377</string>
+ <key>g</key>
+ <string>1</string>
+ <key>r</key>
+ <string>0.820561</string>
+ </dict>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc
+
+\f0\fs20 \cf0 Obtain a root object from the
+\b root factory}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{229.04165903727255, 20.000000000000934}, {90, 14}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>YES</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>169390</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Pad</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
+\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc
+
+\f0\b\fs24 \cf0 &lt;%Canvas%&gt;}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ <key>Wrap</key>
+ <string>NO</string>
+ </dict>
+ </array>
+ <key>GridInfo</key>
+ <dict/>
+ <key>GuidesLocked</key>
+ <string>NO</string>
+ <key>GuidesVisible</key>
+ <string>YES</string>
+ <key>HPages</key>
+ <integer>1</integer>
+ <key>ImageCounter</key>
+ <integer>1</integer>
+ <key>KeepToScale</key>
+ <false/>
+ <key>Layers</key>
+ <array>
+ <dict>
+ <key>Lock</key>
+ <string>NO</string>
+ <key>Name</key>
+ <string>Layer 1</string>
+ <key>Print</key>
+ <string>YES</string>
+ <key>View</key>
+ <string>YES</string>
+ </dict>
+ </array>
+ <key>LayoutInfo</key>
+ <dict>
+ <key>Animate</key>
+ <string>NO</string>
+ <key>circoMinDist</key>
+ <real>18</real>
+ <key>circoSeparation</key>
+ <real>0.0</real>
+ <key>layoutEngine</key>
+ <string>dot</string>
+ <key>neatoSeparation</key>
+ <real>0.0</real>
+ <key>twopiSeparation</key>
+ <real>0.0</real>
+ </dict>
+ <key>LinksVisible</key>
+ <string>NO</string>
+ <key>MagnetsVisible</key>
+ <string>NO</string>
+ <key>MasterSheets</key>
+ <array/>
+ <key>ModificationDate</key>
+ <string>2014-12-01 09:19:51 +0000</string>
+ <key>Modifier</key>
+ <string>Steve Piercy</string>
+ <key>NotesVisible</key>
+ <string>NO</string>
+ <key>Orientation</key>
+ <integer>2</integer>
+ <key>OriginVisible</key>
+ <string>NO</string>
+ <key>PageBreaks</key>
+ <string>YES</string>
+ <key>PrintInfo</key>
+ <dict>
+ <key>NSBottomMargin</key>
+ <array>
+ <string>float</string>
+ <string>41</string>
+ </array>
+ <key>NSHorizonalPagination</key>
+ <array>
+ <string>coded</string>
+ <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string>
+ </array>
+ <key>NSLeftMargin</key>
+ <array>
+ <string>float</string>
+ <string>18</string>
+ </array>
+ <key>NSPaperSize</key>
+ <array>
+ <string>size</string>
+ <string>{612, 792}</string>
+ </array>
+ <key>NSPrintReverseOrientation</key>
+ <array>
+ <string>int</string>
+ <string>0</string>
+ </array>
+ <key>NSRightMargin</key>
+ <array>
+ <string>float</string>
+ <string>18</string>
+ </array>
+ <key>NSTopMargin</key>
+ <array>
+ <string>float</string>
+ <string>18</string>
+ </array>
+ </dict>
+ <key>PrintOnePage</key>
+ <false/>
+ <key>ReadOnly</key>
+ <string>NO</string>
+ <key>RowAlign</key>
+ <integer>1</integer>
+ <key>RowSpacing</key>
+ <real>36</real>
+ <key>SheetTitle</key>
+ <string>Pyramid Router</string>
+ <key>SmartAlignmentGuidesActive</key>
+ <string>YES</string>
+ <key>SmartDistanceGuidesActive</key>
+ <string>YES</string>
+ <key>UniqueID</key>
+ <integer>1</integer>
+ <key>UseEntirePage</key>
+ <false/>
+ <key>VPages</key>
+ <integer>1</integer>
+ <key>WindowInfo</key>
+ <dict>
+ <key>CurrentSheet</key>
+ <integer>0</integer>
+ <key>ExpandedCanvases</key>
+ <array>
+ <dict>
+ <key>name</key>
+ <string>Pyramid Router</string>
+ </dict>
+ </array>
+ <key>Frame</key>
+ <string>{{96, 20}, {1076, 1286}}</string>
+ <key>ListView</key>
+ <false/>
+ <key>OutlineWidth</key>
+ <integer>142</integer>
+ <key>RightSidebar</key>
+ <true/>
+ <key>ShowRuler</key>
+ <true/>
+ <key>Sidebar</key>
+ <true/>
+ <key>SidebarWidth</key>
+ <integer>120</integer>
+ <key>VisibleRegion</key>
+ <string>{{8, -10}, {532, 754.66666666666663}}</string>
+ <key>Zoom</key>
+ <real>1.5</real>
+ <key>ZoomValues</key>
+ <array>
+ <array>
+ <string>Pyramid Router</string>
+ <real>1.5</real>
+ <real>1</real>
+ </array>
+ </array>
+ </dict>
+</dict>
+</plist>
diff --git a/docs/_static/pyramid_router.png b/docs/_static/pyramid_router.png
new file mode 100644
index 000000000..3c9f81158
--- /dev/null
+++ b/docs/_static/pyramid_router.png
Binary files differ
diff --git a/docs/_static/pyramid_router.svg b/docs/_static/pyramid_router.svg
new file mode 100644
index 000000000..1537777c9
--- /dev/null
+++ b/docs/_static/pyramid_router.svg
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="93 11 403 558" width="403pt" height="558pt"><metadata xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:date>2014-12-01 09:19Z</dc:date><!-- Produced by OmniGraffle Professional 5.4.4 --></metadata><defs><font-face font-family="Helvetica" font-size="12" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="10" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="10" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><marker orient="auto" overflow="visible" markerUnits="strokeWidth" id="SharpArrow_Marker" viewBox="-4 -4 10 8" markerWidth="10" markerHeight="8" color="#191919"><g><path d="M 5 0 L -3 -3 L 0 0 L 0 0 L -3 3 Z" fill="currentColor" stroke="currentColor" stroke-width="1"/></g></marker><font-face font-family="Helvetica" font-size="12" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face></defs><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><title>Pyramid Router</title><rect fill="white" width="576" height="733"/><g><title>Layer 1</title><text transform="translate(229.04166 20)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="bold" x=".32226562" y="11" textLength="89.35547">Pyramid Router</tspan></text><rect x="104.416667" y="48" width="195.24998" height="34.666668" fill="#d2ffd0"/><rect x="104.416667" y="48" width="195.24998" height="34.666668" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(109.416667 59.333334)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x=".088371277" y="10" textLength="129.51172">Obtain a root object from the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="129.60009" y="10" textLength="55.561523">root factory</tspan></text><rect x="104.416667" y="107.88889" width="195.24998" height="34.666668" fill="#d2ffd0"/><rect x="104.416667" y="107.88889" width="195.24998" height="34.666668" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(109.416667 113.22222)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="35.557121" y="10" textLength="6.1083984">T</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="41.29931" y="10" textLength="108.393555">raverse the model graph</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="29.551262" y="22" textLength="39.458008">from the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="69.00927" y="22" textLength="19.438477">root</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="88.447746" y="22" textLength="46.142578"> using the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="134.590324" y="22" textLength="21.108398">path</tspan></text><rect x="104.416667" y="167.77778" width="195.24998" height="29" fill="#d2ffd0"/><rect x="104.416667" y="167.77778" width="195.24998" height="29" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(109.416667 170.27778)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="53.428215" y="10" textLength="6.1083984">T</tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="58.98974" y="10" textLength="38.36914">raversal</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="97.35888" y="10" textLength="34.46289"> locates</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="30.093254" y="22" textLength="16.6796875">the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="46.772942" y="22" textLength="35.561523">context</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="82.334465" y="22" textLength="22.241211"> and </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="104.575676" y="22" textLength="50.581055">view name</tspan></text><rect x="104.416667" y="222" width="195.24998" height="29" fill="#d2ffd0"/><rect x="104.416667" y="222" width="195.24998" height="29" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(109.416667 224.5)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="5.3471603" y="10" textLength="46.704102">Look up a </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="52.051262" y="10" textLength="61.14746">view callable</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="113.19872" y="10" textLength="30.019531"> in the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="143.21825" y="10" textLength="36.68457">registry</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="179.90282" y="10" textLength="2.7783203"> </tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="16.750969" y="22" textLength="43.364258">using the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="60.115227" y="22" textLength="35.561523">context</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="95.67675" y="22" textLength="22.241211"> and </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="117.91796" y="22" textLength="50.581055">view name</tspan></text><path d="M 202.04166 82.66667 C 202.04166 87.86648 202.04166 94.31586 202.04166 100.98615" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><path d="M 202.04166 142.55556 C 202.04166 147.75537 202.04166 154.20475 202.04166 160.87504" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><path d="M 202.04166 196.77778 C 202.04166 201.97759 202.04166 208.42697 202.04166 215.09726" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><path d="M 202.04166 276.22223 L 264.70833 301.22223 L 202.04166 326.22223 L 139.37499 301.22223 Z" fill="#ffff6c"/><path d="M 202.04166 276.22223 L 264.70833 301.22223 L 202.04166 326.22223 L 139.37499 301.22223 Z" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(161.29499 288.72223)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="12.905763" y="10" textLength="6.669922">V</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="19.399903" y="10" textLength="54.472656">iew callable </tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="26.707032" y="22" textLength="30.585938">found?</tspan></text><path d="M 202.04166 251 C 202.04166 256.19981 202.04166 262.6492 202.04166 269.31949" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><rect x="327.47912" y="286.72223" width="156.62497" height="29" fill="#fec0c1"/><rect x="327.47912" y="286.72223" width="156.62497" height="29" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(332.47912 295.22223)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="10.89061" y="10" textLength="49.472656">Return the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="60.363266" y="10" textLength="59.42871">Not Found V</tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="119.616196" y="10" textLength="16.118164">iew</tspan></text><path d="M 265.20833 301.22223 C 297.4314 301.22223 294.2168 301.22223 320.5783 301.22223" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(288.07626 286.8889)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" fill="black" x=".33007812" y="11" textLength="15.339844">No</tspan></text><path d="M 202.04165 360.44447 L 280.35414 398.8889 L 202.04165 437.33333 L 123.72917 398.8889 Z" fill="#ffff6c"/><path d="M 202.04165 360.44447 L 280.35414 398.8889 L 202.04165 437.33333 L 123.72917 398.8889 Z" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(149.87354 380.12)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="16.495594" y="10" textLength="77.25586">Current user has </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x=".9462776" y="22" textLength="62.773438">authorization</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="63.719715" y="22" textLength="45.581055"> to invoke </tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="14.26659" y="34" textLength="78.935547">the view callable?</tspan></text><path d="M 202.04165 326.72223 C 202.04165 332.1894 202.04165 344.2467 202.04165 353.54354" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(176.70832 334.24978)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" fill="black" x=".21191406" y="11" textLength="8.0039062">Y</tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" fill="black" x="7.114258" y="11" textLength="12.673828">es</tspan></text><path d="M 202.04165 437.33333 C 202.04165 442.81278 202.04166 455.21977 202.04166 464.65762" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(180.11595 444)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" x=".21191406" y="11" textLength="8.0039062">Y</tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="7.114258" y="11" textLength="12.673828">es</tspan></text><rect x="327.47912" y="384.38889" width="156.62497" height="29" fill="#fec0c1"/><rect x="327.47912" y="384.38889" width="156.62497" height="29" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(332.47912 392.88889)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="11.439926" y="10" textLength="49.472656">Return the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="60.912582" y="10" textLength="58.330078">Forbidden V</tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="119.06688" y="10" textLength="16.118164">iew</tspan></text><path d="M 280.85417 398.88889 C 312.9685 398.88889 296.55343 398.88889 320.57617 398.88889" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(296.21563 384.55555)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" x=".33007812" y="11" textLength="15.339844">No</tspan></text><rect x="104.416667" y="471.55558" width="195.24998" height="29" fill="#ffff6c"/><rect x="104.416667" y="471.55558" width="195.24998" height="29" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(109.416667 474.05558)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="36.201653" y="10" textLength="48.920898">Invoke the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="85.12255" y="10" textLength="61.14746">view callable</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="146.27001" y="10" textLength="2.7783203">,</tspan><tspan font-family="Helvetica" font-size="10" font-weight="500" x="35.100578" y="22" textLength="70.585938">which returns a </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="105.686516" y="22" textLength="44.46289">response</tspan></text><rect x="104.416667" y="528.77776" width="195.24998" height="29" fill="#dfbeff"/><rect x="104.416667" y="528.77776" width="195.24998" height="29" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(109.416667 537.27776)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="45.65722" y="10" textLength="49.472656">Return the </tspan><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="95.129875" y="10" textLength="44.46289">response</tspan></text><path d="M 202.04166 501.05558 C 202.04166 506.35088 202.04166 514.3792 202.04166 521.8749" marker-end="url(#SharpArrow_Marker)" stroke="#191919" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/></g></g></svg>
diff --git a/docs/_themes b/docs/_themes
deleted file mode 160000
-Subproject 3bec9280a6cedb15e97e5899021aa8d723c2538
diff --git a/docs/api/config.rst b/docs/api/config.rst
index 48dd2f0b9..ae913d32c 100644
--- a/docs/api/config.rst
+++ b/docs/api/config.rst
@@ -132,3 +132,8 @@
are being used.
.. autoclass:: not_
+
+.. attribute:: PHASE0_CONFIG
+.. attribute:: PHASE1_CONFIG
+.. attribute:: PHASE2_CONFIG
+.. attribute:: PHASE3_CONFIG
diff --git a/docs/api/exceptions.rst b/docs/api/exceptions.rst
index 0c630571f..faca0fbb6 100644
--- a/docs/api/exceptions.rst
+++ b/docs/api/exceptions.rst
@@ -5,14 +5,14 @@
.. automodule:: pyramid.exceptions
- .. autoclass:: BadCSRFToken
+ .. autoexception:: BadCSRFToken
- .. autoclass:: PredicateMismatch
+ .. autoexception:: PredicateMismatch
- .. autoclass:: Forbidden
+ .. autoexception:: Forbidden
- .. autoclass:: NotFound
+ .. autoexception:: NotFound
- .. autoclass:: ConfigurationError
+ .. autoexception:: ConfigurationError
- .. autoclass:: URLDecodeError
+ .. autoexception:: URLDecodeError
diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst
index b50f10beb..d4cf97f1d 100644
--- a/docs/api/httpexceptions.rst
+++ b/docs/api/httpexceptions.rst
@@ -13,96 +13,96 @@
.. autofunction:: exception_response
- .. autoclass:: HTTPException
+ .. autoexception:: HTTPException
- .. autoclass:: HTTPOk
+ .. autoexception:: HTTPOk
- .. autoclass:: HTTPRedirection
+ .. autoexception:: HTTPRedirection
- .. autoclass:: HTTPError
+ .. autoexception:: HTTPError
- .. autoclass:: HTTPClientError
+ .. autoexception:: HTTPClientError
- .. autoclass:: HTTPServerError
+ .. autoexception:: HTTPServerError
- .. autoclass:: HTTPCreated
+ .. autoexception:: HTTPCreated
- .. autoclass:: HTTPAccepted
+ .. autoexception:: HTTPAccepted
- .. autoclass:: HTTPNonAuthoritativeInformation
+ .. autoexception:: HTTPNonAuthoritativeInformation
- .. autoclass:: HTTPNoContent
+ .. autoexception:: HTTPNoContent
- .. autoclass:: HTTPResetContent
+ .. autoexception:: HTTPResetContent
- .. autoclass:: HTTPPartialContent
+ .. autoexception:: HTTPPartialContent
- .. autoclass:: HTTPMultipleChoices
+ .. autoexception:: HTTPMultipleChoices
- .. autoclass:: HTTPMovedPermanently
+ .. autoexception:: HTTPMovedPermanently
- .. autoclass:: HTTPFound
+ .. autoexception:: HTTPFound
- .. autoclass:: HTTPSeeOther
+ .. autoexception:: HTTPSeeOther
- .. autoclass:: HTTPNotModified
+ .. autoexception:: HTTPNotModified
- .. autoclass:: HTTPUseProxy
+ .. autoexception:: HTTPUseProxy
- .. autoclass:: HTTPTemporaryRedirect
+ .. autoexception:: HTTPTemporaryRedirect
- .. autoclass:: HTTPBadRequest
+ .. autoexception:: HTTPBadRequest
- .. autoclass:: HTTPUnauthorized
+ .. autoexception:: HTTPUnauthorized
- .. autoclass:: HTTPPaymentRequired
+ .. autoexception:: HTTPPaymentRequired
- .. autoclass:: HTTPForbidden
+ .. autoexception:: HTTPForbidden
- .. autoclass:: HTTPNotFound
+ .. autoexception:: HTTPNotFound
- .. autoclass:: HTTPMethodNotAllowed
+ .. autoexception:: HTTPMethodNotAllowed
- .. autoclass:: HTTPNotAcceptable
+ .. autoexception:: HTTPNotAcceptable
- .. autoclass:: HTTPProxyAuthenticationRequired
+ .. autoexception:: HTTPProxyAuthenticationRequired
- .. autoclass:: HTTPRequestTimeout
+ .. autoexception:: HTTPRequestTimeout
- .. autoclass:: HTTPConflict
+ .. autoexception:: HTTPConflict
- .. autoclass:: HTTPGone
+ .. autoexception:: HTTPGone
- .. autoclass:: HTTPLengthRequired
+ .. autoexception:: HTTPLengthRequired
- .. autoclass:: HTTPPreconditionFailed
+ .. autoexception:: HTTPPreconditionFailed
- .. autoclass:: HTTPRequestEntityTooLarge
+ .. autoexception:: HTTPRequestEntityTooLarge
- .. autoclass:: HTTPRequestURITooLong
+ .. autoexception:: HTTPRequestURITooLong
- .. autoclass:: HTTPUnsupportedMediaType
+ .. autoexception:: HTTPUnsupportedMediaType
- .. autoclass:: HTTPRequestRangeNotSatisfiable
+ .. autoexception:: HTTPRequestRangeNotSatisfiable
- .. autoclass:: HTTPExpectationFailed
+ .. autoexception:: HTTPExpectationFailed
- .. autoclass:: HTTPUnprocessableEntity
+ .. autoexception:: HTTPUnprocessableEntity
- .. autoclass:: HTTPLocked
+ .. autoexception:: HTTPLocked
- .. autoclass:: HTTPFailedDependency
+ .. autoexception:: HTTPFailedDependency
- .. autoclass:: HTTPInternalServerError
+ .. autoexception:: HTTPInternalServerError
- .. autoclass:: HTTPNotImplemented
+ .. autoexception:: HTTPNotImplemented
- .. autoclass:: HTTPBadGateway
+ .. autoexception:: HTTPBadGateway
- .. autoclass:: HTTPServiceUnavailable
+ .. autoexception:: HTTPServiceUnavailable
- .. autoclass:: HTTPGatewayTimeout
+ .. autoexception:: HTTPGatewayTimeout
- .. autoclass:: HTTPVersionNotSupported
+ .. autoexception:: HTTPVersionNotSupported
- .. autoclass:: HTTPInsufficientStorage
+ .. autoexception:: HTTPInsufficientStorage
diff --git a/docs/api/index.rst b/docs/api/index.rst
new file mode 100644
index 000000000..cb38aa0b2
--- /dev/null
+++ b/docs/api/index.rst
@@ -0,0 +1,12 @@
+.. _html_api_documentation:
+
+API Documentation
+=================
+
+Comprehensive reference material for every public API exposed by :app:`Pyramid`:
+
+.. toctree::
+ :maxdepth: 1
+ :glob:
+
+ *
diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst
index d8d935afd..de2a664a4 100644
--- a/docs/api/interfaces.rst
+++ b/docs/api/interfaces.rst
@@ -56,6 +56,9 @@ Other Interfaces
.. autointerface:: IRenderer
:members:
+ .. autointerface:: IResponseFactory
+ :members:
+
.. autointerface:: IViewMapperFactory
:members:
@@ -86,3 +89,5 @@ Other Interfaces
.. autointerface:: IResourceURL
:members:
+ .. autointerface:: ICacheBuster
+ :members:
diff --git a/docs/api/registry.rst b/docs/api/registry.rst
index bab3e26ba..57a80b3f5 100644
--- a/docs/api/registry.rst
+++ b/docs/api/registry.rst
@@ -14,6 +14,18 @@
accessed as ``request.registry.settings`` or
``config.registry.settings`` in a typical Pyramid application.
+ .. attribute:: package_name
+
+ .. versionadded:: 1.6
+
+ When a registry is set up (or created) by a :term:`Configurator`, this
+ attribute will be the shortcut for
+ :attr:`pyramid.config.Configurator.package_name`.
+
+ This attribute is often accessed as ``request.registry.package_name`` or
+ ``config.registry.package_name`` or ``config.package_name``
+ in a typical Pyramid application.
+
.. attribute:: introspector
.. versionadded:: 1.3
diff --git a/docs/api/request.rst b/docs/api/request.rst
index 77d80f6d6..105ffb5a7 100644
--- a/docs/api/request.rst
+++ b/docs/api/request.rst
@@ -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
@@ -167,37 +167,40 @@
.. versionadded:: 1.5
- A property which returns the userid of the currently authenticated user
- or ``None`` if there is no :term:`authentication policy` in effect or
- there is no currently authenticated user. This differs from
- :attr:`~pyramid.request.Request.unauthenticated_userid`, because the
- effective authentication policy will have ensured that a record
- associated with the userid exists in persistent storage; if it has
- not, this value will be ``None``.
+ A property which returns the :term:`userid` of the currently
+ authenticated user or ``None`` if there is no :term:`authentication
+ policy` in effect or there is no currently authenticated user. This
+ differs from :attr:`~pyramid.request.Request.unauthenticated_userid`,
+ because the effective authentication policy will have ensured that a
+ record associated with the :term:`userid` exists in persistent storage;
+ if it has not, this value will be ``None``.
.. attribute:: unauthenticated_userid
.. versionadded:: 1.5
A property which returns a value which represents the *claimed* (not
- verified) user id of the credentials present in the request. ``None`` if
- there is no :term:`authentication policy` in effect or there is no user
- data associated with the current request. This differs from
- :attr:`~pyramid.request.Request.authenticated_userid`, because the
- effective authentication policy will not ensure that a record associated
- with the userid exists in persistent storage. Even if the userid
- does not exist in persistent storage, this value will be the value
- of the userid *claimed* by the request data.
+ verified) :term:`userid` of the credentials present in the
+ request. ``None`` if there is no :term:`authentication policy` in effect
+ or there is no user data associated with the current request. This
+ differs from :attr:`~pyramid.request.Request.authenticated_userid`,
+ because the effective authentication policy will not ensure that a
+ record associated with the :term:`userid` exists in persistent storage.
+ Even if the :term:`userid` does not exist in persistent storage, this
+ value will be the value of the :term:`userid` *claimed* by the request
+ data.
.. attribute:: effective_principals
.. versionadded:: 1.5
A property which returns the list of 'effective' :term:`principal`
- identifiers for this request. This will include the userid of the
- currently authenticated user if a user is currently authenticated. If no
- :term:`authentication policy` is in effect, this will return a sequence
- containing only the :attr:`pyramid.security.Everyone` principal.
+ identifiers for this request. This list typically includes the
+ :term:`userid` of the currently authenticated user if a user is
+ currently authenticated, but this depends on the
+ :term:`authentication policy` in effect. If no :term:`authentication
+ policy` is in effect, this will return a sequence containing only the
+ :attr:`pyramid.security.Everyone` principal.
.. method:: invoke_subrequest(request, use_tweens=False)
@@ -366,3 +369,4 @@
that used as ``request.GET``, ``request.POST``, and ``request.params``),
see :class:`pyramid.interfaces.IMultiDict`.
+.. autofunction:: apply_request_extensions(request)
diff --git a/docs/api/security.rst b/docs/api/security.rst
index 814b68e5a..88086dbbf 100644
--- a/docs/api/security.rst
+++ b/docs/api/security.rst
@@ -16,7 +16,7 @@ Authentication API Functions
.. autofunction:: forget
-.. autofunction:: remember
+.. autofunction:: remember(request, userid, **kwargs)
Authorization API Functions
---------------------------
diff --git a/docs/api/session.rst b/docs/api/session.rst
index dde9d20e9..474e2bb32 100644
--- a/docs/api/session.rst
+++ b/docs/api/session.rst
@@ -17,4 +17,5 @@
.. autofunction:: BaseCookieSessionFactory
+ .. autoclass:: PickleSerializer
diff --git a/docs/api/static.rst b/docs/api/static.rst
index c28473584..f3727e197 100644
--- a/docs/api/static.rst
+++ b/docs/api/static.rst
@@ -9,3 +9,11 @@
:members:
:inherited-members:
+ .. autoclass:: ManifestCacheBuster
+ :members:
+
+ .. autoclass:: QueryStringCacheBuster
+ :members:
+
+ .. autoclass:: QueryStringConstantCacheBuster
+ :members:
diff --git a/docs/conf.py b/docs/conf.py
index 4bc8e2172..a895bc6c3 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -20,6 +20,7 @@ import warnings
warnings.simplefilter('ignore', DeprecationWarning)
import pkg_resources
+import pylons_sphinx_themes
# skip raw nodes
from sphinx.writers.text import TextTranslator
@@ -52,42 +53,32 @@ extensions = [
'sphinx.ext.doctest',
'repoze.sphinx.autointerface',
'sphinx.ext.viewcode',
- 'sphinx.ext.intersphinx'
+ 'sphinx.ext.intersphinx',
+ 'sphinxcontrib.programoutput',
+ # enable pylons_sphinx_latesturl when this branch is no longer "latest"
+ # 'pylons_sphinx_latesturl',
]
# Looks for objects in external projects
intersphinx_mapping = {
- 'tutorials': ('http://docs.pylonsproject.org/projects/pyramid-tutorials/en/latest/', None),
+ 'colander': ('http://docs.pylonsproject.org/projects/colander/en/latest', None),
'cookbook': ('http://docs.pylonsproject.org/projects/pyramid-cookbook/en/latest/', None),
+ 'deform': ('http://docs.pylonsproject.org/projects/deform/en/latest', None),
'jinja2': ('http://docs.pylonsproject.org/projects/pyramid-jinja2/en/latest/', None),
- 'tm': (
- 'http://docs.pylonsproject.org/projects/pyramid_tm/en/latest/',
- None,
- ),
- 'zcomponent': ('http://docs.zope.org/zope.component', None),
- 'webtest': ('http://webtest.pythonpaste.org/en/latest', None),
- 'webob': ('http://docs.webob.org/en/latest', None),
- 'colander': (
- 'http://docs.pylonsproject.org/projects/colander/en/latest',
- None),
- 'deform': (
- 'http://docs.pylonsproject.org/projects/deform/en/latest',
- None),
- 'sqla': ('http://docs.sqlalchemy.org/en/latest', None),
- 'who': ('http://docs.repoze.org/who/latest', None),
+ 'pylonswebframework': ('http://docs.pylonsproject.org/projects/pylons-webframework/en/latest/', None),
'python': ('http://docs.python.org', None),
'python3': ('http://docs.python.org/3', None),
- 'tstring':
- ('http://docs.pylonsproject.org/projects/translationstring/en/latest',
- None),
- 'venusian':
- ('http://docs.pylonsproject.org/projects/venusian/en/latest', None),
- 'toolbar':
- ('http://docs.pylonsproject.org/projects/pyramid-debugtoolbar/en/latest',
- None),
- 'zcml':
- ('http://docs.pylonsproject.org/projects/pyramid-zcml/en/latest',
- None),
+ 'sqla': ('http://docs.sqlalchemy.org/en/latest', None),
+ 'tm': ('http://docs.pylonsproject.org/projects/pyramid-tm/en/latest/', None),
+ 'toolbar': ('http://docs.pylonsproject.org/projects/pyramid-debugtoolbar/en/latest', None),
+ 'tstring': ('http://docs.pylonsproject.org/projects/translationstring/en/latest', None),
+ 'tutorials': ('http://docs.pylonsproject.org/projects/pyramid-tutorials/en/latest/', None),
+ 'venusian': ('http://docs.pylonsproject.org/projects/venusian/en/latest', None),
+ 'webob': ('http://docs.webob.org/en/latest', None),
+ 'webtest': ('http://webtest.pythonpaste.org/en/latest', None),
+ 'who': ('http://repozewho.readthedocs.org/en/latest', None),
+ 'zcml': ('http://docs.pylonsproject.org/projects/pyramid-zcml/en/latest', None),
+ 'zcomponent': ('http://docs.zope.org/zope.component', None),
}
@@ -135,31 +126,30 @@ if book:
# Options for HTML output
# -----------------------
+# enable pylons_sphinx_latesturl when this branch is no longer "latest"
+# pylons_sphinx_latesturl_base = (
+# 'http://docs.pylonsproject.org/projects/pyramid/en/latest/')
+# pylons_sphinx_latesturl_pagename_overrides = {
+# # map old pagename -> new pagename
+# 'whatsnew-1.0': 'index',
+# 'whatsnew-1.1': 'index',
+# 'whatsnew-1.2': 'index',
+# 'whatsnew-1.3': 'index',
+# 'whatsnew-1.4': 'index',
+# 'whatsnew-1.5': 'index',
+# 'tutorials/gae/index': 'index',
+# 'api/chameleon_text': 'api',
+# 'api/chameleon_zpt': 'api',
+# }
-# Add and use Pylons theme
-if 'sphinx-build' in ' '.join(sys.argv): # protect against dumb importers
- from subprocess import call, Popen, PIPE
- cwd = os.getcwd()
- p = Popen('which git', shell=True, stdout=PIPE)
- here = os.path.abspath(os.path.dirname(__file__))
- parent = os.path.abspath(os.path.dirname(here))
- _themes = os.path.join(here, '_themes')
- git = p.stdout.read().strip()
- try:
- os.chdir(parent)
- if not os.listdir(_themes):
- call([git, 'submodule', '--init'])
- else:
- call([git, 'submodule', 'update'])
- sys.path.append(_themes)
- finally:
- os.chdir(cwd)
-
-html_theme_path = ['_themes']
html_theme = 'pyramid'
+html_theme_path = pylons_sphinx_themes.get_html_themes_path()
html_theme_options = dict(
github_url='https://github.com/Pylons/pyramid',
+ # on master branch true, else false
in_progress='true',
+ # on previous branches/major releases true, else false
+ outdated='false',
)
# The name for this set of Sphinx documents. If None, it defaults to
diff --git a/docs/conventions.rst b/docs/conventions.rst
index 21b506623..a9d2550bf 100644
--- a/docs/conventions.rst
+++ b/docs/conventions.rst
@@ -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::
@@ -24,7 +24,7 @@ We present Python method names using the following style:
:meth:`pyramid.config.Configurator.add_view`
-We present Python class names, module names, attributes and global
+We present Python class names, module names, attributes, and global
variables using the following style:
:class:`pyramid.config.Configurator.registry`
@@ -105,10 +105,10 @@ 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.
-* Adding/removing imported objects from the package is quicker and results
+* Adding or removing imported objects from the package is quicker and results
in simpler diffs.
diff --git a/docs/copyright.rst b/docs/copyright.rst
index 980335827..3beaee7f7 100644
--- a/docs/copyright.rst
+++ b/docs/copyright.rst
@@ -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
@@ -89,14 +89,14 @@ Contacting The Publisher
Please send documentation licensing inquiries, translation inquiries,
and other business communications to `Agendaless Consulting
<mailto:webmaster@agendaless.com>`_. 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
diff --git a/docs/designdefense.rst b/docs/designdefense.rst
index 1ed4f65a4..28da84368 100644
--- a/docs/designdefense.rst
+++ b/docs/designdefense.rst
@@ -7,98 +7,94 @@ From time to time, challenges to various aspects of :app:`Pyramid` design are
lodged. To give context to discussions that follow, we detail some of the
design decisions and trade-offs here. In some cases, we acknowledge that the
framework can be made better and we describe future steps which will be taken
-to improve it; in some cases we just file the challenge as noted, as
-obviously you can't please everyone all of the time.
+to improve it. In others we just file the challenge as noted, as obviously you
+can't please everyone all of the time.
Pyramid Provides More Than One Way to Do It
-------------------------------------------
A canon of Python popular culture is "TIOOWTDI" ("there is only one way to do
-it", a slighting, tongue-in-cheek reference to Perl's "TIMTOWTDI", which is
-an acronym for "there is more than one way to do it").
-
-:app:`Pyramid` is, for better or worse, a "TIMTOWTDI" system. For example,
-it includes more than one way to resolve a URL to a :term:`view callable`:
-via :term:`url dispatch` or :term:`traversal`. Multiple methods of
-configuration exist: :term:`imperative configuration`, :term:`configuration
-decoration`, and :term:`ZCML` (optionally via :term:`pyramid_zcml`). It works
-with multiple different kinds of persistence and templating systems. And so
-on. However, the existence of most of these overlapping ways to do things
-are not without reason and purpose: we have a number of audiences to serve,
-and we believe that TIMTOWTI at the web framework level actually *prevents* a
-much more insidious and harmful set of duplication at higher levels in the
-Python web community.
-
-:app:`Pyramid` began its life as :mod:`repoze.bfg`, written by a team of
-people with many years of prior :term:`Zope` experience. The idea of
+it", a slighting, tongue-in-cheek reference to Perl's "TIMTOWTDI", which is an
+acronym for "there is more than one way to do it").
+
+:app:`Pyramid` is, for better or worse, a "TIMTOWTDI" system. For example, it
+includes more than one way to resolve a URL to a :term:`view callable`: via
+:term:`url dispatch` or :term:`traversal`. Multiple methods of configuration
+exist: :term:`imperative configuration`, :term:`configuration decoration`, and
+:term:`ZCML` (optionally via :term:`pyramid_zcml`). It works with multiple
+different kinds of persistence and templating systems. And so on. However, the
+existence of most of these overlapping ways to do things are not without reason
+and purpose: we have a number of audiences to serve, and we believe that
+TIMTOWTDI at the web framework level actually *prevents* a much more insidious
+and harmful set of duplication at higher levels in the Python web community.
+
+:app:`Pyramid` began its life as :mod:`repoze.bfg`, written by a team of people
+with many years of prior :term:`Zope` experience. The idea of
:term:`traversal` and the way :term:`view lookup` works was stolen entirely
from Zope. The authorization subsystem provided by :app:`Pyramid` is a
derivative of Zope's. The idea that an application can be *extended* without
forking is also a Zope derivative.
Implementations of these features were *required* to allow the :app:`Pyramid`
-authors to build the bread-and-butter CMS-type systems for customers in the
-way in which they were accustomed. No other system, save for Zope itself,
-had such features, and Zope itself was beginning to show signs of its age.
-We were becoming hampered by consequences of its early design mistakes.
-Zope's lack of documentation was also difficult to work around: it was hard
-to hire smart people to work on Zope applications, because there was no
-comprehensive documentation set to point them at which explained "it all" in
-one consumable place, and it was too large and self-inconsistent to document
-properly. Before :mod:`repoze.bfg` went under development, its authors
-obviously looked around for other frameworks that fit the bill. But no
-non-Zope framework did. So we embarked on building :mod:`repoze.bfg`.
+authors to build the bread-and-butter CMS-type systems for customers in the way
+in which they were accustomed. No other system, save for Zope itself, had such
+features, and Zope itself was beginning to show signs of its age. We were
+becoming hampered by consequences of its early design mistakes. Zope's lack of
+documentation was also difficult to work around. It was hard to hire smart
+people to work on Zope applications because there was no comprehensive
+documentation set which explained "it all" in one consumable place, and it was
+too large and self-inconsistent to document properly. Before :mod:`repoze.bfg`
+went under development, its authors obviously looked around for other
+frameworks that fit the bill. But no non-Zope framework did. So we embarked on
+building :mod:`repoze.bfg`.
As the result of our research, however, it became apparent that, despite the
-fact that no *one* framework had all the features we required, lots of
-existing frameworks had good, and sometimes very compelling ideas. In
-particular, :term:`URL dispatch` is a more direct mechanism to map URLs to
-code.
+fact that no *one* framework had all the features we required, lots of existing
+frameworks had good, and sometimes very compelling ideas. In particular,
+:term:`URL dispatch` is a more direct mechanism to map URLs to code.
So, although we couldn't find a framework, save for Zope, that fit our needs,
and while we incorporated a lot of Zope ideas into BFG, we also emulated the
features we found compelling in other frameworks (such as :term:`url
-dispatch`). After the initial public release of BFG, as time went on,
-features were added to support people allergic to various Zope-isms in the
-system, such as the ability to configure the application using
-:term:`imperative configuration` and :term:`configuration decoration` rather
-than solely using :term:`ZCML`, and the elimination of the required use of
-:term:`interface` objects. It soon became clear that we had a system that
-was very generic, and was beginning to appeal to non-Zope users as well as
-ex-Zope users.
+dispatch`). After the initial public release of BFG, as time went on, features
+were added to support people allergic to various Zope-isms in the system, such
+as the ability to configure the application using :term:`imperative
+configuration` and :term:`configuration decoration`, rather than solely using
+:term:`ZCML`, and the elimination of the required use of :term:`interface`
+objects. It soon became clear that we had a system that was very generic, and
+was beginning to appeal to non-Zope users as well as ex-Zope users.
As the result of this generalization, it became obvious BFG shared 90% of its
-featureset with the featureset of Pylons 1, and thus had a very similar
-target market. Because they were so similar, choosing between the two
-systems was an exercise in frustration for an otherwise non-partisan
-developer. It was also strange for the Pylons and BFG development
-communities to be in competition for the same set of users, given how similar
-the two frameworks were. So the Pylons and BFG teams began to work together
-to form a plan to merge. The features missing from BFG (notably :term:`view
-handler` classes, flash messaging, and other minor missing bits), were added,
-to provide familiarity to ex-Pylons users. The result is :app:`Pyramid`.
-
-The Python web framework space is currently notoriously balkanized. We're
-truly hoping that the amalgamation of components in :app:`Pyramid` will
-appeal to at least two currently very distinct sets of users: Pylons and BFG
-users. By unifying the best concepts from Pylons and BFG into a single
-codebase and leaving the bad concepts from their ancestors behind, we'll be
-able to consolidate our efforts better, share more code, and promote our
-efforts as a unit rather than competing pointlessly. We hope to be able to
-shortcut the pack mentality which results in a *much larger* duplication of
-effort, represented by competing but incredibly similar applications and
-libraries, each built upon a specific low level stack that is incompatible
-with the other. We'll also shrink the choice of credible Python web
-frameworks down by at least one. We're also hoping to attract users from
-other communities (such as Zope's and TurboGears') by providing the features
-they require, while allowing enough flexibility to do things in a familiar
-fashion. Some overlap of functionality to achieve these goals is expected
-and unavoidable, at least if we aim to prevent pointless duplication at
-higher levels. If we've done our job well enough, the various audiences will
-be able to coexist and cooperate rather than firing at each other across some
-imaginary web framework DMZ.
-
-Pyramid Uses A Zope Component Architecture ("ZCA") Registry
+feature set with the feature set of Pylons 1, and thus had a very similar
+target market. Because they were so similar, choosing between the two systems
+was an exercise in frustration for an otherwise non-partisan developer. It was
+also strange for the Pylons and BFG development communities to be in
+competition for the same set of users, given how similar the two frameworks
+were. So the Pylons and BFG teams began to work together to form a plan to
+merge. The features missing from BFG (notably :term:`view handler` classes,
+flash messaging, and other minor missing bits), were added to provide
+familiarity to ex-Pylons users. The result is :app:`Pyramid`.
+
+The Python web framework space is currently notoriously balkanized. We're truly
+hoping that the amalgamation of components in :app:`Pyramid` will appeal to at
+least two currently very distinct sets of users: Pylons and BFG users. By
+unifying the best concepts from Pylons and BFG into a single codebase, and
+leaving the bad concepts from their ancestors behind, we'll be able to
+consolidate our efforts better, share more code, and promote our efforts as a
+unit rather than competing pointlessly. We hope to be able to shortcut the pack
+mentality which results in a *much larger* duplication of effort, represented
+by competing but incredibly similar applications and libraries, each built upon
+a specific low level stack that is incompatible with the other. We'll also
+shrink the choice of credible Python web frameworks down by at least one. We're
+also hoping to attract users from other communities (such as Zope's and
+TurboGears') by providing the features they require, while allowing enough
+flexibility to do things in a familiar fashion. Some overlap of functionality
+to achieve these goals is expected and unavoidable, at least if we aim to
+prevent pointless duplication at higher levels. If we've done our job well
+enough, the various audiences will be able to coexist and cooperate rather than
+firing at each other across some imaginary web framework DMZ.
+
+Pyramid Uses a Zope Component Architecture ("ZCA") Registry
-----------------------------------------------------------
:app:`Pyramid` uses a :term:`Zope Component Architecture` (ZCA) "component
@@ -146,7 +142,7 @@ dictionary API, but that's not very important in this context. That's
problem number two.
Third of all, what does the ``getUtility`` function do? It's performing a
-lookup for the ``ISettings`` "utility" that should return.. well, a utility.
+lookup for the ``ISettings`` "utility" that should return... well, a utility.
Note how we've already built up a dependency on the understanding of an
:term:`interface` and the concept of "utility" to answer this question: a bad
sign so far. Note also that the answer is circular, a *really* bad sign.
@@ -156,12 +152,12 @@ registry" of course. What's a component registry? Problem number four.
Fifth, assuming you buy that there's some magical registry hanging around,
where *is* this registry? *Homina homina*... "around"? That's sort of the
-best answer in this context (a more specific answer would require knowledge
-of internals). Can there be more than one registry? Yes. So *which*
-registry does it find the registration in? Well, the "current" registry of
-course. In terms of :app:`Pyramid`, the current registry is a thread local
-variable. Using an API that consults a thread local makes understanding how
-it works non-local.
+best answer in this context (a more specific answer would require knowledge of
+internals). Can there be more than one registry? Yes. So in *which* registry
+does it find the registration? Well, the "current" registry of course. In
+terms of :app:`Pyramid`, the current registry is a thread local variable.
+Using an API that consults a thread local makes understanding how it works
+non-local.
You've now bought in to the fact that there's a registry that is just hanging
around. But how does the registry get populated? Why, via code that calls
@@ -170,20 +166,20 @@ registration of ``ISettings`` is made by the framework itself under the hood:
it's not present in any user configuration. This is extremely hard to
comprehend. Problem number six.
-Clearly there's some amount of cognitive load here that needs to be borne by
-a reader of code that extends the :app:`Pyramid` framework due to its use of
-the ZCA, even if he or she is already an expert Python programmer and whom is
-an expert in the domain of web applications. This is suboptimal.
+Clearly there's some amount of cognitive load here that needs to be borne by a
+reader of code that extends the :app:`Pyramid` framework due to its use of the
+ZCA, even if they are already an expert Python programmer and an expert in the
+domain of web applications. This is suboptimal.
Ameliorations
+++++++++++++
First, the primary amelioration: :app:`Pyramid` *does not expect application
-developers to understand ZCA concepts or any of its APIs*. If an
-*application* developer needs to understand a ZCA concept or API during the
-creation of a :app:`Pyramid` application, we've failed on some axis.
+developers to understand ZCA concepts or any of its APIs*. If an *application*
+developer needs to understand a ZCA concept or API during the creation of a
+:app:`Pyramid` application, we've failed on some axis.
-Instead, the framework hides the presence of the ZCA registry behind
+Instead the framework hides the presence of the ZCA registry behind
special-purpose API functions that *do* use ZCA APIs. Take for example the
``pyramid.security.authenticated_userid`` function, which returns the userid
present in the current request or ``None`` if no userid is present in the
@@ -195,10 +191,9 @@ current request. The application developer calls it like so:
from pyramid.security import authenticated_userid
userid = authenticated_userid(request)
-He now has the current user id.
+They now have the current user id.
-Under its hood however, the implementation of ``authenticated_userid``
-is this:
+Under its hood however, the implementation of ``authenticated_userid`` is this:
.. code-block:: python
:linenos:
@@ -215,58 +210,56 @@ is this:
return policy.authenticated_userid(request)
Using such wrappers, we strive to always hide the ZCA API from application
-developers. Application developers should just never know about the ZCA API:
-they should call a Python function with some object germane to the domain as
-an argument, and it should return a result. A corollary that follows is
-that any reader of an application that has been written using :app:`Pyramid`
-needn't understand the ZCA API either.
+developers. Application developers should just never know about the ZCA API;
+they should call a Python function with some object germane to the domain as an
+argument, and it should return a result. A corollary that follows is that any
+reader of an application that has been written using :app:`Pyramid` needn't
+understand the ZCA API either.
Hiding the ZCA API from application developers and code readers is a form of
enhancing domain specificity. No application developer wants to need to
-understand the small, detailed mechanics of how a web framework does its
-thing. People want to deal in concepts that are closer to the domain they're
-working in: for example, web developers want to know about *users*, not
-*utilities*. :app:`Pyramid` uses the ZCA as an implementation detail, not as
-a feature which is exposed to end users.
+understand the small, detailed mechanics of how a web framework does its thing.
+People want to deal in concepts that are closer to the domain they're working
+in. For example, web developers want to know about *users*, not *utilities*.
+:app:`Pyramid` uses the ZCA as an implementation detail, not as a feature which
+is exposed to end users.
However, unlike application developers, *framework developers*, including
people who want to override :app:`Pyramid` functionality via preordained
-framework plugpoints like traversal or view lookup *must* understand the ZCA
+framework plugpoints like traversal or view lookup, *must* understand the ZCA
registry API.
:app:`Pyramid` framework developers were so concerned about conceptual load
-issues of the ZCA registry API for framework developers that a `replacement
-registry implementation <https://github.com/repoze/repoze.component>`_
-named :mod:`repoze.component` was actually developed. Though this package
-has a registry implementation which is fully functional and well-tested, and
-its API is much nicer than the ZCA registry API, work on it was largely
-abandoned and it is not used in :app:`Pyramid`. We continued to use a ZCA
-registry within :app:`Pyramid` because it ultimately proved a better fit.
+issues of the ZCA registry API that a `replacement registry implementation
+<https://github.com/repoze/repoze.component>`_ named :mod:`repoze.component`
+was actually developed. Though this package has a registry implementation
+which is fully functional and well-tested, and its API is much nicer than the
+ZCA registry API, work on it was largely abandoned, and it is not used in
+:app:`Pyramid`. We continued to use a ZCA registry within :app:`Pyramid`
+because it ultimately proved a better fit.
.. note::
- We continued using ZCA registry rather than disusing it in
- favor of using the registry implementation in
- :mod:`repoze.component` largely because the ZCA concept of
- interfaces provides for use of an interface hierarchy, which is
- useful in a lot of scenarios (such as context type inheritance).
- Coming up with a marker type that was something like an interface
- that allowed for this functionality seemed like it was just
- reinventing the wheel.
-
-Making framework developers and extenders understand the ZCA registry API is
-a trade-off. We (the :app:`Pyramid` developers) like the features that the
-ZCA registry gives us, and we have long-ago borne the weight of understanding
-what it does and how it works. The authors of :app:`Pyramid` understand the
-ZCA deeply and can read code that uses it as easily as any other code.
+ We continued using ZCA registry rather than disusing it in favor of using
+ the registry implementation in :mod:`repoze.component` largely because the
+ ZCA concept of interfaces provides for use of an interface hierarchy, which
+ is useful in a lot of scenarios (such as context type inheritance). Coming
+ up with a marker type that was something like an interface that allowed for
+ this functionality seemed like it was just reinventing the wheel.
+
+Making framework developers and extenders understand the ZCA registry API is a
+trade-off. We (the :app:`Pyramid` developers) like the features that the ZCA
+registry gives us, and we have long-ago borne the weight of understanding what
+it does and how it works. The authors of :app:`Pyramid` understand the ZCA
+deeply and can read code that uses it as easily as any other code.
But we recognize that developers who might want to extend the framework are not
-as comfortable with the ZCA registry API as the original developers are with
-it. So, for the purposes of being kind to third-party :app:`Pyramid`
-framework developers in, we've drawn some lines in the sand.
+as comfortable with the ZCA registry API as the original developers. So for
+the purpose of being kind to third-party :app:`Pyramid` framework developers,
+we've drawn some lines in the sand.
-In all core code, We've made use of ZCA global API functions such as
-``zope.component.getUtility`` and ``zope.component.getAdapter`` the exception
+In all core code, we've made use of ZCA global API functions, such as
+``zope.component.getUtility`` and ``zope.component.getAdapter``, the exception
instead of the rule. So instead of:
.. code-block:: python
@@ -286,9 +279,9 @@ instead of the rule. So instead of:
registry = get_current_registry()
policy = registry.getUtility(IAuthenticationPolicy)
-While the latter is more verbose, it also arguably makes it more obvious
-what's going on. All of the :app:`Pyramid` core code uses this pattern
-rather than the ZCA global API.
+While the latter is more verbose, it also arguably makes it more obvious what's
+going on. All of the :app:`Pyramid` core code uses this pattern rather than
+the ZCA global API.
Rationale
+++++++++
@@ -313,13 +306,12 @@ the ZCA registry:
view that is only found when the context is some class of object, or when
the context implements some :term:`interface`.
-- Singularity. There's only one place where "application configuration"
- lives in a :app:`Pyramid` application: in a component registry. The
- component registry answers questions made to it by the framework at runtime
- based on the configuration of *an application*. Note: "an application" is
- not the same as "a process", multiple independently configured copies of
- the same :app:`Pyramid` application are capable of running in the same
- process space.
+- Singularity. There's only one place where "application configuration" lives
+ in a :app:`Pyramid` application: in a component registry. The component
+ registry answers questions made to it by the framework at runtime based on
+ the configuration of *an application*. Note: "an application" is not the
+ same as "a process"; multiple independently configured copies of the same
+ :app:`Pyramid` application are capable of running in the same process space.
- Composability. A ZCA component registry can be populated imperatively, or
there's an existing mechanism to populate a registry via the use of a
@@ -337,10 +329,9 @@ the ZCA registry:
(non-Zope) frameworks.
- Testability. Judicious use of the ZCA registry in framework code makes
- testing that code slightly easier. Instead of using monkeypatching or
- other facilities to register mock objects for testing, we inject
- dependencies via ZCA registrations and then use lookups in the code find
- our mock objects.
+ testing that code slightly easier. Instead of using monkeypatching or other
+ facilities to register mock objects for testing, we inject dependencies via
+ ZCA registrations, then use lookups in the code to find our mock objects.
- Speed. The ZCA registry is very fast for a specific set of complex lookup
scenarios that :app:`Pyramid` uses, having been optimized through the years
@@ -354,17 +345,17 @@ Conclusion
++++++++++
If you only *develop applications* using :app:`Pyramid`, there's not much to
-complain about here. You just should never need to understand the ZCA
-registry API: use documented :app:`Pyramid` APIs instead. However, you may
-be an application developer who doesn't read API documentation because it's
-unmanly. Instead you read the raw source code, and because you haven't read
-the documentation, you don't know what functions, classes, and methods even
-*form* the :app:`Pyramid` API. As a result, you've now written code that
-uses internals and you've painted yourself into a conceptual corner as a
-result of needing to wrestle with some ZCA-using implementation detail. If
-this is you, it's extremely hard to have a lot of sympathy for you. You'll
-either need to get familiar with how we're using the ZCA registry or you'll
-need to use only the documented APIs; that's why we document them as APIs.
+complain about here. You just should never need to understand the ZCA registry
+API; use documented :app:`Pyramid` APIs instead. However, you may be an
+application developer who doesn't read API documentation. Instead you
+read the raw source code, and because you haven't read the API documentation,
+you don't know what functions, classes, and methods even *form* the
+:app:`Pyramid` API. As a result, you've now written code that uses internals,
+and you've painted yourself into a conceptual corner, needing to wrestle with
+some ZCA-using implementation detail. If this is you, it's extremely hard to
+have a lot of sympathy for you. You'll either need to get familiar with how
+we're using the ZCA registry or you'll need to use only the documented APIs;
+that's why we document them as APIs.
If you *extend* or *develop* :app:`Pyramid` (create new directives, use some
of the more obscure hooks as described in :ref:`hooks_chapter`, or work on
@@ -373,6 +364,7 @@ at least some ZCA concepts. In some places it's used unabashedly, and will
be forever. We know it's quirky, but it's also useful and fundamentally
understandable if you take the time to do some reading about it.
+
.. _zcml_encouragement:
Pyramid "Encourages Use of ZCML"
@@ -388,15 +380,16 @@ completely optional. No ZCML is required at all to use :app:`Pyramid`, nor
any other sort of frameworky declarative frontend to application
configuration.
-Pyramid Does Traversal, And I Don't Like Traversal
+
+Pyramid Does Traversal, and I Don't Like Traversal
--------------------------------------------------
In :app:`Pyramid`, :term:`traversal` is the act of resolving a URL path to a
-:term:`resource` object in a resource tree. Some people are uncomfortable
-with this notion, and believe it is wrong. Thankfully, if you use
-:app:`Pyramid`, and you don't want to model your application in terms of a
-resource tree, you needn't use it at all. Instead, use :term:`URL dispatch`
-to map URL paths to views.
+:term:`resource` object in a resource tree. Some people are uncomfortable with
+this notion, and believe it is wrong. Thankfully if you use :app:`Pyramid` and
+you don't want to model your application in terms of a resource tree, you
+needn't use it at all. Instead use :term:`URL dispatch` to map URL paths to
+views.
The idea that some folks believe traversal is unilaterally wrong is
understandable. The people who believe it is wrong almost invariably have
@@ -431,7 +424,8 @@ URL pattern matching.
But the point is ultimately moot. If you don't want to use traversal, you
needn't. Use URL dispatch instead.
-Pyramid Does URL Dispatch, And I Don't Like URL Dispatch
+
+Pyramid Does URL Dispatch, and I Don't Like URL Dispatch
--------------------------------------------------------
In :app:`Pyramid`, :term:`url dispatch` is the act of resolving a URL path to
@@ -453,41 +447,40 @@ I'll argue that URL dispatch is ultimately useful, even if you want to use
traversal as well. You can actually *combine* URL dispatch and traversal in
:app:`Pyramid` (see :ref:`hybrid_chapter`). One example of such a usage: if
you want to emulate something like Zope 2's "Zope Management Interface" UI on
-top of your object graph (or any administrative interface), you can register
-a route like ``config.add_route('manage', '/manage/*traverse')`` and then
-associate "management" views in your code by using the ``route_name``
-argument to a ``view`` configuration,
-e.g. ``config.add_view('.some.callable', context=".some.Resource",
-route_name='manage')``. If you wire things up this way someone then walks up
-to for example, ``/manage/ob1/ob2``, they might be presented with a
-management interface, but walking up to ``/ob1/ob2`` would present them with
-the default object view. There are other tricks you can pull in these hybrid
-configurations if you're clever (and maybe masochistic) too.
-
-Also, if you are a URL dispatch hater, if you should ever be asked to write
-an application that must use some legacy relational database structure, you
-might find that using URL dispatch comes in handy for one-off associations
-between views and URL paths. Sometimes it's just pointless to add a node to
-the object graph that effectively represents the entry point for some bit of
-code. You can just use a route and be done with it. If a route matches, a
-view associated with the route will be called; if no route matches,
-:app:`Pyramid` falls back to using traversal.
+top of your object graph (or any administrative interface), you can register a
+route like ``config.add_route('manage', '/manage/*traverse')`` and then
+associate "management" views in your code by using the ``route_name`` argument
+to a ``view`` configuration, e.g., ``config.add_view('.some.callable',
+context=".some.Resource", route_name='manage')``. If you wire things up this
+way, someone then walks up to, for example, ``/manage/ob1/ob2``, they might be
+presented with a management interface, but walking up to ``/ob1/ob2`` would
+present them with the default object view. There are other tricks you can pull
+in these hybrid configurations if you're clever (and maybe masochistic) too.
+
+Also, if you are a URL dispatch hater, if you should ever be asked to write an
+application that must use some legacy relational database structure, you might
+find that using URL dispatch comes in handy for one-off associations between
+views and URL paths. Sometimes it's just pointless to add a node to the object
+graph that effectively represents the entry point for some bit of code. You
+can just use a route and be done with it. If a route matches, a view
+associated with the route will be called. If no route matches, :app:`Pyramid`
+falls back to using traversal.
But the point is ultimately moot. If you use :app:`Pyramid`, and you really
don't want to use URL dispatch, you needn't use it at all. Instead, use
:term:`traversal` exclusively to map URL paths to views, just like you do in
:term:`Zope`.
+
Pyramid Views Do Not Accept Arbitrary Keyword Arguments
-------------------------------------------------------
Many web frameworks (Zope, TurboGears, Pylons 1.X, Django) allow for their
variant of a :term:`view callable` to accept arbitrary keyword or positional
-arguments, which are filled in using values present in the ``request.POST``
-or ``request.GET`` dictionaries or by values present in the route match
-dictionary. For example, a Django view will accept positional arguments
-which match information in an associated "urlconf" such as
-``r'^polls/(?P<poll_id>\d+)/$``:
+arguments, which are filled in using values present in the ``request.POST``,
+``request.GET``, or route match dictionaries. For example, a Django view will
+accept positional arguments which match information in an associated "urlconf"
+such as ``r'^polls/(?P<poll_id>\d+)/$``:
.. code-block:: python
:linenos:
@@ -495,8 +488,8 @@ which match information in an associated "urlconf" such as
def aview(request, poll_id):
return HttpResponse(poll_id)
-Zope, likewise allows you to add arbitrary keyword and positional
-arguments to any method of a resource object found via traversal:
+Zope likewise allows you to add arbitrary keyword and positional arguments to
+any method of a resource object found via traversal:
.. code-block:: python
:linenos:
@@ -513,13 +506,13 @@ match the names of the positional and keyword arguments in the request, and
the method is called (if possible) with its argument list filled with values
mentioned therein. TurboGears and Pylons 1.X operate similarly.
-Out of the box, :app:`Pyramid` is configured to have none of these features.
-By default, :app:`Pyramid` view callables always accept only ``request`` and
-no other arguments. The rationale: this argument specification matching done
-aggressively can be costly, and :app:`Pyramid` has performance as one of its
-main goals, so we've decided to make people, by default, obtain information
-by interrogating the request object within the view callable body instead of
-providing magic to do unpacking into the view argument list.
+Out of the box, :app:`Pyramid` is configured to have none of these features. By
+default :app:`Pyramid` view callables always accept only ``request`` and no
+other arguments. The rationale is, this argument specification matching when
+done aggressively can be costly, and :app:`Pyramid` has performance as one of
+its main goals. Therefore we've decided to make people, by default, obtain
+information by interrogating the request object within the view callable body
+instead of providing magic to do unpacking into the view argument list.
However, as of :app:`Pyramid` 1.0a9, user code can influence the way view
callables are expected to be called, making it possible to compose a system
@@ -557,7 +550,7 @@ you're building a simple bespoke web application:
sources using :meth:`pyramid.config.Configurator.include`.
- View and subscriber registrations made using :term:`interface` objects
- instead of class objects (e.g. :ref:`using_resource_interfaces`).
+ instead of class objects (e.g., :ref:`using_resource_interfaces`).
- A declarative :term:`authorization` system.
@@ -583,42 +576,41 @@ make unit testing and implementation substitutability easier.
In a bespoke web application, usually there's a single canonical deployment,
and therefore no possibility of multiple code forks. Extensibility is not
-required; the code is just changed in-place. Security requirements are often
-less granular. Using the features listed above will often be overkill for
-such an application.
+required; the code is just changed in place. Security requirements are often
+less granular. Using the features listed above will often be overkill for such
+an application.
If you don't like these features, it doesn't mean you can't or shouldn't use
-:app:`Pyramid`. They are all optional, and a lot of time has been spent
-making sure you don't need to know about them up-front. You can build
-"Pylons-1.X-style" applications using :app:`Pyramid` that are purely bespoke
-by ignoring the features above. You may find these features handy later
-after building a bespoke web application that suddenly becomes popular and
-requires extensibility because it must be deployed in multiple locations.
+:app:`Pyramid`. They are all optional, and a lot of time has been spent making
+sure you don't need to know about them up front. You can build "Pylons 1.X
+style" applications using :app:`Pyramid` that are purely bespoke by ignoring
+the features above. You may find these features handy later after building a
+bespoke web application that suddenly becomes popular and requires
+extensibility because it must be deployed in multiple locations.
Pyramid Is Too Big
------------------
-"The :app:`Pyramid` compressed tarball is larger than 2MB. It must be
-enormous!"
+"The :app:`Pyramid` compressed tarball is larger than 2MB. It must beenormous!"
-No. We just ship it with docs, test code, and scaffolding. Here's a
-breakdown of what's included in subdirectories of the package tree:
+No. We just ship it with docs, test code, and scaffolding. Here's a breakdown
+of what's included in subdirectories of the package tree:
docs/
- 4.9MB
+ 3.6MB
pyramid/tests/
- 2.0MB
+ 1.3MB
pyramid/scaffolds/
- 460KB
+ 133KB
pyramid/ (except for ``pyramd/tests`` and ``pyramid/scaffolds``)
- 844KB
+ 812KB
Of the approximately 34K lines of Python code in the package, the code
that actually has a chance of executing during normal operation, excluding
@@ -638,7 +630,8 @@ dependencies by forcing us to make better packaging decisions. Removing
Chameleon and Mako templating system dependencies in the Pyramid core in 1.5
let us shed most of the remainder of them.
-Pyramid "Cheats" To Obtain Speed
+
+Pyramid "Cheats" to Obtain Speed
--------------------------------
Complaints have been lodged by other web framework authors at various times
@@ -647,10 +640,11 @@ mechanism is our use (transitively) of the C extensions provided by
:mod:`zope.interface` to do fast lookups. Another claimed cheating mechanism
is the religious avoidance of extraneous function calls.
-If there's such a thing as cheating to get better performance, we want to
-cheat as much as possible. We optimize :app:`Pyramid` aggressively. This
-comes at a cost: the core code has sections that could be expressed more
-readably. As an amelioration, we've commented these sections liberally.
+If there's such a thing as cheating to get better performance, we want to cheat
+as much as possible. We optimize :app:`Pyramid` aggressively. This comes at a
+cost. The core code has sections that could be expressed with more readability.
+As an amelioration, we've commented these sections liberally.
+
Pyramid Gets Its Terminology Wrong ("MVC")
------------------------------------------
@@ -663,8 +657,8 @@ existing "MVC" framework uses its terminology. For example, you probably
expect that models are ORM models, controllers are classes that have methods
that map to URLs, and views are templates. :app:`Pyramid` indeed has each of
these concepts, and each probably *works* almost exactly like your existing
-"MVC" web framework. We just don't use the MVC terminology, as we can't
-square its usage in the web framework space with historical reality.
+"MVC" web framework. We just don't use the MVC terminology, as we can't square
+its usage in the web framework space with historical reality.
People very much want to give web applications the same properties as common
desktop GUI platforms by using similar terminology, and to provide some frame
@@ -673,194 +667,189 @@ hang together. But in the opinion of the author, "MVC" doesn't match the web
very well in general. Quoting from the `Model-View-Controller Wikipedia entry
<http://en.wikipedia.org/wiki/Model–view–controller>`_:
-.. code-block:: text
-
- Though MVC comes in different flavors, control flow is generally as
- follows:
+ Though MVC comes in different flavors, control flow is generally as
+ follows:
- The user interacts with the user interface in some way (for
- example, presses a mouse button).
+ The user interacts with the user interface in some way (for example,
+ presses a mouse button).
- The controller handles the input event from the user interface,
- often via a registered handler or callback and converts the event
- into appropriate user action, understandable for the model.
+ The controller handles the input event from the user interface, often via
+ a registered handler or callback and converts the event into appropriate
+ user action, understandable for the model.
- The controller notifies the model of the user action, possibly
- resulting in a change in the model's state. (For example, the
- controller updates the user's shopping cart.)[5]
+ The controller notifies the model of the user action, possibly resulting
+ in a change in the model's state. (For example, the controller updates the
+ user's shopping cart.)[5]
- A view queries the model in order to generate an appropriate
- user interface (for example, the view lists the shopping cart's
- contents). Note that the view gets its own data from the model.
+ A view queries the model in order to generate an appropriate user
+ interface (for example, the view lists the shopping cart's contents). Note
+ that the view gets its own data from the model.
- The controller may (in some implementations) issue a general
- instruction to the view to render itself. In others, the view is
- automatically notified by the model of changes in state
- (Observer) which require a screen update.
+ The controller may (in some implementations) issue a general instruction
+ to the view to render itself. In others, the view is automatically
+ notified by the model of changes in state (Observer) which require a
+ screen update.
- The user interface waits for further user interactions, which
- restarts the cycle.
+ The user interface waits for further user interactions, which restarts the
+ cycle.
To the author, it seems as if someone edited this Wikipedia definition,
tortuously couching concepts in the most generic terms possible in order to
-account for the use of the term "MVC" by current web frameworks. I doubt
-such a broad definition would ever be agreed to by the original authors of
-the MVC pattern. But *even so*, it seems most MVC web frameworks fail to
-meet even this falsely generic definition.
+account for the use of the term "MVC" by current web frameworks. I doubt such
+a broad definition would ever be agreed to by the original authors of the MVC
+pattern. But *even so*, it seems most MVC web frameworks fail to meet even
+this falsely generic definition.
For example, do your templates (views) always query models directly as is
-claimed in "note that the view gets its own data from the model"? Probably
-not. My "controllers" tend to do this, massaging the data for easier use by
-the "view" (template). What do you do when your "controller" returns JSON? Do
-your controllers use a template to generate JSON? If not, what's the "view"
-then? Most MVC-style GUI web frameworks have some sort of event system
-hooked up that lets the view detect when the model changes. The web just has
-no such facility in its current form: it's effectively pull-only.
-
-So, in the interest of not mistaking desire with reality, and instead of
-trying to jam the square peg that is the web into the round hole of "MVC", we
-just punt and say there are two things: resources and views. The resource
-tree represents a site structure, the view presents a resource. The
-templates are really just an implementation detail of any given view: a view
-doesn't need a template to return a response. There's no "controller": it
-just doesn't exist. The "model" is either represented by the resource tree
-or by a "domain model" (like a SQLAlchemy model) that is separate from the
-framework entirely. This seems to us like more reasonable terminology, given
-the current constraints of the web.
+claimed in "note that the view gets its own data from the model"? Probably not.
+My "controllers" tend to do this, massaging the data for easier use by the
+"view" (template). What do you do when your "controller" returns JSON? Do your
+controllers use a template to generate JSON? If not, what's the "view" then?
+Most MVC-style GUI web frameworks have some sort of event system hooked up that
+lets the view detect when the model changes. The web just has no such facility
+in its current form; it's effectively pull-only.
+
+So, in the interest of not mistaking desire with reality, and instead of trying
+to jam the square peg that is the web into the round hole of "MVC", we just
+punt and say there are two things: resources and views. The resource tree
+represents a site structure, the view presents a resource. The templates are
+really just an implementation detail of any given view. A view doesn't need a
+template to return a response. There's no "controller"; it just doesn't exist.
+The "model" is either represented by the resource tree or by a "domain model"
+(like an SQLAlchemy model) that is separate from the framework entirely. This
+seems to us like more reasonable terminology, given the current constraints of
+the web.
+
.. _apps_are_extensible:
-Pyramid Applications are Extensible; I Don't Believe In Application Extensibility
+Pyramid Applications Are Extensible; I Don't Believe in Application Extensibility
---------------------------------------------------------------------------------
Any :app:`Pyramid` application written obeying certain constraints is
*extensible*. This feature is discussed in the :app:`Pyramid` documentation
-chapters named :ref:`extending_chapter` and :ref:`advconfig_narr`. It is
-made possible by the use of the :term:`Zope Component Architecture` and
-within :app:`Pyramid`.
+chapters named :ref:`extending_chapter` and :ref:`advconfig_narr`. It is made
+possible by the use of the :term:`Zope Component Architecture` within
+:app:`Pyramid`.
-"Extensible", in this context, means:
+"Extensible" in this context means:
-- The behavior of an application can be overridden or extended in a
- particular *deployment* of the application without requiring that
- the deployer modify the source of the original application.
+- The behavior of an application can be overridden or extended in a particular
+ *deployment* of the application without requiring that the deployer modify
+ the source of the original application.
-- The original developer is not required to anticipate any
- extensibility plugpoints at application creation time to allow
- fundamental application behavior to be overriden or extended.
+- The original developer is not required to anticipate any extensibility
+ plug points at application creation time to allow fundamental application
+ behavior to be overridden or extended.
- The original developer may optionally choose to anticipate an
- application-specific set of plugpoints, which may be hooked by
- a deployer. If he chooses to use the facilities provided by the
- ZCA, the original developer does not need to think terribly hard
- about the mechanics of introducing such a plugpoint.
+ application-specific set of plug points, which may be hooked by a deployer.
+ If they choose to use the facilities provided by the ZCA, the original
+ developer does not need to think terribly hard about the mechanics of
+ introducing such a plug point.
Many developers seem to believe that creating extensible applications is not
-worth it. They instead suggest that modifying the source of a given
-application for each deployment to override behavior is more reasonable.
-Much discussion about version control branching and merging typically ensues.
-
-It's clear that making every application extensible isn't required. The
-majority of web applications only have a single deployment, and thus needn't
-be extensible at all. However, some web applications have multiple
-deployments, and some have *many* deployments. For example, a generic
-content management system (CMS) may have basic functionality that needs to be
-extended for a particular deployment. That CMS system may be deployed for
-many organizations at many places. Some number of deployments of this CMS
-may be deployed centrally by a third party and managed as a group. It's
-easier to be able to extend such a system for each deployment via preordained
-plugpoints than it is to continually keep each software branch of the system
-in sync with some upstream source: the upstream developers may change code in
-such a way that your changes to the same codebase conflict with theirs in
-fiddly, trivial ways. Merging such changes repeatedly over the lifetime of a
-deployment can be difficult and time consuming, and it's often useful to be
-able to modify an application for a particular deployment in a less invasive
-way.
+worth it. They instead suggest that modifying the source of a given application
+for each deployment to override behavior is more reasonable. Much discussion
+about version control branching and merging typically ensues.
+
+It's clear that making every application extensible isn't required. The
+majority of web applications only have a single deployment, and thus needn't be
+extensible at all. However some web applications have multiple deployments, and
+others have *many* deployments. For example, a generic content management
+system (CMS) may have basic functionality that needs to be extended for a
+particular deployment. That CMS may be deployed for many organizations at many
+places. Some number of deployments of this CMS may be deployed centrally by a
+third party and managed as a group. It's easier to be able to extend such a
+system for each deployment via preordained plug points than it is to
+continually keep each software branch of the system in sync with some upstream
+source. The upstream developers may change code in such a way that your changes
+to the same codebase conflict with theirs in fiddly, trivial ways. Merging such
+changes repeatedly over the lifetime of a deployment can be difficult and time
+consuming, and it's often useful to be able to modify an application for a
+particular deployment in a less invasive way.
If you don't want to think about :app:`Pyramid` application extensibility at
-all, you needn't. You can ignore extensibility entirely. However, if you
-follow the set of rules defined in :ref:`extending_chapter`, you don't need
-to *make* your application extensible: any application you write in the
-framework just *is* automatically extensible at a basic level. The
-mechanisms that deployers use to extend it will be necessarily coarse:
-typically, views, routes, and resources will be capable of being
-overridden. But for most minor (and even some major) customizations, these
-are often the only override plugpoints necessary: if the application doesn't
-do exactly what the deployment requires, it's often possible for a deployer
-to override a view, route, or resource and quickly make it do what he or she
-wants it to do in ways *not necessarily anticipated by the original
-developer*. Here are some example scenarios demonstrating the benefits of
-such a feature.
-
-- If a deployment needs a different styling, the deployer may override the
- main template and the CSS in a separate Python package which defines
- overrides.
-
-- If a deployment needs an application page to do something differently, or
- to expose more or different information, the deployer may override the
- view that renders the page within a separate Python package.
+all, you needn't. You can ignore extensibility entirely. However if you follow
+the set of rules defined in :ref:`extending_chapter`, you don't need to *make*
+your application extensible. Any application you write in the framework just
+*is* automatically extensible at a basic level. The mechanisms that deployers
+use to extend it will be necessarily coarse. Typically views, routes, and
+resources will be capable of being overridden. But for most minor (and even
+some major) customizations, these are often the only override plug points
+necessary. If the application doesn't do exactly what the deployment requires,
+it's often possible for a deployer to override a view, route, or resource, and
+quickly make it do what they want it to do in ways *not necessarily anticipated
+by the original developer*. Here are some example scenarios demonstrating the
+benefits of such a feature.
+
+- If a deployment needs a different styling, the deployer may override the main
+ template and the CSS in a separate Python package which defines overrides.
+
+- If a deployment needs an application page to do something differently, or to
+ expose more or different information, the deployer may override the view that
+ renders the page within a separate Python package.
- If a deployment needs an additional feature, the deployer may add a view to
the override package.
-As long as the fundamental design of the upstream package doesn't change,
-these types of modifications often survive across many releases of the
-upstream package without needing to be revisited.
+As long as the fundamental design of the upstream package doesn't change, these
+types of modifications often survive across many releases of the upstream
+package without needing to be revisited.
Extending an application externally is not a panacea, and carries a set of
-risks similar to branching and merging: sometimes major changes upstream will
-cause you to need to revisit and update some of your modifications. But you
-won't regularly need to deal wth meaningless textual merge conflicts that
-trivial changes to upstream packages often entail when it comes time to
-update the upstream package, because if you extend an application externally,
-there just is no textual merge done. Your modifications will also, for
-whatever it's worth, be contained in one, canonical, well-defined place.
+risks similar to branching and merging. Sometimes major changes upstream will
+cause you to revisit and update some of your modifications. But you won't
+regularly need to deal with meaningless textual merge conflicts that trivial
+changes to upstream packages often entail when it comes time to update the
+upstream package, because if you extend an application externally, there just
+is no textual merge done. Your modifications will also, for whatever it's
+worth, be contained in one, canonical, well-defined place.
Branching an application and continually merging in order to get new features
-and bugfixes is clearly useful. You can do that with a :app:`Pyramid`
-application just as usefully as you can do it with any application. But
+and bug fixes is clearly useful. You can do that with a :app:`Pyramid`
+application just as usefully as you can do it with any application. But
deployment of an application written in :app:`Pyramid` makes it possible to
-avoid the need for this even if the application doesn't define any plugpoints
-ahead of time. It's possible that promoters of competing web frameworks
-dismiss this feature in favor of branching and merging because applications
-written in their framework of choice aren't extensible out of the box in a
-comparably fundamental way.
+avoid the need for this even if the application doesn't define any plug points
+ahead of time. It's possible that promoters of competing web frameworks dismiss
+this feature in favor of branching and merging because applications written in
+their framework of choice aren't extensible out of the box in a comparably
+fundamental way.
While :app:`Pyramid` applications are fundamentally extensible even if you
don't write them with specific extensibility in mind, if you're moderately
-adventurous, you can also take it a step further. If you learn more about
-the :term:`Zope Component Architecture`, you can optionally use it to expose
-other more domain-specific configuration plugpoints while developing an
-application. The plugpoints you expose needn't be as coarse as the ones
-provided automatically by :app:`Pyramid` itself. For example, you might
-compose your own directive that configures a set of views for a prebaked
-purpose (e.g. ``restview`` or somesuch) , allowing other people to refer to
-that directive when they make declarations in the ``includeme`` of their
-customization package. There is a cost for this: the developer of an
-application that defines custom plugpoints for its deployers will need to
-understand the ZCA or he will need to develop his own similar extensibility
-system.
-
-Ultimately, any argument about whether the extensibility features lent to
-applications by :app:`Pyramid` are good or bad is mostly pointless. You
-needn't take advantage of the extensibility features provided by a particular
+adventurous, you can also take it a step further. If you learn more about the
+:term:`Zope Component Architecture`, you can optionally use it to expose other
+more domain-specific configuration plug points while developing an application.
+The plug points you expose needn't be as coarse as the ones provided
+automatically by :app:`Pyramid` itself. For example, you might compose your own
+directive that configures a set of views for a pre-baked purpose (e.g.,
+``restview`` or somesuch), allowing other people to refer to that directive
+when they make declarations in the ``includeme`` of their customization
+package. There is a cost for this: the developer of an application that defines
+custom plug points for its deployers will need to understand the ZCA or they
+will need to develop their own similar extensibility system.
+
+Ultimately any argument about whether the extensibility features lent to
+applications by :app:`Pyramid` are good or bad is mostly pointless. You needn't
+take advantage of the extensibility features provided by a particular
:app:`Pyramid` application in order to affect a modification for a particular
-set of its deployments. You can ignore the application's extensibility
-plugpoints entirely, and use version control branching and merging to
-manage application deployment modifications instead, as if you were deploying
-an application written using any other web framework.
+set of its deployments. You can ignore the application's extensibility plug
+points entirely, and use version control branching and merging to manage
+application deployment modifications instead, as if you were deploying an
+application written using any other web framework.
+
-Zope 3 Enforces "TTW" Authorization Checks By Default; Pyramid Does Not
+Zope 3 Enforces "TTW" Authorization Checks by Default; Pyramid Does Not
-----------------------------------------------------------------------
Challenge
+++++++++
:app:`Pyramid` performs automatic authorization checks only at :term:`view`
-execution time. Zope 3 wraps context objects with a `security proxy
-<http://wiki.zope.org/zope3/WhatAreSecurityProxies>`_, which causes Zope 3 to
-do also security checks during attribute access. I like this, because it
-means:
+execution time. Zope 3 wraps context objects with a `security proxy
+<http://wiki.zope.org/zope3/WhatAreSecurityProxies>`_, which causes Zope 3 also
+to do security checks during attribute access. I like this, because it means:
#) When I use the security proxy machinery, I can have a view that
conditionally displays certain HTML elements (like form fields) or
@@ -892,7 +881,7 @@ web framework.
And since we tend to use the same toolkit for all web applications, it's just
never been a concern to be able to use the same set of restricted-execution
-code under two web different frameworks.
+code under two different web frameworks.
Justifications for disabling security proxies by default notwithstanding,
given that Zope 3 security proxies are viral by nature, the only requirement
@@ -905,52 +894,54 @@ Zope3-security-proxy-wrapped objects for each traversed object (including the
:term:`context` and the :term:`root`). This would have the effect of
creating a more Zope3-like environment without much effort.
+
.. _http_exception_hierarchy:
-Pyramid Uses its Own HTTP Exception Class Hierarchy Rather Than ``webob.exc``
------------------------------------------------------------------------------
+Pyramid uses its own HTTP exception class hierarchy rather than :mod:`webob.exc`
+--------------------------------------------------------------------------------
.. versionadded:: 1.1
The HTTP exception classes defined in :mod:`pyramid.httpexceptions` are very
-much like the ones defined in ``webob.exc``
-(e.g. :class:`~pyramid.httpexceptions.HTTPNotFound`,
-:class:`~pyramid.httpexceptions.HTTPForbidden`, etc). They have the same
-names and largely the same behavior and all have a very similar
-implementation, but not the same identity. Here's why they have a separate
-identity:
+much like the ones defined in :mod:`webob.exc`, (e.g.,
+:class:`~pyramid.httpexceptions.HTTPNotFound` or
+:class:`~pyramid.httpexceptions.HTTPForbidden`). They have the same names and
+largely the same behavior, and all have a very similar implementation, but not
+the same identity. Here's why they have a separate identity.
- Making them separate allows the HTTP exception classes to subclass
:class:`pyramid.response.Response`. This speeds up response generation
- slightly due to the way the Pyramid router works. The same speedup could
- be gained by monkeypatching ``webob.response.Response`` but it's usually
+ slightly due to the way the Pyramid router works. The same speed up could be
+ gained by monkeypatching :class:`webob.response.Response`, but it's usually
the case that monkeypatching turns out to be evil and wrong.
-- Making them separate allows them to provide alternate ``__call__`` logic
+- Making them separate allows them to provide alternate ``__call__`` logic,
which also speeds up response generation.
- Making them separate allows the exception classes to provide for the proper
value of ``RequestClass`` (:class:`pyramid.request.Request`).
-- Making them separate allows us freedom from having to think about backwards
- compatibility code present in ``webob.exc`` having to do with Python 2.4,
- which we no longer support in Pyramid 1.1+.
+- Making them separate gives us freedom from thinking about backwards
+ compatibility code present in :mod:`webob.exc` related to Python 2.4, which
+ we no longer support in Pyramid 1.1+.
- We change the behavior of two classes
(:class:`~pyramid.httpexceptions.HTTPNotFound` and
:class:`~pyramid.httpexceptions.HTTPForbidden`) in the module so that they
- can be used by Pyramid internally for notfound and forbidden exceptions.
+ can be used by Pyramid internally for ``notfound`` and ``forbidden``
+ exceptions.
- Making them separate allows us to influence the docstrings of the exception
classes to provide Pyramid-specific documentation.
-- Making them separate allows us to silence a stupid deprecation warning
- under Python 2.6 when the response objects are used as exceptions (related
- to ``self.message``).
+- Making them separate allows us to silence a stupid deprecation warning under
+ Python 2.6 when the response objects are used as exceptions (related to
+ ``self.message``).
+
.. _simpler_traversal_model:
-Pyramid has Simpler Traversal Machinery than Does Zope
+Pyramid has simpler traversal machinery than does Zope
------------------------------------------------------
Zope's default traverser:
@@ -960,26 +951,26 @@ Zope's default traverser:
- Attempts to use an adaptation to obtain the next element in the path from
the currently traversed object, falling back to ``__bobo_traverse__``,
- ``__getitem__`` and eventually ``__getattr__``.
+ ``__getitem__``, and eventually ``__getattr__``.
Zope's default traverser allows developers to mutate the traversal name stack
-during traversal by mutating ``REQUEST['TraversalNameStack']``. Pyramid's
-default traverser (``pyramid.traversal.ResourceTreeTraverser``) does not
-offer a way to do this; it does not maintain a stack as a request attribute
-and, even if it did, it does not pass the request to resource objects while
-it's traversing. While it was handy at times, this feature was abused in
-frameworks built atop Zope (like CMF and Plone), often making it difficult to
-tell exactly what was happening when a traversal didn't match a view. I felt
-it was better to make folks that wanted the feature replace the traverser
-rather than build that particular honey pot in to the default traverser.
+during traversal by mutating ``REQUEST['TraversalNameStack']``. Pyramid's
+default traverser (``pyramid.traversal.ResourceTreeTraverser``) does not offer
+a way to do this. It does not maintain a stack as a request attribute and, even
+if it did, it does not pass the request to resource objects while it's
+traversing. While it was handy at times, this feature was abused in frameworks
+built atop Zope (like CMF and Plone), often making it difficult to tell exactly
+what was happening when a traversal didn't match a view. I felt it was better
+for folks that wanted the feature to make them replace the traverser rather
+than build that particular honey pot in to the default traverser.
Zope uses multiple mechanisms to attempt to obtain the next element in the
resource tree based on a name. It first tries an adaptation of the current
-resource to ``ITraversable``, and if that fails, it falls back to attempting
+resource to ``ITraversable``, and if that fails, it falls back to attempting a
number of magic methods on the resource (``__bobo_traverse__``,
-``__getitem__``, and ``__getattr__``). My experience while both using Zope
-and attempting to reimplement its publisher in ``repoze.zope2`` led me to
-believe the following:
+``__getitem__``, and ``__getattr__``). My experience while both using Zope and
+attempting to reimplement its publisher in ``repoze.zope2`` led me to believe
+the following:
- The *default* traverser should be as simple as possible. Zope's publisher
is somewhat difficult to follow and replicate due to the fallbacks it tried
@@ -1000,7 +991,7 @@ believe the following:
default implementation of the larger component, no one understands when (or
whether) they should ever override the larger component entrirely. This
results, over time, in a rusting together of the larger "replaceable"
- component and the framework itself, because people come to depend on the
+ component and the framework itself because people come to depend on the
availability of the default component in order just to turn its knobs. The
default component effectively becomes part of the framework, which entirely
subverts the goal of making it replaceable. In Pyramid, typically if a
@@ -1009,40 +1000,42 @@ believe the following:
you will replace the component instead of turning knobs attached to the
component.
+
.. _microframeworks_smaller_hello_world:
-Microframeworks Have Smaller Hello World Programs
+Microframeworks have smaller Hello World programs
-------------------------------------------------
-Self-described "microframeworks" exist: `Bottle <http://bottle.paws.de>`_ and
-`Flask <http://flask.pocoo.org/>`_ are two that are becoming popular. `Bobo
-<http://bobo.digicool.com/>`_ doesn't describe itself as a microframework,
-but its intended userbase is much the same. Many others exist. We've
-actually even (only as a teaching tool, not as any sort of official project)
-`created one using Pyramid <http://bfg.repoze.org/videos#groundhog1>`_ (the
-videos use BFG, a precursor to Pyramid, but the resulting code is `available
-for Pyramid too <https://github.com/Pylons/groundhog>`_). Microframeworks are
-small frameworks with one common feature: each allows its users to create a
-fully functional application that lives in a single Python file.
+Self-described "microframeworks" exist. `Bottle <http://bottle.paws.de>`_ and
+`Flask <http://flask.pocoo.org/>`_ are two that are becoming popular. `Bobo
+<http://bobo.digicool.com/>`_ doesn't describe itself as a microframework, but
+its intended user base is much the same. Many others exist. We've even (only as
+a teaching tool, not as any sort of official project) `created one using
+Pyramid <http://bfg.repoze.org/videos#groundhog1>`_. The videos use BFG, a
+precursor to Pyramid, but the resulting code is `available for Pyramid too
+<https://github.com/Pylons/groundhog>`_). Microframeworks are small frameworks
+with one common feature: each allows its users to create a fully functional
+application that lives in a single Python file.
Some developers and microframework authors point out that Pyramid's "hello
-world" single-file program is longer (by about five lines) than the
-equivalent program in their favorite microframework. Guilty as charged.
+world" single-file program is longer (by about five lines) than the equivalent
+program in their favorite microframework. Guilty as charged.
+
+This loss isn't for lack of trying. Pyramid is useful in the same circumstance
+in which microframeworks claim dominance: single-file applications. But Pyramid
+doesn't sacrifice its ability to credibly support larger applications in order
+to achieve "hello world" lines of code parity with the current crop of
+microframeworks. Pyramid's design instead tries to avoid some common pitfalls
+associated with naive declarative configuration schemes. The subsections which
+follow explain the rationale.
-This loss isn't for lack of trying. Pyramid is useful in the same
-circumstance in which microframeworks claim dominance: single-file
-applications. But Pyramid doesn't sacrifice its ability to credibly support
-larger applications in order to achieve hello-world LoC parity with the
-current crop of microframeworks. Pyramid's design instead tries to avoid
-some common pitfalls associated with naive declarative configuration schemes.
-The subsections which follow explain the rationale.
.. _you_dont_own_modulescope:
-Application Programmers Don't Control The Module-Scope Codepath (Import-Time Side-Effects Are Evil)
+Application programmers don't control the module-scope codepath (import-time side-effects are evil)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Please imagine a directory structure with a set of Python files in it:
+Imagine a directory structure with a set of Python files in it:
.. code-block:: text
@@ -1090,13 +1083,13 @@ The contents of ``config.py``:
L.append(func)
return func
-If we cd to the directory that holds these files and we run ``python app.py``
-given the directory structure and code above, what happens? Presumably, our
-``decorator`` decorator will be used twice, once by the decorated function
-``foo`` in ``app.py`` and once by the decorated function ``bar`` in
-``app2.py``. Since each time the decorator is used, the list ``L`` in
-``config.py`` is appended to, we'd expect a list with two elements to be
-printed, right? Sadly, no:
+If we ``cd`` to the directory that holds these files, and we run
+``python app.py``, given the directory structure and code above, what happens?
+Presumably, our ``decorator`` decorator will be used twice, once by the
+decorated function ``foo`` in ``app.py``, and once by the decorated function
+``bar`` in ``app2.py``. Since each time the decorator is used, the list ``L``
+in ``config.py`` is appended to, we'd expect a list with two elements to be
+printed, right? Sadly, no:
.. code-block:: text
@@ -1106,21 +1099,21 @@ printed, right? Sadly, no:
<function bar at 0x7f4ea41ab2a8>]
By visual inspection, that outcome (three different functions in the list)
-seems impossible. We only defined two functions and we decorated each of
-those functions only once, so we believe that the ``decorator`` decorator
-will only run twice. However, what we believe is wrong because the code at
-module scope in our ``app.py`` module was *executed twice*. The code is
+seems impossible. We defined only two functions, and we decorated each of those
+functions only once, so we believe that the ``decorator`` decorator will run
+only twice. However, what we believe is in fact wrong, because the code at
+module scope in our ``app.py`` module was *executed twice*. The code is
executed once when the script is run as ``__main__`` (via ``python app.py``),
and then it is executed again when ``app2.py`` imports the same file as
``app``.
-What does this have to do with our comparison to microframeworks? Many
-microframeworks in the current crop (e.g. Bottle, Flask) encourage you to
-attach configuration decorators to objects defined at module scope. These
-decorators execute arbitrarily complex registration code which populates a
-singleton registry that is a global defined in external Python module. This
-is analogous to the above example: the "global registry" in the above example
-is the list ``L``.
+What does this have to do with our comparison to microframeworks? Many
+microframeworks in the current crop (e.g., Bottle and Flask) encourage you to
+attach configuration decorators to objects defined at module scope. These
+decorators execute arbitrarily complex registration code, which populates a
+singleton registry that is a global which is in turn defined in external Python
+module. This is analogous to the above example: the "global registry" in the
+above example is the list ``L``.
Let's see what happens when we use the same pattern with the `Groundhog
<https://github.com/Pylons/groundhog>`_ microframework. Replace the contents
@@ -1173,41 +1166,39 @@ will be.
The encouragement to use decorators which perform population of an external
registry has an unintended consequence: the application developer now must
-assert ownership of every codepath that executes Python module scope
-code. Module-scope code is presumed by the current crop of decorator-based
-microframeworks to execute once and only once; if it executes more than once,
-weird things will start to happen. It is up to the application developer to
-maintain this invariant. Unfortunately, however, in reality, this is an
-impossible task, because, Python programmers *do not own the module scope
-codepath, and never will*. Anyone who tries to sell you on the idea that
-they do is simply mistaken. Test runners that you may want to use to run
-your code's tests often perform imports of arbitrary code in strange orders
-that manifest bugs like the one demonstrated above. API documentation
-generation tools do the same. Some people even think it's safe to use the
-Python ``reload`` command or delete objects from ``sys.modules``, each of
-which has hilarious effects when used against code that has import-time side
-effects.
-
-Global-registry-mutating microframework programmers therefore will at some
-point need to start reading the tea leaves about what *might* happen if
-module scope code gets executed more than once like we do in the previous
-paragraph. When Python programmers assume they can use the module-scope
-codepath to run arbitrary code (especially code which populates an external
-registry), and this assumption is challenged by reality, the application
-developer is often required to undergo a painful, meticulous debugging
-process to find the root cause of an inevitably obscure symptom. The
-solution is often to rearrange application import ordering or move an import
-statement from module-scope into a function body. The rationale for doing so
-can never be expressed adequately in the checkin message which accompanies
-the fix and can't be documented succinctly enough for the benefit of the rest
-of the development team so that the problem never happens again. It will
-happen again, especially if you are working on a project with other people
-who haven't yet internalized the lessons you learned while you stepped
-through module-scope code using ``pdb``. This is a really pretty poor
-situation to find yourself in as an application developer: you probably
-didn't even know your or your team signed up for the job, because the
-documentation offered by decorator-based microframeworks don't warn you about
-it.
+assert ownership of every code path that executes Python module scope code.
+Module-scope code is presumed by the current crop of decorator-based
+microframeworks to execute once and only once. If it executes more than once,
+weird things will start to happen. It is up to the application developer to
+maintain this invariant. Unfortunately, in reality this is an impossible task,
+because Python programmers *do not own the module scope code path, and never
+will*. Anyone who tries to sell you on the idea that they do so is simply
+mistaken. Test runners that you may want to use to run your code's tests often
+perform imports of arbitrary code in strange orders that manifest bugs like the
+one demonstrated above. API documentation generation tools do the same. Some
+people even think it's safe to use the Python ``reload`` command, or delete
+objects from ``sys.modules``, each of which has hilarious effects when used
+against code that has import-time side effects.
+
+Global registry-mutating microframework programmers therefore will at some
+point need to start reading the tea leaves about what *might* happen if module
+scope code gets executed more than once, like we do in the previous paragraph.
+When Python programmers assume they can use the module-scope code path to run
+arbitrary code (especially code which populates an external registry), and this
+assumption is challenged by reality, the application developer is often
+required to undergo a painful, meticulous debugging process to find the root
+cause of an inevitably obscure symptom. The solution is often to rearrange
+application import ordering, or move an import statement from module-scope into
+a function body. The rationale for doing so can never be expressed adequately
+in the commit message which accompanies the fix, and can't be documented
+succinctly enough for the benefit of the rest of the development team so that
+the problem never happens again. It will happen again, especially if you are
+working on a project with other people who haven't yet internalized the lessons
+you learned while you stepped through module-scope code using ``pdb``. This is
+a very poor situation in which to find yourself as an application developer:
+you probably didn't even know you or your team signed up for the job, because
+the documentation offered by decorator-based microframeworks don't warn you
+about it.
Folks who have a large investment in eager decorator-based configuration that
populates an external data structure (such as microframework authors) may
@@ -1223,7 +1214,7 @@ time, and application complexity.
If microframework authors do admit that the circumstance isn't contrived,
they might then argue that real damage will never happen as the result of the
-double-execution (or triple-execution, etc) of module scope code. You would
+double-execution (or triple-execution, etc.) of module scope code. You would
be wise to disbelieve this assertion. The potential outcomes of multiple
execution are too numerous to predict because they involve delicate
relationships between application and framework code as well as chronology of
@@ -1231,14 +1222,14 @@ code execution. It's literally impossible for a framework author to know
what will happen in all circumstances. But even if given the gift of
omniscience for some limited set of circumstances, the framework author
almost certainly does not have the double-execution anomaly in mind when
-coding new features. He's thinking of adding a feature, not protecting
+coding new features. They're thinking of adding a feature, not protecting
against problems that might be caused by the 1% multiple execution case.
However, any 1% case may cause 50% of your pain on a project, so it'd be nice
-if it never occured.
+if it never occurred.
-Responsible microframeworks actually offer a back-door way around the
-problem. They allow you to disuse decorator based configuration entirely.
-Instead of requiring you to do the following:
+Responsible microframeworks actually offer a back-door way around the problem.
+They allow you to disuse decorator-based configuration entirely. Instead of
+requiring you to do the following:
.. code-block:: python
:linenos:
@@ -1252,7 +1243,7 @@ Instead of requiring you to do the following:
if __name__ == '__main__':
gh.run()
-They allow you to disuse the decorator syntax and go almost-all-imperative:
+They allow you to disuse the decorator syntax and go almost all-imperative:
.. code-block:: python
:linenos:
@@ -1276,23 +1267,23 @@ predictability.
.. note::
- Astute readers may notice that Pyramid has configuration decorators too.
- Aha! Don't these decorators have the same problems? No. These decorators
- do not populate an external Python module when they are executed. They
- only mutate the functions (and classes and methods) they're attached to.
- These mutations must later be found during a scan process that has a
- predictable and structured import phase. Module-localized mutation is
- actually the best-case circumstance for double-imports; if a module only
- mutates itself and its contents at import time, if it is imported twice,
- that's OK, because each decorator invocation will always be mutating an
- independent copy of the object it's attached to, not a shared resource like
- a registry in another module. This has the effect that
- double-registrations will never be performed.
+ Astute readers may notice that Pyramid has configuration decorators too. Aha!
+ Don't these decorators have the same problems? No. These decorators do not
+ populate an external Python module when they are executed. They only mutate
+ the functions (and classes and methods) to which they're attached. These
+ mutations must later be found during a scan process that has a predictable
+ and structured import phase. Module-localized mutation is actually the
+ best-case circumstance for double-imports. If a module only mutates itself
+ and its contents at import time, if it is imported twice, that's OK, because
+ each decorator invocation will always be mutating an independent copy of the
+ object to which it's attached, not a shared resource like a registry in
+ another module. This has the effect that double-registrations will never be
+ performed.
.. _routes_need_ordering:
-Routes Need Relative Ordering
+Routes need relative ordering
+++++++++++++++++++++++++++++
Consider the following simple `Groundhog
@@ -1320,8 +1311,8 @@ Consider the following simple `Groundhog
app.run()
If you run this application and visit the URL ``/admin``, you will see the
-"admin" page. This is the intended result. However, what if you rearrange
-the order of the function definitions in the file?
+"admin" page. This is the intended result. However, what if you rearrange the
+order of the function definitions in the file?
.. code-block:: python
:linenos:
@@ -1344,11 +1335,11 @@ the order of the function definitions in the file?
if __name__ == '__main__':
app.run()
-If you run this application and visit the URL ``/admin``, you will now be
-returned a 404 error. This is probably not what you intended. The reason
-you see a 404 error when you rearrange function definition ordering is that
-routing declarations expressed via our microframework's routing decorators
-have an *ordering*, and that ordering matters.
+If you run this application and visit the URL ``/admin``, your app will now
+return a 404 error. This is probably not what you intended. The reason you see
+a 404 error when you rearrange function definition ordering is that routing
+declarations expressed via our microframework's routing decorators have an
+*ordering*, and that ordering matters.
In the first case, where we achieved the expected result, we first added a
route with the pattern ``/admin``, then we added a route with the pattern
@@ -1356,65 +1347,67 @@ route with the pattern ``/admin``, then we added a route with the pattern
scope. When a request with a ``PATH_INFO`` of ``/admin`` enters our
application, the web framework loops over each of our application's route
patterns in the order in which they were defined in our module. As a result,
-the view associated with the ``/admin`` routing pattern will be invoked: it
-matches first. All is right with the world.
+the view associated with the ``/admin`` routing pattern will be invoked because
+it matches first. All is right with the world.
In the second case, where we did not achieve the expected result, we first
added a route with the pattern ``/:action``, then we added a route with the
pattern ``/admin``. When a request with a ``PATH_INFO`` of ``/admin`` enters
our application, the web framework loops over each of our application's route
patterns in the order in which they were defined in our module. As a result,
-the view associated with the ``/:action`` routing pattern will be invoked: it
-matches first. A 404 error is raised. This is not what we wanted; it just
-happened due to the order in which we defined our view functions.
-
-This is because Groundhog routes are added to the routing map in import
-order, and matched in the same order when a request comes in. Bottle, like
-Groundhog, as of this writing, matches routes in the order in which they're
-defined at Python execution time. Flask, on the other hand, does not order
-route matching based on import order; it reorders the routes you add to your
-application based on their "complexity". Other microframeworks have varying
+the view associated with the ``/:action`` routing pattern will be invoked
+because it matches first. A 404 error is raised. This is not what we wanted; it
+just happened due to the order in which we defined our view functions.
+
+This is because Groundhog routes are added to the routing map in import order,
+and matched in the same order when a request comes in. Bottle, like Groundhog,
+as of this writing, matches routes in the order in which they're defined at
+Python execution time. Flask, on the other hand, does not order route matching
+based on import order. Instead it reorders the routes you add to your
+application based on their "complexity". Other microframeworks have varying
strategies to do route ordering.
Your application may be small enough where route ordering will never cause an
-issue. If your application becomes large enough, however, being able to
-specify or predict that ordering as your application grows larger will be
-difficult. At some point, you will likely need to more explicitly start
-controlling route ordering, especially in applications that require
-extensibility.
+issue. If your application becomes large enough, however, being able to specify
+or predict that ordering as your application grows larger will be difficult.
+At some point, you will likely need to start controlling route ordering more
+explicitly, especially in applications that require extensibility.
If your microframework orders route matching based on complexity, you'll need
to understand what is meant by "complexity", and you'll need to attempt to
-inject a "less complex" route to have it get matched before any "more
-complex" one to ensure that it's tried first.
+inject a "less complex" route to have it get matched before any "more complex"
+one to ensure that it's tried first.
If your microframework orders its route matching based on relative
import/execution of function decorator definitions, you will need to ensure
-you execute all of these statements in the "right" order, and you'll need to
-be cognizant of this import/execution ordering as you grow your application
-or try to extend it. This is a difficult invariant to maintain for all but
-the smallest applications.
-
-In either case, your application must import the non-``__main__`` modules
-which contain configuration decorations somehow for their configuration to be
-executed. Does that make you a little uncomfortable? It should, because
+that you execute all of these statements in the "right" order, and you'll need
+to be cognizant of this import/execution ordering as you grow your application
+or try to extend it. This is a difficult invariant to maintain for all but the
+smallest applications.
+
+In either case, your application must import the non-``__main__`` modules which
+contain configuration decorations somehow for their configuration to be
+executed. Does that make you a little uncomfortable? It should, because
:ref:`you_dont_own_modulescope`.
Pyramid uses neither decorator import time ordering nor does it attempt to
-divine the relative complexity of one route to another in order to define a
-route match ordering. In Pyramid, you have to maintain relative route
-ordering imperatively via the chronology of multiple executions of the
-:meth:`pyramid.config.Configurator.add_route` method. The order in which you
+divine the relative complexity of one route to another as a means to define a
+route match ordering. In Pyramid, you have to maintain relative route ordering
+imperatively via the chronology of multiple executions of the
+:meth:`pyramid.config.Configurator.add_route` method. The order in which you
repeatedly call ``add_route`` becomes the order of route matching.
If needing to maintain this imperative ordering truly bugs you, you can use
-:term:`traversal` instead of route matching, which is a completely
-declarative (and completely predictable) mechanism to map code to URLs.
-While URL dispatch is easier to understand for small non-extensible
-applications, traversal is a great fit for very large applications and
-applications that need to be arbitrarily extensible.
+:term:`traversal` instead of route matching, which is a completely declarative
+(and completely predictable) mechanism to map code to URLs. While URL dispatch
+is easier to understand for small non-extensible applications, traversal is a
+great fit for very large applications and applications that need to be
+arbitrarily extensible.
+
-"Stacked Object Proxies" Are Too Clever / Thread Locals Are A Nuisance
+.. _thread_local_nuisance:
+
+"Stacked object proxies" are too clever / thread locals are a nuisance
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Some microframeworks use the ``import`` statement to get a handle to an
@@ -1457,32 +1450,35 @@ code below:
for i in range(10):
print(i)
-By its nature, the *request* object created as the result of a WSGI server's
-call into a long-lived web framework cannot be global, because the lifetime
-of a single request will be much shorter than the lifetime of the process
-running the framework. A request object created by a web framework actually
-has more similarity to the ``i`` loop counter in our example above than it
-has to any comparable importable object defined in the Python standard
+By its nature, the *request* object that is created as the result of a WSGI
+server's call into a long-lived web framework cannot be global, because the
+lifetime of a single request will be much shorter than the lifetime of the
+process running the framework. A request object created by a web framework
+actually has more similarity to the ``i`` loop counter in our example above
+than it has to any comparable importable object defined in the Python standard
library or in normal library code.
However, systems which use stacked object proxies promote locally scoped
-objects such as ``request`` out to module scope, for the purpose of being
+objects, such as ``request``, out to module scope, for the purpose of being
able to offer users a nice spelling involving ``import``. They, for what I
-consider dubious reasons, would rather present to their users the canonical
-way of getting at a ``request`` as ``from framework import request`` instead
-of a saner ``from myframework.threadlocals import get_request; request =
-get_request()`` even though the latter is more explicit.
+consider dubious reasons, would rather present to their users the canonical way
+of getting at a ``request`` as ``from framework import request`` instead of a
+saner ``from myframework.threadlocals import get_request; request =
+get_request()``, even though the latter is more explicit.
It would be *most* explicit if the microframeworks did not use thread local
-variables at all. Pyramid view functions are passed a request object; many
-of Pyramid's APIs require that an explicit request object be passed to them.
-It is *possible* to retrieve the current Pyramid request as a threadlocal
-variable but it is a "in case of emergency, break glass" type of activity.
-This explicitness makes Pyramid view functions more easily unit testable, as
-you don't need to rely on the framework to manufacture suitable "dummy"
-request (and other similarly-scoped) objects during test setup. It also
-makes them more likely to work on arbitrary systems, such as async servers
-that do no monkeypatching.
+variables at all. Pyramid view functions are passed a request object. Many of
+Pyramid's APIs require that an explicit request object be passed to them. It is
+*possible* to retrieve the current Pyramid request as a threadlocal variable,
+but it is an "in case of emergency, break glass" type of activity. This
+explicitness makes Pyramid view functions more easily unit testable, as you
+don't need to rely on the framework to manufacture suitable "dummy" request
+(and other similarly-scoped) objects during test setup. It also makes them
+more likely to work on arbitrary systems, such as async servers, that do no
+monkeypatching.
+
+
+.. _explicitly_wsgi:
Explicitly WSGI
+++++++++++++++
@@ -1496,35 +1492,35 @@ import a WSGI server and use it to serve up their Pyramid application as per
the documentation of that WSGI server.
The extra lines saved by abstracting away the serving step behind ``run()``
-seem to have driven dubious second-order decisions related to API in some
-microframeworks. For example, Bottle contains a ``ServerAdapter`` subclass
-for each type of WSGI server it supports via its ``app.run()`` mechanism.
-This means that there exists code in ``bottle.py`` that depends on the
-following modules: ``wsgiref``, ``flup``, ``paste``, ``cherrypy``, ``fapws``,
+seems to have driven dubious second-order decisions related to its API in some
+microframeworks. For example, Bottle contains a ``ServerAdapter`` subclass for
+each type of WSGI server it supports via its ``app.run()`` mechanism. This
+means that there exists code in ``bottle.py`` that depends on the following
+modules: ``wsgiref``, ``flup``, ``paste``, ``cherrypy``, ``fapws``,
``tornado``, ``google.appengine``, ``twisted.web``, ``diesel``, ``gevent``,
-``gunicorn``, ``eventlet``, and ``rocket``. You choose the kind of server
-you want to run by passing its name into the ``run`` method. In theory, this
-sounds great: I can try Bottle out on ``gunicorn`` just by passing in a name!
-However, to fully test Bottle, all of these third-party systems must be
-installed and functional; the Bottle developers must monitor changes to each
-of these packages and make sure their code still interfaces properly with
-them. This expands the packages required for testing greatly; this is a
-*lot* of requirements. It is likely difficult to fully automate these tests
-due to requirements conflicts and build issues.
+``gunicorn``, ``eventlet``, and ``rocket``. You choose the kind of server you
+want to run by passing its name into the ``run`` method. In theory, this sounds
+great: I can try out Bottle on ``gunicorn`` just by passing in a name! However,
+to fully test Bottle, all of these third-party systems must be installed and
+functional. The Bottle developers must monitor changes to each of these
+packages and make sure their code still interfaces properly with them. This
+increases the number of packages required for testing greatly; this is a *lot*
+of requirements. It is likely difficult to fully automate these tests due to
+requirements conflicts and build issues.
As a result, for single-file apps, we currently don't bother to offer a
-``run()`` shortcut; we tell folks to import their WSGI server of choice and
-run it by hand. For the people who want a server abstraction layer, we
-suggest that they use PasteDeploy. In PasteDeploy-based systems, the onus
-for making sure that the server can interface with a WSGI application is
-placed on the server developer, not the web framework developer, making it
-more likely to be timely and correct.
-
-Wrapping Up
+``run()`` shortcut. We tell folks to import their WSGI server of choice and run
+it by hand. For the people who want a server abstraction layer, we suggest that
+they use PasteDeploy. In PasteDeploy-based systems, the onus for making sure
+that the server can interface with a WSGI application is placed on the server
+developer, not the web framework developer, making it more likely to be timely
+and correct.
+
+Wrapping up
+++++++++++
-Here's a diagrammed version of the simplest pyramid application, where
-comments take into account what we've discussed in the
+Here's a diagrammed version of the simplest pyramid application, where the
+inlined comments take into account what we've discussed in the
:ref:`microframeworks_smaller_hello_world` section.
.. code-block:: python
@@ -1535,16 +1531,17 @@ comments take into account what we've discussed in the
def hello_world(request): # accepts a request; no request thread local reqd
# explicit response object means no response threadlocal
- return Response('Hello world!')
+ return Response('Hello world!')
if __name__ == '__main__':
from pyramid.config import Configurator
- config = Configurator() # no global application object.
+ config = Configurator() # no global application object
config.add_view(hello_world) # explicit non-decorator registration
app = config.make_wsgi_app() # explicitly WSGI
server = make_server('0.0.0.0', 8080, app)
server.serve_forever() # explicitly WSGI
+
Pyramid Doesn't Offer Pluggable Apps
------------------------------------
diff --git a/docs/glossary.rst b/docs/glossary.rst
index deb4c1c8b..bbc86db41 100644
--- a/docs/glossary.rst
+++ b/docs/glossary.rst
@@ -16,6 +16,11 @@ Glossary
An object which, provided a :term:`WSGI` environment as a single
positional argument, returns a Pyramid-compatible request.
+ response factory
+ An object which, provided a :term:`request` as a single positional
+ argument, returns a Pyramid-compatible response. See
+ :class:`pyramid.interfaces.IResponseFactory`.
+
response
An object returned by a :term:`view callable` that represents response
data returned to the requesting user agent. It must implement the
@@ -229,7 +234,7 @@ Glossary
object *location-aware*.
permission
- A string or unicode object that represents an action being taken against
+ A string or Unicode object that represents an action being taken against
a :term:`context` resource. A permission is associated with a view name
and a resource type by the developer. Resources are decorated with
security declarations (e.g. an :term:`ACL`), which reference these
@@ -268,7 +273,7 @@ Glossary
(Allow, 'bob', 'read'), (Deny, 'fred', 'write')]``. If an ACL is
attached to a resource instance, and that resource is findable via the
context resource, it will be consulted any active security policy to
- determine wither a particular request can be fulfilled given the
+ determine whether a particular request can be fulfilled given the
:term:`authentication` information in the request.
authentication
@@ -286,13 +291,22 @@ Glossary
:term:`authorization policy`.
principal
- A *principal* is a string or unicode object representing a userid
- or a group id. It is provided by an :term:`authentication
- policy`. For example, if a user had the user id "bob", and Bob
- was part of two groups named "group foo" and "group bar", the
- request might have information attached to it that would
- indicate that Bob was represented by three principals: "bob",
- "group foo" and "group bar".
+ A *principal* is a string or Unicode object representing an entity,
+ typically a user or group. Principals are provided by an
+ :term:`authentication policy`. For example, if a user has the
+ :term:`userid` `bob`, and is a member of two groups named `group foo` and
+ `group bar`, then the request might have information attached to it
+ indicating that Bob was represented by three principals: `bob`, `group
+ foo` and `group bar`.
+
+ userid
+ A *userid* is a string or Unicode object used to identify and authenticate
+ a real-world user or client. A userid is supplied to an
+ :term:`authentication policy` in order to discover the user's
+ :term:`principals <principal>`. In the authentication policies which
+ :app:`Pyramid` provides, the default behavior returns the user's userid as
+ a principal, but this is not strictly necessary in custom policies that
+ define their principals differently.
authorization policy
An authorization policy in :app:`Pyramid` terms is a bit of
@@ -353,13 +367,13 @@ Glossary
file. It was developed by Ian Bicking.
Chameleon
- `chameleon <http://chameleon.repoze.org>`_ is an attribute language
- template compiler which supports the :term:`ZPT` templating
- specification. It is written and maintained by Malthe Borch. It has
- several extensions, such as the ability to use bracketed (Mako-style)
- ``${name}`` syntax. It is also much faster than the reference
- implementation of ZPT. :app:`Pyramid` offers Chameleon templating out
- of the box in ZPT and text flavors.
+ `chameleon <https://chameleon.readthedocs.org/en/latest/>`_ is an
+ attribute language template compiler which supports the :term:`ZPT`
+ templating specification. It is written and maintained by Malthe Borch. It
+ has several extensions, such as the ability to use bracketed (Mako-style)
+ ``${name}`` syntax. It is also much faster than the reference
+ implementation of ZPT. :app:`Pyramid` offers Chameleon templating out of
+ the box in ZPT and text flavors.
ZPT
The `Zope Page Template <http://wiki.zope.org/ZPT/FrontPage>`_
@@ -749,9 +763,16 @@ Glossary
made. For example the word "java" might be translated
differently if the translation domain is "programming-languages"
than would be if the translation domain was "coffee". A
- translation domain is represnted by a collection of ``.mo`` files
+ translation domain is represented by a collection of ``.mo`` files
within one or more :term:`translation directory` directories.
+ Translation Context
+ A string representing the "context" in which a translation was
+ made within a given :term:`translation domain`. See the gettext
+ documentation, `11.2.5 Using contexts for solving ambiguities
+ <https://www.gnu.org/software/gettext/manual/gettext.html#Contexts>`_
+ for more information.
+
Translator
A callable which receives a :term:`translation string` and returns a
translated Unicode object for the purposes of internationalization. A
@@ -794,11 +815,10 @@ Glossary
library, used by the :app:`Pyramid` translation machinery.
Babel
- A `collection of tools <http://babel.edgewall.org/>`_ for
- internationalizing Python applications. :app:`Pyramid` does
- not depend on Babel to operate, but if Babel is installed,
- additional locale functionality becomes available to your
- application.
+ A `collection of tools <http://babel.pocoo.org/en/latest/>`_ for
+ internationalizing Python applications. :app:`Pyramid` does not depend on
+ Babel to operate, but if Babel is installed, additional locale
+ functionality becomes available to your application.
Lingua
A package by Wichert Akkerman which provides the ``pot-create``
@@ -939,10 +959,10 @@ Glossary
users transition from Pylons and those preferring a more Pylons-like API.
The scaffold has been retired but the demo plays a similar role.
- Pyramid Cookbook
- Additional documentation for Pyramid which presents topical,
- practical uses of Pyramid:
- http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest.
+ Pyramid Community Cookbook
+ Additional, community-based documentation for Pyramid which presents
+ topical, practical uses of Pyramid:
+ :ref:`Pyramid Community Cookbook <cookbook:pyramid-cookbook>`
distutils
The standard system for packaging and distributing Python packages. See
@@ -1068,3 +1088,7 @@ Glossary
data in a Redis database. See
https://pypi.python.org/pypi/pyramid_redis_sessions for more information.
+ cache busting
+ A technique used when serving a cacheable static asset in order to force
+ a client to query the new version of the asset. See :ref:`cache_busting`
+ for more information.
diff --git a/docs/index.rst b/docs/index.rst
index ac16ff237..ba6ca1e49 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -4,10 +4,9 @@
The Pyramid Web Framework
=========================
-:app:`Pyramid` is a small, fast, down-to-earth Python web framework. It
-is developed as part of the `Pylons Project
-<http://docs.pylonsproject.org/>`_. It is licensed under a `BSD-like license
-<http://repoze.org/license.html>`_.
+:app:`Pyramid` is a small, fast, down-to-earth Python web framework. It is
+developed as part of the `Pylons Project <http://docs.pylonsproject.org/>`_.
+It is licensed under a `BSD-like license <http://repoze.org/license.html>`_.
Here is one of the simplest :app:`Pyramid` applications you can make:
@@ -15,30 +14,17 @@ Here is one of the simplest :app:`Pyramid` applications you can make:
After you install :app:`Pyramid` and run this application, when you visit
`<http://localhost:8080/hello/world>`_ in a browser, you will see the text
-``Hello, world!``
+``Hello, world!`` See :ref:`firstapp_chapter` for a full explanation of how
+this application works.
-See :ref:`firstapp_chapter` for a full explanation of how this application
-works. Read the :ref:`html_narrative_documentation` to understand how
-:app:`Pyramid` is designed to scale from simple applications like this to
-very large web applications. To just dive in headfirst, read the
-:doc:`quick_tour`.
-
-Front Matter
-============
-
-.. toctree::
- :maxdepth: 1
-
- copyright.rst
- conventions.rst
.. _html_getting_started:
Getting Started
===============
-If you are new to Pyramid, we have a few resources that can help you get
-up to speed right away.
+If you are new to Pyramid, we have a few resources that can help you get up to
+speed right away.
.. toctree::
:hidden:
@@ -46,26 +32,69 @@ up to speed right away.
quick_tour
quick_tutorial/index
-* :doc:`quick_tour` goes through the major features in Pyramid, covering
- a little about a lot.
+* :doc:`quick_tour` gives an overview of the major features in Pyramid,
+ covering a little about a lot.
+
+* :doc:`quick_tutorial/index` is similar to the Quick Tour, but in a tutorial
+ format, with somewhat deeper treatment of each topic and with working code.
+
+* Like learning by example? Visit the official :ref:`html_tutorials` as well as
+ the community-contributed :ref:`Pyramid Tutorials
+ <tutorials:pyramid-tutorials>` and :ref:`Pyramid Community Cookbook
+ <cookbook:pyramid-cookbook>`.
+
+* For help getting Pyramid set up, try :ref:`installing_chapter`.
+
+* Need help? See :ref:`Support and Development <support-and-development>`.
+
+
+.. _html_tutorials:
+
+Tutorials
+=========
+
+Official tutorials explaining how to use :app:`Pyramid` to build various types
+of applications, and how to deploy :app:`Pyramid` applications to various
+platforms.
+
+.. toctree::
+ :maxdepth: 1
+
+ tutorials/wiki2/index.rst
+ tutorials/wiki/index.rst
+ tutorials/modwsgi/index.rst
-* :doc:`quick_tutorial/index` does the same, but in a tutorial format:
- deeper treatment of each topic and with working code.
-* To see a minimal Pyramid web application, check out
- :ref:`firstapp_chapter`.
+.. _support-and-development:
-* For help getting Pyramid set up, try
- :ref:`installing_chapter`.
+Support and Development
+=======================
-* Like learning by example? Visit the official
- :doc:`wiki tutorial <../tutorials/wiki2/index>` as well as the
- community-contributed
- :ref:`Pyramid tutorials <tutorials:pyramid-tutorials>`, which include
- a :ref:`single file tasks tutorial <tutorials:single-file-tutorial>`.
+The `Pylons Project web site <http://pylonsproject.org/>`_ is the main online
+source of :app:`Pyramid` support and development information.
+
+To report bugs, use the `issue tracker
+<https://github.com/Pylons/pyramid/issues>`_.
+
+If you've got questions that aren't answered by this documentation, contact the
+`Pylons-discuss maillist <http://groups.google.com/group/pylons-discuss>`_ or
+join the `#pyramid IRC channel <irc://irc.freenode.net/#pyramid>`_.
+
+Browse and check out tagged and trunk versions of :app:`Pyramid` via the
+`Pyramid GitHub repository <https://github.com/Pylons/pyramid/>`_. To check out
+the trunk via ``git``, use either command:
+
+.. code-block:: text
+
+ # If you have SSH keys configured on GitHub:
+ git clone git@github.com:Pylons/pyramid.git
+
+ # Otherwise, HTTPS will work, using your GitHub login:
+ git clone https://github.com/Pylons/pyramid.git
-* Need help? See :ref:`Support and
- Development <support-and-development>`.
+To find out how to become a contributor to :app:`Pyramid`, please see the
+`contributor's section of the documentation
+<http://docs.pylonsproject.org/en/latest/#contributing>`_.
.. _html_narrative_documentation:
@@ -73,8 +102,7 @@ up to speed right away.
Narrative Documentation
=======================
-Narrative documentation in chapter form explaining how to use
-:app:`Pyramid`.
+Narrative documentation in chapter form explaining how to use :app:`Pyramid`.
.. toctree::
:maxdepth: 2
@@ -119,34 +147,33 @@ Narrative documentation in chapter form explaining how to use
narr/threadlocals
narr/zca
-.. _html_tutorials:
-Tutorials
-=========
+API Documentation
+=================
-Tutorials explaining how to use :app:`Pyramid` to build various types of
-applications, and how to deploy :app:`Pyramid` applications to various
-platforms.
+Comprehensive reference material for every public API exposed by
+:app:`Pyramid`:
.. toctree::
- :maxdepth: 2
+ :maxdepth: 1
+ :glob:
- tutorials/wiki2/index.rst
- tutorials/wiki/index.rst
- tutorials/modwsgi/index.rst
+ api/index
+ api/*
-.. _html_api_documentation:
-API Documentation
-=================
+``p*`` Scripts Documentation
+============================
-Comprehensive reference material for every public API exposed by :app:`Pyramid`:
+``p*`` scripts included with :app:`Pyramid`:.
.. toctree::
:maxdepth: 1
:glob:
- api/*
+ pscripts/index
+ pscripts/*
+
Change History
==============
@@ -154,6 +181,7 @@ Change History
.. toctree::
:maxdepth: 1
+ whatsnew-1.6
whatsnew-1.5
whatsnew-1.4
whatsnew-1.3
@@ -162,6 +190,7 @@ Change History
whatsnew-1.0
changes
+
Design Documents
================
@@ -170,33 +199,24 @@ Design Documents
designdefense
-.. _support-and-development:
-Support and Development
-=======================
+Copyright, Trademarks, and Attributions
+=======================================
-The `Pylons Project web site <http://pylonsproject.org/>`_ is the main online
-source of :app:`Pyramid` support and development information.
+.. toctree::
+ :maxdepth: 1
-To report bugs, use the `issue tracker
-<https://github.com/Pylons/pyramid/issues>`_.
+ copyright
-If you've got questions that aren't answered by this documentation,
-contact the `Pylons-discuss maillist
-<http://groups.google.com/group/pylons-discuss>`_ or join the `#pyramid
-IRC channel <irc://irc.freenode.net/#pyramid>`_.
-Browse and check out tagged and trunk versions of :app:`Pyramid` via
-the `Pyramid GitHub repository <https://github.com/Pylons/pyramid/>`_.
-To check out the trunk via ``git``, use this command:
+Typographical Conventions
+=========================
-.. code-block:: text
+.. toctree::
+ :maxdepth: 1
- git clone git@github.com:Pylons/pyramid.git
+ conventions
-To find out how to become a contributor to :app:`Pyramid`, please see the
-`contributor's section of the documentation
-<http://docs.pylonsproject.org/en/latest/#contributing>`_.
Index and Glossary
==================
diff --git a/docs/narr/MyProject/development.ini b/docs/narr/MyProject/development.ini
index a9a26e56b..749e574eb 100644
--- a/docs/narr/MyProject/development.ini
+++ b/docs/narr/MyProject/development.ini
@@ -11,7 +11,7 @@ pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
-pyramid.includes =
+pyramid.includes =
pyramid_debugtoolbar
# By default, the toolbar only appears for clients from IP addresses
@@ -24,7 +24,7 @@ pyramid.includes =
[server:main]
use = egg:waitress#main
-host = 0.0.0.0
+host = 127.0.0.1
port = 6543
###
@@ -57,4 +57,4 @@ level = NOTSET
formatter = generic
[formatter_generic]
-format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
diff --git a/docs/narr/MyProject/myproject/templates/mytemplate.pt b/docs/narr/MyProject/myproject/templates/mytemplate.pt
index e6b00a145..65d7f0609 100644
--- a/docs/narr/MyProject/myproject/templates/mytemplate.pt
+++ b/docs/narr/MyProject/myproject/templates/mytemplate.pt
@@ -8,12 +8,12 @@
<meta name="author" content="Pylons Project">
<link rel="shortcut icon" href="${request.static_url('myproject:static/pyramid-16x16.png')}">
- <title>Starter Template for The Pyramid Web Framework</title>
+ <title>Starter Scaffold for The Pyramid Web Framework</title>
<!-- Bootstrap core CSS -->
<link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
- <!-- Custom styles for this template -->
+ <!-- Custom styles for this scaffold -->
<link href="${request.static_url('myproject:static/theme.css')}" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
@@ -33,19 +33,20 @@
</div>
<div class="col-md-10">
<div class="content">
- <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">starter template</span></h1>
- <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Starter scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework 1.6b2</span>.</p>
</div>
</div>
</div>
<div class="row">
<div class="links">
<ul>
- <li class="current-version">Currently v1.5</li>
- <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org">Docs</a></li>
+ <li class="current-version">Generated by v1.6b2</li>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/1.6-branch/">Docs</a></li>
<li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
<li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
<li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
+ </ul>
</div>
</div>
<div class="row">
diff --git a/docs/narr/MyProject/myproject/tests.py b/docs/narr/MyProject/myproject/tests.py
index 64dcab1d5..37df08a2a 100644
--- a/docs/narr/MyProject/myproject/tests.py
+++ b/docs/narr/MyProject/myproject/tests.py
@@ -15,3 +15,15 @@ class ViewTests(unittest.TestCase):
request = testing.DummyRequest()
info = my_view(request)
self.assertEqual(info['project'], 'MyProject')
+
+
+class FunctionalTests(unittest.TestCase):
+ def setUp(self):
+ from myproject import main
+ app = main({})
+ from webtest import TestApp
+ self.testapp = TestApp(app)
+
+ def test_root(self):
+ res = self.testapp.get('/', status=200)
+ self.assertTrue('Pyramid' in res.body)
diff --git a/docs/narr/MyProject/production.ini b/docs/narr/MyProject/production.ini
index 9eae9e03f..3ccbe6619 100644
--- a/docs/narr/MyProject/production.ini
+++ b/docs/narr/MyProject/production.ini
@@ -51,4 +51,4 @@ level = NOTSET
formatter = generic
[formatter_generic]
-format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
diff --git a/docs/narr/advconfig.rst b/docs/narr/advconfig.rst
index 9ceaaa495..bdcdf45a4 100644
--- a/docs/narr/advconfig.rst
+++ b/docs/narr/advconfig.rst
@@ -6,12 +6,11 @@
Advanced Configuration
======================
-To support application extensibility, the :app:`Pyramid`
-:term:`Configurator`, by default, detects configuration conflicts and allows
-you to include configuration imperatively from other packages or modules. It
-also, by default, performs configuration in two separate phases. This allows
-you to ignore relative configuration statement ordering in some
-circumstances.
+To support application extensibility, the :app:`Pyramid` :term:`Configurator`
+by default detects configuration conflicts and allows you to include
+configuration imperatively from other packages or modules. It also by default
+performs configuration in two separate phases. This allows you to ignore
+relative configuration statement ordering in some circumstances.
.. index::
pair: configuration; conflict detection
@@ -70,11 +69,11 @@ try to add another view to the configuration with the same set of
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
-The application now has two conflicting view configuration statements. When
-we try to start it again, it won't start. Instead, we'll receive a traceback
-that ends something like this:
+The application now has two conflicting view configuration statements. When we
+try to start it again, it won't start. Instead we'll receive a traceback that
+ends something like this:
-.. code-block:: guess
+.. code-block:: text
:linenos:
Traceback (most recent call last):
@@ -94,19 +93,19 @@ that ends something like this:
This traceback is trying to tell us:
-- We've got conflicting information for a set of view configuration
- statements (The ``For:`` line).
+- We've got conflicting information for a set of view configuration statements
+ (The ``For:`` line).
- There are two statements which conflict, shown beneath the ``For:`` line:
``config.add_view(hello_world. 'hello')`` on line 14 of ``app.py``, and
``config.add_view(goodbye_world, 'hello')`` on line 17 of ``app.py``.
-These two configuration statements are in conflict because we've tried to
-tell the system that the set of :term:`predicate` values for both view
+These two configuration statements are in conflict because we've tried to tell
+the system that the set of :term:`predicate` values for both view
configurations are exactly the same. Both the ``hello_world`` and
``goodbye_world`` views are configured to respond under the same set of
-circumstances. This circumstance: the :term:`view name` (represented by the
-``name=`` predicate) is ``hello``.
+circumstances. This circumstance, the :term:`view name` represented by the
+``name=`` predicate, is ``hello``.
This presents an ambiguity that :app:`Pyramid` cannot resolve. Rather than
allowing the circumstance to go unreported, by default Pyramid raises a
@@ -138,8 +137,7 @@ made by your application. Use the detail provided in the
modify your configuration code accordingly.
If you're getting a conflict while trying to extend an existing application,
-and that application has a function which performs configuration like this
-one:
+and that application has a function which performs configuration like this one:
.. code-block:: python
:linenos:
@@ -147,8 +145,8 @@ one:
def add_routes(config):
config.add_route(...)
-Don't call this function directly with ``config`` as an argument. Instead,
-use :meth:`pyramid.config.Configurator.include`:
+Don't call this function directly with ``config`` as an argument. Instead, use
+:meth:`pyramid.config.Configurator.include`:
.. code-block:: python
:linenos:
@@ -156,9 +154,9 @@ use :meth:`pyramid.config.Configurator.include`:
config.include(add_routes)
Using :meth:`~pyramid.config.Configurator.include` instead of calling the
-function directly provides a modicum of automated conflict resolution, with
-the configuration statements you define in the calling code overriding those
-of the included function.
+function directly provides a modicum of automated conflict resolution, with the
+configuration statements you define in the calling code overriding those of the
+included function.
.. seealso::
@@ -169,10 +167,10 @@ Using ``config.commit()``
+++++++++++++++++++++++++
You can manually commit a configuration by using the
-:meth:`~pyramid.config.Configurator.commit` method between configuration
-calls. For example, we prevent conflicts from occurring in the application
-we examined previously as the result of adding a ``commit``. Here's the
-application that generates conflicts:
+:meth:`~pyramid.config.Configurator.commit` method between configuration calls.
+For example, we prevent conflicts from occurring in the application we examined
+previously as the result of adding a ``commit``. Here's the application that
+generates conflicts:
.. code-block:: python
:linenos:
@@ -199,11 +197,12 @@ application that generates conflicts:
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
-We can prevent the two ``add_view`` calls from conflicting by issuing a call
-to :meth:`~pyramid.config.Configurator.commit` between them:
+We can prevent the two ``add_view`` calls from conflicting by issuing a call to
+:meth:`~pyramid.config.Configurator.commit` between them:
.. code-block:: python
:linenos:
+ :emphasize-lines: 16
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
@@ -230,21 +229,20 @@ to :meth:`~pyramid.config.Configurator.commit` between them:
server.serve_forever()
In the above example we've issued a call to
-:meth:`~pyramid.config.Configurator.commit` between the two ``add_view``
-calls. :meth:`~pyramid.config.Configurator.commit` will execute any pending
+:meth:`~pyramid.config.Configurator.commit` between the two ``add_view`` calls.
+:meth:`~pyramid.config.Configurator.commit` will execute any pending
configuration statements.
Calling :meth:`~pyramid.config.Configurator.commit` is safe at any time. It
-executes all pending configuration actions and leaves the configuration
-action list "clean".
+executes all pending configuration actions and leaves the configuration action
+list "clean".
-Note that :meth:`~pyramid.config.Configurator.commit` has no effect when
-you're using an *autocommitting* configurator (see
-:ref:`autocommitting_configurator`).
+Note that :meth:`~pyramid.config.Configurator.commit` has no effect when you're
+using an *autocommitting* configurator (see :ref:`autocommitting_configurator`).
.. _autocommitting_configurator:
-Using An Autocommitting Configurator
+Using an Autocommitting Configurator
++++++++++++++++++++++++++++++++++++
You can also use a heavy hammer to circumvent conflict detection by using a
@@ -278,17 +276,17 @@ Automatic Conflict Resolution
If your code uses the :meth:`~pyramid.config.Configurator.include` method to
include external configuration, some conflicts are automatically resolved.
Configuration statements that are made as the result of an "include" will be
-overridden by configuration statements that happen within the caller of
-the "include" method.
+overridden by configuration statements that happen within the caller of the
+"include" method.
-Automatic conflict resolution supports this goal: if a user wants to reuse a
+Automatic conflict resolution supports this goal. If a user wants to reuse a
Pyramid application, and they want to customize the configuration of this
application without hacking its code "from outside", they can "include" a
configuration function from the package and override only some of its
configuration statements within the code that does the include. No conflicts
will be generated by configuration statements within the code that does the
-including, even if configuration statements in the included code would
-conflict if it was moved "up" to the calling code.
+including, even if configuration statements in the included code would conflict
+if it was moved "up" to the calling code.
Methods Which Provide Conflict Detection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -312,9 +310,9 @@ These are the methods of the configurator which provide conflict detection:
:meth:`~pyramid.config.Configurator.add_resource_url_adapter`,
and :meth:`~pyramid.config.Configurator.add_response_adapter`.
-:meth:`~pyramid.config.Configurator.add_static_view` also indirectly
-provides conflict detection, because it's implemented in terms of the
-conflict-aware ``add_route`` and ``add_view`` methods.
+:meth:`~pyramid.config.Configurator.add_static_view` also indirectly provides
+conflict detection, because it's implemented in terms of the conflict-aware
+``add_route`` and ``add_view`` methods.
.. index::
pair: configuration; including from external sources
@@ -324,10 +322,10 @@ conflict-aware ``add_route`` and ``add_view`` methods.
Including Configuration from External Sources
---------------------------------------------
-Some application programmers will factor their configuration code in such a
-way that it is easy to reuse and override configuration statements. For
-example, such a developer might factor out a function used to add routes to
-his application:
+Some application programmers will factor their configuration code in such a way
+that it is easy to reuse and override configuration statements. For example,
+such a developer might factor out a function used to add routes to their
+application:
.. code-block:: python
:linenos:
@@ -335,8 +333,8 @@ his application:
def add_routes(config):
config.add_route(...)
-Rather than calling this function directly with ``config`` as an argument.
-Instead, use :meth:`pyramid.config.Configurator.include`:
+Rather than calling this function directly with ``config`` as an argument,
+instead use :meth:`pyramid.config.Configurator.include`:
.. code-block:: python
:linenos:
@@ -363,21 +361,21 @@ the special name ``includeme``, which should perform configuration (like the
:meth:`~pyramid.config.Configurator.include` can also accept a :term:`dotted
Python name` to a function or a module.
-.. note: See :ref:`the_include_tag` for a declarative alternative to
- the :meth:`~pyramid.config.Configurator.include` method.
+.. note:: See :ref:`the_include_tag` for a declarative alternative to the
+ :meth:`~pyramid.config.Configurator.include` method.
.. _twophase_config:
Two-Phase Configuration
-----------------------
-When a non-autocommitting :term:`Configurator` is used to do configuration
-(the default), configuration execution happens in two phases. In the first
-phase, "eager" configuration actions (actions that must happen before all
-others, such as registering a renderer) are executed, and *discriminators*
-are computed for each of the actions that depend on the result of the eager
-actions. In the second phase, the discriminators of all actions are compared
-to do conflict detection.
+When a non-autocommitting :term:`Configurator` is used to do configuration (the
+default), configuration execution happens in two phases. In the first phase,
+"eager" configuration actions (actions that must happen before all others, such
+as registering a renderer) are executed, and *discriminators* are computed for
+each of the actions that depend on the result of the eager actions. In the
+second phase, the discriminators of all actions are compared to do conflict
+detection.
Due to this, for configuration methods that have no internal ordering
constraints, execution order of configuration method calls is not important.
@@ -401,15 +399,14 @@ Has the same result as:
config.add_view('some.view', renderer='path_to_custom/renderer.rn')
Even though the view statement depends on the registration of a custom
-renderer, due to two-phase configuration, the order in which the
-configuration statements are issued is not important. ``add_view`` will be
-able to find the ``.rn`` renderer even if ``add_renderer`` is called after
-``add_view``.
+renderer, due to two-phase configuration, the order in which the configuration
+statements are issued is not important. ``add_view`` will be able to find the
+``.rn`` renderer even if ``add_renderer`` is called after ``add_view``.
The same is untrue when you use an *autocommitting* configurator (see
:ref:`autocommitting_configurator`). When an autocommitting configurator is
-used, two-phase configuration is disabled, and configuration statements must
-be ordered in dependency order.
+used, two-phase configuration is disabled, and configuration statements must be
+ordered in dependency order.
Some configuration methods, such as
:meth:`~pyramid.config.Configurator.add_route` have internal ordering
@@ -420,7 +417,6 @@ added in configuration execution order.
More Information
----------------
-For more information, see the article, `"A Whirlwind Tour of Advanced
-Configuration Tactics"
-<http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/configuration/whirlwind_tour.html>`_,
-in the Pyramid Cookbook.
+For more information, see the article :ref:`A Whirlwind Tour of Advanced
+Configuration Tactics <cookbook:whirlwind-adv-conf>` in the Pyramid Community
+Cookbook.
diff --git a/docs/narr/assets.rst b/docs/narr/assets.rst
index b0a8d18b0..58f547fc9 100644
--- a/docs/narr/assets.rst
+++ b/docs/narr/assets.rst
@@ -7,8 +7,8 @@
Static Assets
=============
-An :term:`asset` is any file contained within a Python :term:`package` which
-is *not* a Python source code file. For example, each of the following is an
+An :term:`asset` is any file contained within a Python :term:`package` which is
+*not* a Python source code file. For example, each of the following is an
asset:
- a GIF image file contained within a Python package or contained within any
@@ -20,20 +20,20 @@ asset:
- a JavaScript source file contained within a Python package or contained
within any subdirectory of a Python package.
-- A directory within a package that does not have an ``__init__.py``
- in it (if it possessed an ``__init__.py`` it would *be* a package).
+- A directory within a package that does not have an ``__init__.py`` in it (if
+ it possessed an ``__init__.py`` it would *be* a package).
- a :term:`Chameleon` or :term:`Mako` template file contained within a Python
package.
The use of assets is quite common in most web development projects. For
example, when you create a :app:`Pyramid` application using one of the
-available scaffolds, as described in :ref:`creating_a_project`, the
-directory representing the application contains a Python :term:`package`.
-Within that Python package, there are directories full of files which are
-static assets. For example, there's a ``static`` directory which contains
-``.css``, ``.js``, and ``.gif`` files. These asset files are delivered when
-a user visits an application URL.
+available scaffolds, as described in :ref:`creating_a_project`, the directory
+representing the application contains a Python :term:`package`. Within that
+Python package, there are directories full of files which are static assets.
+For example, there's a ``static`` directory which contains ``.css``, ``.js``,
+and ``.gif`` files. These asset files are delivered when a user visits an
+application URL.
.. index::
single: asset specifications
@@ -45,10 +45,10 @@ Understanding Asset Specifications
Let's imagine you've created a :app:`Pyramid` application that uses a
:term:`Chameleon` ZPT template via the
-:func:`pyramid.renderers.render_to_response` API. For example, the
-application might address the asset using the :term:`asset specification`
-``myapp:templates/some_template.pt`` using that API within a ``views.py``
-file inside a ``myapp`` package:
+:func:`pyramid.renderers.render_to_response` API. For example, the application
+might address the asset using the :term:`asset specification`
+``myapp:templates/some_template.pt`` using that API within a ``views.py`` file
+inside a ``myapp`` package:
.. code-block:: python
:linenos:
@@ -66,23 +66,23 @@ two parts:
- The *asset name* (``templates/some_template.pt``), relative to the package
directory.
-The two parts are separated by the colon character.
+The two parts are separated by a colon ``:`` character.
-:app:`Pyramid` uses the Python :term:`pkg_resources` API to resolve the
-package name and asset name to an absolute (operating-system-specific) file
-name. It eventually passes this resolved absolute filesystem path to the
-Chameleon templating engine, which then uses it to load, parse, and execute
-the template file.
+:app:`Pyramid` uses the Python :term:`pkg_resources` API to resolve the package
+name and asset name to an absolute (operating system-specific) file name. It
+eventually passes this resolved absolute filesystem path to the Chameleon
+templating engine, which then uses it to load, parse, and execute the template
+file.
There is a second form of asset specification: a *relative* asset
specification. Instead of using an "absolute" asset specification which
includes the package name, in certain circumstances you can omit the package
name from the specification. For example, you might be able to use
``templates/mytemplate.pt`` instead of ``myapp:templates/some_template.pt``.
-Such asset specifications are usually relative to a "current package." The
+Such asset specifications are usually relative to a "current package". The
"current package" is usually the package which contains the code that *uses*
the asset specification. :app:`Pyramid` APIs which accept relative asset
-specifications typically describe what the asset is relative to in their
+specifications typically describe to what the asset is relative in their
individual documentation.
.. index::
@@ -96,17 +96,17 @@ Serving Static Assets
:app:`Pyramid` makes it possible to serve up static asset files from a
directory on a filesystem to an application user's browser. Use the
-:meth:`pyramid.config.Configurator.add_static_view` to instruct
-:app:`Pyramid` to serve static assets such as JavaScript and CSS files. This
-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.
+:meth:`pyramid.config.Configurator.add_static_view` to instruct :app:`Pyramid`
+to serve static assets, such as JavaScript and CSS files. This 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::
- :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`.
+ :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`.
Here's an example of a use of
:meth:`~pyramid.config.Configurator.add_static_view` that will serve files up
@@ -121,11 +121,11 @@ from the ``/var/www/static`` directory of the computer which runs the
The ``name`` represents a URL *prefix*. In order for files that live in the
``path`` directory to be served, a URL that requests one of them must begin
-with that prefix. In the example above, ``name`` is ``static``, and ``path``
-is ``/var/www/static``. In English, this means that you wish to serve the
-files that live in ``/var/www/static`` as sub-URLs of the ``/static`` URL
-prefix. Therefore, the file ``/var/www/static/foo.css`` will be returned
-when the user visits your application's URL ``/static/foo.css``.
+with that prefix. In the example above, ``name`` is ``static`` and ``path`` is
+``/var/www/static``. In English this means that you wish to serve the files
+that live in ``/var/www/static`` as sub-URLs of the ``/static`` URL prefix.
+Therefore, the file ``/var/www/static/foo.css`` will be returned when the user
+visits your application's URL ``/static/foo.css``.
A static directory named at ``path`` may contain subdirectories recursively,
and any subdirectories may hold files; these will be resolved by the static
@@ -134,16 +134,16 @@ view for each particular type of file is dependent upon its file extension.
By default, all files made available via
:meth:`~pyramid.config.Configurator.add_static_view` are accessible by
-completely anonymous users. Simple authorization can be required, however.
-To protect a set of static files using a permission, in addition to passing
-the required ``name`` and ``path`` arguments, also pass the ``permission``
-keyword argument to :meth:`~pyramid.config.Configurator.add_static_view`.
-The value of the ``permission`` argument represents the :term:`permission`
-that the user must have relative to the current :term:`context` when the
-static view is invoked. A user will be required to possess this permission
-to view any of the files represented by ``path`` of the static view. If your
-static assets must be protected by a more complex authorization scheme,
-see :ref:`advanced_static`.
+completely anonymous users. Simple authorization can be required, however. To
+protect a set of static files using a permission, in addition to passing the
+required ``name`` and ``path`` arguments, also pass the ``permission`` keyword
+argument to :meth:`~pyramid.config.Configurator.add_static_view`. The value of
+the ``permission`` argument represents the :term:`permission` that the user
+must have relative to the current :term:`context` when the static view is
+invoked. A user will be required to possess this permission to view any of the
+files represented by ``path`` of the static view. If your static assets must
+be protected by a more complex authorization scheme, see
+:ref:`advanced_static`.
Here's another example that uses an :term:`asset specification` instead of an
absolute path as the ``path`` argument. To convince
@@ -163,31 +163,31 @@ may be a fully qualified :term:`asset specification` or an *absolute path*.
Instead of representing a URL prefix, the ``name`` argument of a call to
:meth:`~pyramid.config.Configurator.add_static_view` can alternately be a
-*URL*. Each of examples we've seen so far have shown usage of the ``name``
-argument as a URL prefix. However, when ``name`` is a *URL*, static assets
-can be served from an external webserver. In this mode, the ``name`` is used
-as the URL prefix when generating a URL using
+*URL*. Each of the examples we've seen so far have shown usage of the ``name``
+argument as a URL prefix. However, when ``name`` is a *URL*, static assets can
+be served from an external webserver. In this mode, the ``name`` is used as
+the URL prefix when generating a URL using
:meth:`pyramid.request.Request.static_url`.
-For example, :meth:`~pyramid.config.Configurator.add_static_view` may
-be fed a ``name`` argument which is ``http://example.com/images``:
+For example, :meth:`~pyramid.config.Configurator.add_static_view` may be fed a
+``name`` argument which is ``http://example.com/images``:
.. code-block:: python
:linenos:
# config is an instance of pyramid.config.Configurator
- config.add_static_view(name='http://example.com/images',
+ config.add_static_view(name='http://example.com/images',
path='mypackage:images')
-Because :meth:`~pyramid.config.Configurator.add_static_view` is provided with
-a ``name`` argument that is the URL ``http://example.com/images``, subsequent
-calls to :meth:`~pyramid.request.Request.static_url` with paths that start
-with the ``path`` argument passed to
+Because :meth:`~pyramid.config.Configurator.add_static_view` is provided with a
+``name`` argument that is the URL ``http://example.com/images``, subsequent
+calls to :meth:`~pyramid.request.Request.static_url` with paths that start with
+the ``path`` argument passed to
:meth:`~pyramid.config.Configurator.add_static_view` will generate a URL
-something like ``http://example.com/images/logo.png``. The external
-webserver listening on ``example.com`` must be itself configured to respond
-properly to such a request. The :meth:`~pyramid.request.Request.static_url`
-API is discussed in more detail later in this chapter.
+something like ``http://example.com/images/logo.png``. The external webserver
+listening on ``example.com`` must be itself configured to respond properly to
+such a request. The :meth:`~pyramid.request.Request.static_url` API is
+discussed in more detail later in this chapter.
.. index::
single: generating static asset urls
@@ -199,11 +199,11 @@ API is discussed in more detail later in this chapter.
Generating Static Asset URLs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When a :meth:`~pyramid.config.Configurator.add_static_view` method is used to
+When an :meth:`~pyramid.config.Configurator.add_static_view` method is used to
register a static asset directory, a special helper API named
:meth:`pyramid.request.Request.static_url` can be used to generate the
-appropriate URL for an asset that lives in one of the directories named by
-the static registration ``path`` attribute.
+appropriate URL for an asset that lives in one of the directories named by the
+static registration ``path`` attribute.
For example, let's assume you create a set of static declarations like so:
@@ -213,12 +213,12 @@ For example, let's assume you create a set of static declarations like so:
config.add_static_view(name='static1', path='mypackage:assets/1')
config.add_static_view(name='static2', path='mypackage:assets/2')
-These declarations create URL-accessible directories which have URLs that
-begin with ``/static1`` and ``/static2``, respectively. The assets in the
+These declarations create URL-accessible directories which have URLs that begin
+with ``/static1`` and ``/static2``, respectively. The assets in the
``assets/1`` directory of the ``mypackage`` package are consulted when a user
-visits a URL which begins with ``/static1``, and the assets in the
-``assets/2`` directory of the ``mypackage`` package are consulted when a user
-visits a URL which begins with ``/static2``.
+visits a URL which begins with ``/static1``, and the assets in the ``assets/2``
+directory of the ``mypackage`` package are consulted when a user visits a URL
+which begins with ``/static2``.
You needn't generate the URLs to static assets "by hand" in such a
configuration. Instead, use the :meth:`~pyramid.request.Request.static_url`
@@ -238,8 +238,8 @@ API to generate them for you. For example:
If the request "application URL" of the running system is
``http://example.com``, the ``css_url`` generated above would be:
-``http://example.com/static1/foo.css``. The ``js_url`` generated
-above would be ``http://example.com/static2/foo.js``.
+``http://example.com/static1/foo.css``. The ``js_url`` generated above would
+be ``http://example.com/static2/foo.js``.
One benefit of using the :meth:`~pyramid.request.Request.static_url` function
rather than constructing static URLs "by hand" is that if you need to change
@@ -249,19 +249,18 @@ resolve properly after the rename.
URLs may also be generated by :meth:`~pyramid.request.Request.static_url` to
static assets that live *outside* the :app:`Pyramid` application. This will
happen when the :meth:`~pyramid.config.Configurator.add_static_view` API
-associated with the path fed to :meth:`~pyramid.request.Request.static_url`
-is a *URL* instead of a view name. For example, the ``name`` argument may be
-``http://example.com`` while the ``path`` given may be
-``mypackage:images``:
+associated with the path fed to :meth:`~pyramid.request.Request.static_url` is
+a *URL* instead of a view name. For example, the ``name`` argument may be
+``http://example.com`` while the ``path`` given may be ``mypackage:images``:
.. code-block:: python
:linenos:
- config.add_static_view(name='http://example.com/images',
+ config.add_static_view(name='http://example.com/images',
path='mypackage:images')
-Under such a configuration, the URL generated by ``static_url`` for
-assets which begin with ``mypackage:images`` will be prefixed with
+Under such a configuration, the URL generated by ``static_url`` for assets
+which begin with ``mypackage:images`` will be prefixed with
``http://example.com/images``:
.. code-block:: python
@@ -271,24 +270,318 @@ assets which begin with ``mypackage:images`` will be prefixed with
# -> http://example.com/images/logo.png
Using :meth:`~pyramid.request.Request.static_url` in conjunction with a
-:meth:`~pyramid.config.Configurator.add_static_view` makes it possible
-to put static media on a separate webserver during production (if the
-``name`` argument to :meth:`~pyramid.config.Configurator.add_static_view` is
-a URL), while keeping static media package-internal and served by the
-development webserver during development (if the ``name`` argument to
-:meth:`~pyramid.config.Configurator.add_static_view` is a URL prefix). To
-create such a circumstance, we suggest using the
-:attr:`pyramid.registry.Registry.settings` API in conjunction with a setting
-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
-suggestion for a pattern; any setting name other than ``media_location``
-could be used.
+:meth:`~pyramid.config.Configurator.add_static_view` makes it possible to put
+static media on a separate webserver during production (if the ``name``
+argument to :meth:`~pyramid.config.Configurator.add_static_view` is a URL),
+while keeping static media package-internal and served by the development
+webserver during development (if the ``name`` argument to
+:meth:`~pyramid.config.Configurator.add_static_view` is a URL prefix).
+
+For example, we may define a :ref:`custom setting <adding_a_custom_setting>`
+named ``media_location`` which we can set to an external URL in production when
+our assets are hosted on a CDN.
+
+.. code-block:: python
+ :linenos:
+
+ media_location = settings.get('media_location', 'static')
+
+ config = Configurator(settings=settings)
+ config.add_static_view(path='myapp:static', name=media_location)
+
+Now we can optionally define the setting in our ini file:
+
+.. code-block:: ini
+ :linenos:
+
+ # production.ini
+ [app:main]
+ use = egg:myapp#main
+
+ media_location = http://static.example.com/
+
+It is also possible to serve assets that live outside of the source by
+referring to an absolute path on the filesystem. There are two ways to
+accomplish this.
+
+First, :meth:`~pyramid.config.Configurator.add_static_view` supports taking an
+absolute path directly instead of an asset spec. This works as expected,
+looking in the file or folder of files and serving them up at some URL within
+your application or externally. Unfortunately, this technique has a drawback in
+that it is not possible to use the :meth:`~pyramid.request.Request.static_url`
+method to generate URLs, since it works based on an asset specification.
+
+.. versionadded:: 1.6
+
+The second approach, available in Pyramid 1.6+, uses the asset overriding APIs
+described in the :ref:`overriding_assets_section` section. It is then possible
+to configure a "dummy" package which then serves its file or folder from an
+absolute path.
+
+.. code-block:: python
+
+ config.add_static_view(path='myapp:static_images', name='static')
+ config.override_asset(to_override='myapp:static_images/',
+ override_with='/abs/path/to/images/')
+
+From this configuration it is now possible to use
+:meth:`~pyramid.request.Request.static_url` to generate URLs to the data in the
+folder by doing something like
+``request.static_url('myapp:static_images/foo.png')``. While it is not
+necessary that the ``static_images`` file or folder actually exist in the
+``myapp`` package, it is important that the ``myapp`` portion points to a valid
+package. If the folder does exist, then the overriden folder is given priority,
+if the file's name exists in both locations.
+
+.. index::
+ single: Cache Busting
+
+.. _cache_busting:
+
+Cache Busting
+-------------
+
+.. versionadded:: 1.6
+
+In order to maximize performance of a web application, you generally want to
+limit the number of times a particular client requests the same static asset.
+Ideally a client would cache a particular static asset "forever", requiring it
+to be sent to the client a single time. The HTTP protocol allows you to send
+headers with an HTTP response that can instruct a client to cache a particular
+asset for an amount of time. As long as the client has a copy of the asset in
+its cache and that cache hasn't expired, the client will use the cached copy
+rather than request a new copy from the server. The drawback to sending cache
+headers to the client for a static asset is that at some point the static asset
+may change, and then you'll want the client to load a new copy of the asset.
+Under normal circumstances you'd just need to wait for the client's cached copy
+to expire before they get the new version of the static resource.
+
+A commonly used workaround to this problem is a technique known as
+:term:`cache busting`. Cache busting schemes generally involve generating a
+URL for a static asset that changes when the static asset changes. This way
+headers can be sent along with the static asset instructing the client to cache
+the asset for a very long time. When a static asset is changed, the URL used
+to refer to it in a web page also changes, so the client sees it as a new
+resource and requests the asset, regardless of any caching policy set for the
+resource's old URL.
+
+:app:`Pyramid` can be configured to produce cache busting URLs for static
+assets using :meth:`~pyramid.config.Configurator.add_cache_buster`:
+
+.. code-block:: python
+ :linenos:
+
+ import time
+ from pyramid.static import QueryStringConstantCacheBuster
+
+ # config is an instance of pyramid.config.Configurator
+ config.add_static_view(name='static', path='mypackage:folder/static/')
+ config.add_cache_buster(
+ 'mypackage:folder/static/',
+ QueryStringConstantCacheBuster(str(int(time.time()))))
+
+Adding the cachebuster instructs :app:`Pyramid` to add the current time for
+a static asset to the query string in the asset's URL:
+
+.. code-block:: python
+ :linenos:
+
+ js_url = request.static_url('mypackage:folder/static/js/myapp.js')
+ # Returns: 'http://www.example.com/static/js/myapp.js?x=1445318121'
+
+When the web server restarts, the time constant will change and therefore so
+will its URL.
+
+.. note::
+
+ Cache busting is an inherently complex topic as it integrates the asset
+ pipeline and the web application. It is expected and desired that
+ application authors will write their own cache buster implementations
+ conforming to the properties of their own asset pipelines. See
+ :ref:`custom_cache_busters` for information on writing your own.
+
+Disabling the Cache Buster
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+It can be useful in some situations (e.g., development) to globally disable all
+configured cache busters without changing calls to
+:meth:`~pyramid.config.Configurator.add_cache_buster`. To do this set the
+``PYRAMID_PREVENT_CACHEBUST`` environment variable or the
+``pyramid.prevent_cachebust`` configuration value to a true value.
+
+.. _custom_cache_busters:
+
+Customizing the Cache Buster
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Calls to :meth:`~pyramid.config.Configurator.add_cache_buster` may use
+any object that implements the interface
+:class:`~pyramid.interfaces.ICacheBuster`.
+
+:app:`Pyramid` ships with a very simplistic
+:class:`~pyramid.static.QueryStringConstantCacheBuster`, which adds an
+arbitrary token you provide to the query string of the asset's URL. This
+is almost never what you want in production as it does not allow fine-grained
+busting of individual assets.
+
+In order to implement your own cache buster, you can write your own class from
+scratch which implements the :class:`~pyramid.interfaces.ICacheBuster`
+interface. Alternatively you may choose to subclass one of the existing
+implementations. One of the most likely scenarios is you'd want to change the
+way the asset token is generated. To do this just subclass
+:class:`~pyramid.static.QueryStringCacheBuster` and define a
+``tokenize(pathspec)`` method. Here is an example which uses Git to get
+the hash of the current commit:
+
+.. code-block:: python
+ :linenos:
+
+ import os
+ import subprocess
+ from pyramid.static import QueryStringCacheBuster
+
+ class GitCacheBuster(QueryStringCacheBuster):
+ """
+ Assuming your code is installed as a Git checkout, as opposed to an egg
+ from an egg repository like PYPI, you can use this cachebuster to get
+ the current commit's SHA1 to use as the cache bust token.
+ """
+ def __init__(self, param='x', repo_path=None):
+ super(GitCacheBuster, self).__init__(param=param)
+ if repo_path is None:
+ repo_path = os.path.dirname(os.path.abspath(__file__))
+ self.sha1 = subprocess.check_output(
+ ['git', 'rev-parse', 'HEAD'],
+ cwd=repo_path).strip()
+
+ def tokenize(self, pathspec):
+ return self.sha1
+
+A simple cache buster that modifies the path segment can be constructed as
+well:
+
+.. code-block:: python
+ :linenos:
+
+ import posixpath
+
+ class PathConstantCacheBuster(object):
+ def __init__(self, token):
+ self.token = token
+
+ def __call__(self, request, subpath, kw):
+ base_subpath, ext = posixpath.splitext(subpath)
+ new_subpath = base_subpath + self.token + ext
+ return new_subpath, kw
+
+The caveat with this approach is that modifying the path segment
+changes the file name, and thus must match what is actually on the
+filesystem in order for :meth:`~pyramid.config.Configurator.add_static_view`
+to find the file. It's better to use the
+:class:`~pyramid.static.ManifestCacheBuster` for these situations, as
+described in the next section.
+
+.. _path_segment_cache_busters:
+
+Path Segments and Choosing a Cache Buster
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Many caching HTTP proxies will fail to cache a resource if the URL contains
+a query string. Therefore, in general, you should prefer a cache busting
+strategy which modifies the path segment rather than methods which add a
+token to the query string.
+
+You will need to consider whether the :app:`Pyramid` application will be
+serving your static assets, whether you are using an external asset pipeline
+to handle rewriting urls internal to the css/javascript, and how fine-grained
+do you want the cache busting tokens to be.
+
+In many cases you will want to host the static assets on another web server
+or externally on a CDN. In these cases your :app:`Pyramid` application may not
+even have access to a copy of the static assets. In order to cache bust these
+assets you will need some information about them.
+
+If you are using an external asset pipeline to generate your static files you
+should consider using the :class:`~pyramid.static.ManifestCacheBuster`.
+This cache buster can load a standard JSON formatted file generated by your
+pipeline and use it to cache bust the assets. This has many performance
+advantages as :app:`Pyramid` does not need to look at the files to generate
+any cache busting tokens, but still supports fine-grained per-file tokens.
+
+Assuming an example ``manifest.json`` like:
+
+.. code-block:: json
+
+ {
+ "css/main.css": "css/main-678b7c80.css",
+ "images/background.png": "images/background-a8169106.png"
+ }
+
+The following code would set up a cachebuster:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.static import ManifestCacheBuster
+
+ config.add_static_view(
+ name='http://mycdn.example.com/',
+ path='mypackage:static')
+
+ config.add_cache_buster(
+ 'mypackage:static/',
+ ManifestCacheBuster('myapp:static/manifest.json'))
+
+It's important to note that the cache buster only handles generating
+cache-busted URLs for static assets. It does **NOT** provide any solutions for
+serving those assets. For example, if you generated a URL for
+``css/main-678b7c80.css`` then that URL needs to be valid either by
+configuring ``add_static_view`` properly to point to the location of the files
+or some other mechanism such as the files existing on your CDN or rewriting
+the incoming URL to remove the cache bust tokens.
.. index::
single: static assets view
+CSS and JavaScript source and cache busting
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Often one needs to refer to images and other static assets inside CSS and
+JavaScript files. If cache busting is active, the final static asset URL is not
+available until the static assets have been assembled. These URLs cannot be
+handwritten. Below is an example of how to integrate the cache buster into
+the entire stack. Remember, it is just an example and should be modified to
+fit your specific tools.
+
+* First, process the files by using a precompiler which rewrites URLs to their
+ final cache-busted form. Then, you can use the
+ :class:`~pyramid.static.ManifestCacheBuster` to synchronize your asset
+ pipeline with :app:`Pyramid`, allowing the pipeline to have full control
+ over the final URLs of your assets.
+
+Now that you are able to generate static URLs within :app:`Pyramid`,
+you'll need to handle URLs that are out of our control. To do this you may
+use some of the following options to get started:
+
+* Configure your asset pipeline to rewrite URL references inline in
+ CSS and JavaScript. This is the best approach because then the files
+ may be hosted by :app:`Pyramid` or an external CDN without having to
+ change anything. They really are static.
+
+* Templatize JS and CSS, and call ``request.static_url()`` inside their
+ template code. While this approach may work in certain scenarios, it is not
+ recommended because your static assets will not really be static and are now
+ dependent on :app:`Pyramid` to be served correctly. See
+ :ref:`advanced_static` for more information on this approach.
+
+If your CSS and JavaScript assets use URLs to reference other assets it is
+recommended that you implement an external asset pipeline that can rewrite the
+generated static files with new URLs containing cache busting tokens. The
+machinery inside :app:`Pyramid` will not help with this step as it has very
+little knowledge of the asset types your application may use. The integration
+into :app:`Pyramid` is simply for linking those assets into your HTML and
+other dynamic content.
+
.. _advanced_static:
Advanced: Serving Static Assets Using a View Callable
@@ -296,13 +589,13 @@ Advanced: Serving Static Assets Using a View Callable
For more flexibility, static assets can be served by a :term:`view callable`
which you register manually. For example, if you're using :term:`URL
-dispatch`, you may want static assets to only be available as a fallback if
-no previous route matches. Alternately, you might like to serve a particular
+dispatch`, you may want static assets to only be available as a fallback if no
+previous route matches. Alternatively, you might like to serve a particular
static asset manually, because its download requires authentication.
-Note that you cannot use the :meth:`~pyramid.request.Request.static_url` API
-to generate URLs against assets made accessible by registering a custom
-static view.
+Note that you cannot use the :meth:`~pyramid.request.Request.static_url` API to
+generate URLs against assets made accessible by registering a custom static
+view.
Root-Relative Custom Static View (URL Dispatch Only)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -316,19 +609,19 @@ its behavior is almost exactly the same once it's configured.
.. warning::
The following example *will not work* for applications that use
- :term:`traversal`, it will only work if you use :term:`URL dispatch`
+ :term:`traversal`; it will only work if you use :term:`URL dispatch`
exclusively. The root-relative route we'll be registering will always be
matched before traversal takes place, subverting any views registered via
``add_view`` (at least those without a ``route_name``). A
:class:`~pyramid.static.static_view` static view cannot be made
- root-relative when you use traversal unless it's registered as a
- :term:`Not Found View`.
+ root-relative when you use traversal unless it's registered as a :term:`Not
+ Found View`.
To serve files within a directory located on your filesystem at
``/path/to/static/dir`` as the result of a "catchall" route hanging from the
root that exists at the end of your routing table, create an instance of the
-:class:`~pyramid.static.static_view` class inside a ``static.py`` file in
-your application root as below.
+:class:`~pyramid.static.static_view` class inside a ``static.py`` file in your
+application root as below.
.. code-block:: python
:linenos:
@@ -338,10 +631,10 @@ your application root as below.
.. note::
- For better cross-system flexibility, use an :term:`asset
- specification` as the argument to :class:`~pyramid.static.static_view`
- instead of a physical absolute filesystem path, e.g. ``mypackage:static``
- instead of ``/path/to/mypackage/static``.
+ For better cross-system flexibility, use an :term:`asset specification` as
+ the argument to :class:`~pyramid.static.static_view` instead of a physical
+ absolute filesystem path, e.g., ``mypackage:static``, instead of
+ ``/path/to/mypackage/static``.
Subsequently, you may wire the files that are served by this view up to be
accessible as ``/<filename>`` using a configuration method in your
@@ -360,11 +653,11 @@ The special name ``*subpath`` above is used by the
:class:`~pyramid.static.static_view` view callable to signify the path of the
file relative to the directory you're serving.
-Registering A View Callable to Serve a "Static" Asset
+Registering a View Callable to Serve a "Static" Asset
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-You can register a simple view callable to serve a single static asset. To
-do so, do things "by hand". First define the view callable.
+You can register a simple view callable to serve a single static asset. To do
+so, do things "by hand". First define the view callable.
.. code-block:: python
:linenos:
@@ -377,17 +670,16 @@ do so, do things "by hand". First define the view callable.
icon = os.path.join(here, 'static', 'favicon.ico')
return FileResponse(icon, request=request)
-The above bit of code within ``favicon_view`` computes "here", which is a
-path relative to the Python file in which the function is defined. It then
-creates a :class:`pyramid.response.FileResponse` using the file path as the
-response's ``path`` argument and the request as the response's ``request``
-argument. :class:`pyramid.response.FileResponse` will serve the file as
-quickly as possible when it's used this way. It makes sure to set the right
-content length and content_type too based on the file extension of the file
-you pass.
+The above bit of code within ``favicon_view`` computes "here", which is a path
+relative to the Python file in which the function is defined. It then creates
+a :class:`pyramid.response.FileResponse` using the file path as the response's
+``path`` argument and the request as the response's ``request`` argument.
+:class:`pyramid.response.FileResponse` will serve the file as quickly as
+possible when it's used this way. It makes sure to set the right content
+length and content_type, too, based on the file extension of the file you pass.
-You might register such a view via configuration as a view callable that
-should be called as the result of a traversal:
+You might register such a view via configuration as a view callable that should
+be called as the result of a traversal:
.. code-block:: python
:linenos:
@@ -420,13 +712,12 @@ It can often be useful to override specific assets from "outside" a given
:app:`Pyramid` application more or less unchanged. However, some specific
template file owned by the application might have inappropriate HTML, or some
static asset (such as a logo file or some CSS file) might not be appropriate.
-You *could* just fork the application entirely, but it's often more
-convenient to just override the assets that are inappropriate and reuse the
-application "as is". This is particularly true when you reuse some "core"
-application over and over again for some set of customers (such as a CMS
-application, or some bug tracking application), and you want to make
-arbitrary visual modifications to a particular application deployment without
-forking the underlying code.
+You *could* just fork the application entirely, but it's often more convenient
+to just override the assets that are inappropriate and reuse the application
+"as is". This is particularly true when you reuse some "core" application over
+and over again for some set of customers (such as a CMS application, or some
+bug tracking application), and you want to make arbitrary visual modifications
+to a particular application deployment without forking the underlying code.
To this end, :app:`Pyramid` contains a feature that makes it possible to
"override" one asset with one or more other assets. In support of this
@@ -444,8 +735,8 @@ feature, a :term:`Configurator` API exists named
- A directory of static files served up by an instance of the
``pyramid.static.static_view`` helper class.
-- Any other asset (or set of assets) addressed by code that uses the
- setuptools :term:`pkg_resources` API.
+- Any other asset (or set of assets) addressed by code that uses the setuptools
+ :term:`pkg_resources` API.
.. index::
single: override_asset
@@ -455,8 +746,8 @@ feature, a :term:`Configurator` API exists named
The ``override_asset`` API
~~~~~~~~~~~~~~~~~~~~~~~~~~
-An individual call to :meth:`~pyramid.config.Configurator.override_asset`
-can override a single asset. For example:
+An individual call to :meth:`~pyramid.config.Configurator.override_asset` can
+override a single asset. For example:
.. code-block:: python
:linenos:
@@ -466,11 +757,11 @@ can override a single asset. For example:
override_with='another.package:othertemplates/anothertemplate.pt')
The string value passed to both ``to_override`` and ``override_with`` sent to
-the ``override_asset`` API is called an :term:`asset specification`. The
-colon separator in a specification separates the *package name* from the
-*asset name*. The colon and the following asset name are optional. If they
-are not specified, the override attempts to resolve every lookup into a
-package from the directory of another package. For example:
+the ``override_asset`` API is called an :term:`asset specification`. The colon
+separator in a specification separates the *package name* from the *asset
+name*. The colon and the following asset name are optional. If they are not
+specified, the override attempts to resolve every lookup into a package from
+the directory of another package. For example:
.. code-block:: python
:linenos:
@@ -486,27 +777,25 @@ Individual subdirectories within a package can also be overridden:
config.override_asset(to_override='some.package:templates/',
override_with='another.package:othertemplates/')
-
-If you wish to override a directory with another directory, you *must*
-make sure to attach the slash to the end of both the ``to_override``
-specification and the ``override_with`` specification. If you fail to
-attach a slash to the end of a specification that points to a directory,
-you will get unexpected results.
+If you wish to override a directory with another directory, you *must* make
+sure to attach the slash to the end of both the ``to_override`` specification
+and the ``override_with`` specification. If you fail to attach a slash to the
+end of a specification that points to a directory, you will get unexpected
+results.
You cannot override a directory specification with a file specification, and
-vice versa: a startup error will occur if you try. You cannot override an
-asset with itself: a startup error will occur if you try.
+vice versa; a startup error will occur if you try. You cannot override an
+asset with itself; a startup error will occur if you try.
Only individual *package* assets may be overridden. Overrides will not
-traverse through subpackages within an overridden package. This means that
-if you want to override assets for both ``some.package:templates``, and
+traverse through subpackages within an overridden package. This means that if
+you want to override assets for both ``some.package:templates``, and
``some.package.views:templates``, you will need to register two overrides.
-The package name in a specification may start with a dot, meaning that
-the package is relative to the package in which the configuration
-construction file resides (or the ``package`` argument to the
-:class:`~pyramid.config.Configurator` class construction).
-For example:
+The package name in a specification may start with a dot, meaning that the
+package is relative to the package in which the configuration construction file
+resides (or the ``package`` argument to the
+:class:`~pyramid.config.Configurator` class construction). For example:
.. code-block:: python
:linenos:
@@ -514,15 +803,72 @@ For example:
config.override_asset(to_override='.subpackage:templates/',
override_with='another.package:templates/')
-Multiple calls to ``override_asset`` which name a shared ``to_override`` but
-a different ``override_with`` specification can be "stacked" to form a search
-path. The first asset that exists in the search path will be used; if no
-asset exists in the override path, the original asset is used.
+Multiple calls to ``override_asset`` which name a shared ``to_override`` but a
+different ``override_with`` specification can be "stacked" to form a search
+path. The first asset that exists in the search path will be used; if no asset
+exists in the override path, the original asset is used.
Asset overrides can actually override assets other than templates and static
files. Any software which uses the
:func:`pkg_resources.get_resource_filename`,
-:func:`pkg_resources.get_resource_stream` or
+:func:`pkg_resources.get_resource_stream`, or
:func:`pkg_resources.get_resource_string` APIs will obtain an overridden file
when an override is used.
+.. versionadded:: 1.6
+ As of Pyramid 1.6, it is also possible to override an asset by supplying an
+ absolute path to a file or directory. This may be useful if the assets are
+ not distributed as part of a Python package.
+
+Cache Busting and Asset Overrides
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Overriding static assets that are being hosted using
+:meth:`pyramid.config.Configurator.add_static_view` can affect your cache
+busting strategy when using any cache busters that are asset-aware such as
+:class:`pyramid.static.ManifestCacheBuster`. What sets asset-aware cache
+busters apart is that they have logic tied to specific assets. For example,
+a manifest is only generated for a specific set of pre-defined assets. Now,
+imagine you have overridden an asset defined in this manifest with a new,
+unknown version. By default, the cache buster will be invoked for an asset
+it has never seen before and will likely end up returning a cache busting
+token for the original asset rather than the asset that will actually end up
+being served! In order to get around this issue, it's possible to attach a
+different :class:`pyramid.interfaces.ICacheBuster` implementation to the
+new assets. This would cause the original assets to be served by their
+manifest, and the new assets served by their own cache buster. To do this,
+:meth:`pyramid.config.Configurator.add_cache_buster` supports an ``explicit``
+option. For example:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.static import ManifestCacheBuster
+
+ # define a static view for myapp:static assets
+ config.add_static_view('static', 'myapp:static')
+
+ # setup a cache buster for your app based on the myapp:static assets
+ my_cb = ManifestCacheBuster('myapp:static/manifest.json')
+ config.add_cache_buster('myapp:static', my_cb)
+
+ # override an asset
+ config.override_asset(
+ to_override='myapp:static/background.png',
+ override_with='theme:static/background.png')
+
+ # override the cache buster for theme:static assets
+ theme_cb = ManifestCacheBuster('theme:static/manifest.json')
+ config.add_cache_buster('theme:static', theme_cb, explicit=True)
+
+In the above example there is a default cache buster, ``my_cb``, for all
+assets served from the ``myapp:static`` folder. This would also affect
+``theme:static/background.png`` when generating URLs via
+``request.static_url('myapp:static/background.png')``.
+
+The ``theme_cb`` is defined explicitly for any assets loaded from the
+``theme:static`` folder. Explicit cache busters have priority and thus
+``theme_cb`` would be invoked for
+``request.static_url('myapp:static/background.png')``, but ``my_cb`` would
+be used for any other assets like
+``request.static_url('myapp:static/favicon.ico')``.
diff --git a/docs/narr/commandline.rst b/docs/narr/commandline.rst
index 3cabbd8f4..34b12e1e9 100644
--- a/docs/narr/commandline.rst
+++ b/docs/narr/commandline.rst
@@ -3,9 +3,9 @@
Command-Line Pyramid
====================
-Your :app:`Pyramid` application can be controlled and inspected using a
-variety of command-line utilities. These utilities are documented in this
-chapter.
+Your :app:`Pyramid` application can be controlled and inspected using a variety
+of command-line utilities. These utilities are documented in this chapter.
+
.. index::
pair: matching views; printing
@@ -16,16 +16,18 @@ chapter.
Displaying Matching Views for a Given URL
-----------------------------------------
+.. seealso:: See also the output of :ref:`pviews --help <pviews_script>`.
+
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 ``pviews`` command in a terminal window to
-print a summary of matching routes and views for a given URL in your
-application. The ``pviews`` command accepts two arguments. The first
-argument to ``pviews`` is the path to your application's ``.ini`` file and
-section name inside the ``.ini`` file which points to your application. This
-should be of the format ``config_file#section_name``. The second argument is
-the URL to test for matching views. The ``section_name`` may be omitted; if
-it is, it's considered to be ``main``.
+configuration details in your head, even if you defined all the views yourself.
+You can use the ``pviews`` command in a terminal window to print a summary of
+matching routes and views for a given URL in your application. The ``pviews``
+command accepts two arguments. The first argument to ``pviews`` is the path to
+your application's ``.ini`` file and section name inside the ``.ini`` file
+which points to your application. This should be of the format
+``config_file#section_name``. The second argument is the URL to test for
+matching views. The ``section_name`` may be omitted; if it is, it's considered
+to be ``main``.
Here is an example for a simple view configuration using :term:`traversal`:
@@ -44,12 +46,11 @@ Here is an example for a simple view configuration using :term:`traversal`:
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.
+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:
@@ -99,36 +100,35 @@ A more complex configuration might generate something like this:
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.
+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, ``pviews`` will simply print out a
-*Not found* message.
+For a URL that doesn't match any views, ``pviews`` will simply print out a *Not
+found* message.
.. index::
single: interactive shell
- single: IPython
single: pshell
- single: bpython
.. _interactive_shell:
The Interactive Shell
---------------------
-Once you've installed your program for development using ``setup.py
-develop``, you can use an interactive Python shell to execute expressions in
-a Python environment exactly like the one that will be used when your
-application runs "for real". To do so, use the ``pshell`` command line
-utility.
+.. seealso:: See also the output of :ref:`pshell --help <pshell_script>`.
+
+Once you've installed your program for development using ``setup.py develop``,
+you can use an interactive Python shell to execute expressions in a Python
+environment exactly like the one that will be used when your application runs
+"for real". To do so, use the ``pshell`` command line utility.
The argument to ``pshell`` follows the format ``config_file#section_name``
where ``config_file`` is the path to your application's ``.ini`` file and
``section_name`` is the ``app`` section name inside the ``.ini`` file which
-points to your application. For example, if your application ``.ini`` file
-might have a ``[app:main]`` section that looks like so:
+points to your application. For example, your application ``.ini`` file might
+have an ``[app:main]`` section that looks like so:
.. code-block:: ini
:linenos:
@@ -141,13 +141,13 @@ might have a ``[app:main]`` section that looks like so:
pyramid.debug_templates = true
pyramid.default_locale_name = en
-If so, you can use the following command to invoke a debug shell using the
-name ``main`` as a section name:
+If so, you can use the following command to invoke a debug shell using the name
+``main`` as a section name:
.. code-block:: text
- $ $VENV/bin starter/development.ini#main
- Python 2.6.5 (r265:79063, Apr 29 2010, 00:31:32)
+ $ $VENV/bin/pshell starter/development.ini#main
+ Python 2.6.5 (r265:79063, Apr 29 2010, 00:31:32)
[GCC 4.4.3] on linux2
Type "help" for more information.
@@ -172,9 +172,8 @@ name ``main`` as a section name:
The WSGI application that is loaded will be available in the shell as the
``app`` global. Also, if the application that is loaded is the :app:`Pyramid`
-app with no surrounding :term:`middleware`, the ``root`` object returned by
-the default :term:`root factory`, ``registry``, and ``request`` will be
-available.
+app with no surrounding :term:`middleware`, the ``root`` object returned by the
+default :term:`root factory`, ``registry``, and ``request`` will be available.
You can also simply rely on the ``main`` default section name by omitting any
hash after the filename:
@@ -185,6 +184,7 @@ hash after the filename:
Press ``Ctrl-D`` to exit the interactive shell (or ``Ctrl-Z`` on Windows).
+
.. index::
pair: pshell; extending
@@ -193,22 +193,22 @@ Press ``Ctrl-D`` to exit the interactive shell (or ``Ctrl-Z`` on Windows).
Extending the Shell
~~~~~~~~~~~~~~~~~~~
-It is convenient when using the interactive shell often to have some
-variables significant to your application already loaded as globals when
-you start the ``pshell``. To facilitate this, ``pshell`` will look for a
-special ``[pshell]`` section in your INI file and expose the subsequent
-key/value pairs to the shell. Each key is a variable name that will be
-global within the pshell session; each value is a :term:`dotted Python name`.
-If specified, the special key ``setup`` should be a :term:`dotted Python name`
-pointing to a callable that accepts the dictionary of globals that will
-be loaded into the shell. This allows for some custom initializing code
-to be executed each time the ``pshell`` is run. The ``setup`` callable
-can also be specified from the commandline using the ``--setup`` option
-which will override the key in the INI file.
-
-For example, you want to expose your model to the shell, along with the
-database session so that you can mutate the model on an actual database.
-Here, we'll assume your model is stored in the ``myapp.models`` package.
+It is convenient when using the interactive shell often to have some variables
+significant to your application already loaded as globals when you start the
+``pshell``. To facilitate this, ``pshell`` will look for a special ``[pshell]``
+section in your INI file and expose the subsequent key/value pairs to the
+shell. Each key is a variable name that will be global within the pshell
+session; each value is a :term:`dotted Python name`. If specified, the special
+key ``setup`` should be a :term:`dotted Python name` pointing to a callable
+that accepts the dictionary of globals that will be loaded into the shell. This
+allows for some custom initializing code to be executed each time the
+``pshell`` is run. The ``setup`` callable can also be specified from the
+commandline using the ``--setup`` option which will override the key in the INI
+file.
+
+For example, you want to expose your model to the shell along with the database
+session so that you can mutate the model on an actual database. Here, we'll
+assume your model is stored in the ``myapp.models`` package.
.. code-block:: ini
:linenos:
@@ -236,16 +236,16 @@ of the application to which we can easily submit requests.
env['request'].scheme = 'https'
env['testapp'] = TestApp(env['app'])
-When this INI file is loaded, the extra variables ``m``, ``session`` and
-``t`` will be available for use immediately. Since a ``setup`` callable
-was also specified, it is executed and a new variable ``testapp`` is
-exposed, and the request is configured to generate urls from the host
+When this INI file is loaded, the extra variables ``m``, ``session`` and ``t``
+will be available for use immediately. Since a ``setup`` callable was also
+specified, it is executed and a new variable ``testapp`` is exposed, and the
+request is configured to generate urls from the host
``http://www.example.com``. For example:
.. code-block:: text
$ $VENV/bin/pshell starter/development.ini
- Python 2.6.5 (r265:79063, Apr 29 2010, 00:31:32)
+ Python 2.6.5 (r265:79063, Apr 29 2010, 00:31:32)
[GCC 4.4.3] on linux2
Type "help" for more information.
@@ -267,26 +267,78 @@ exposed, and the request is configured to generate urls from the host
>>> request.route_url('home')
'https://www.example.com/'
-.. index::
- single: IPython
- single: bpython
.. _ipython_or_bpython:
-IPython or bpython
+Alternative Shells
~~~~~~~~~~~~~~~~~~
-If you have `IPython <http://en.wikipedia.org/wiki/IPython>`_ and/or
-`bpython <http://bpython-interpreter.org/>`_ in
-the interpreter you use to invoke the ``pshell`` command, ``pshell`` will
-autodiscover and use the first one found, in this order:
-IPython, bpython, standard Python interpreter. However you could
-specifically invoke one of your choice with the ``-p choice`` or
+The ``pshell`` command can be easily extended with alternate REPLs if the
+default python REPL is not satisfactory. Assuming you have a binding
+installed such as ``pyramid_ipython`` it will normally be auto-selected and
+used. You may also specifically invoke your choice with the ``-p choice`` or
``--python-shell choice`` option.
.. code-block:: text
- $ $VENV/bin/pshell -p ipython | bpython | python development.ini#MyProject
+ $ $VENV/bin/pshell -p ipython development.ini#MyProject
+
+You may use the ``--list-shells`` option to see the available shells.
+
+.. code-block:: text
+
+ $ $VENV/bin/pshell --list-shells
+ Available shells:
+ bpython
+ ipython
+ python
+
+If you want to use a shell that isn't supported out of the box, you can
+introduce a new shell by registering an entry point in your setup.py:
+
+.. code-block:: python
+
+ setup(
+ entry_points={
+ 'pyramid.pshell_runner': [
+ 'myshell=my_app:ptpython_shell_factory',
+ ],
+ },
+ )
+
+And then your shell factory should return a function that accepts two
+arguments, ``env`` and ``help``, which would look like this:
+
+.. code-block:: python
+
+ from ptpython.repl import embed
+
+ def ptpython_shell_runner(env, help):
+ print(help)
+ return embed(locals=env)
+
+.. versionchanged:: 1.6
+ User-defined shells may be registered using entry points. Prior to this
+ the only supported shells were ``ipython``, ``bpython`` and ``python``.
+
+ ``ipython`` and ``bpython`` have been moved into their respective
+ packages ``pyramid_ipython`` and ``pyramid_bpython``.
+
+
+Setting a Default Shell
+~~~~~~~~~~~~~~~~~~~~~~~
+
+You may use the ``default_shell`` option in your ``[pshell]`` ini section to
+specify a list of preferred shells.
+
+.. code-block:: ini
+ :linenos:
+
+ [pshell]
+ default_shell = ptpython ipython bpython
+
+.. versionadded:: 1.6
+
.. index::
pair: routes; printing
@@ -297,14 +349,15 @@ specifically invoke one of your choice with the ``-p choice`` or
Displaying All Application Routes
---------------------------------
-You can use the ``proutes`` command in a terminal window to print a summary
-of routes related to your application. Much like the ``pshell``
-command (see :ref:`interactive_shell`), the ``proutes`` command
-accepts one argument with the format ``config_file#section_name``. The
-``config_file`` is the path to your application's ``.ini`` file, and
-``section_name`` is the ``app`` section name inside the ``.ini`` file which
-points to your application. By default, the ``section_name`` is ``main`` and
-can be omitted.
+.. seealso:: See also the output of :ref:`proutes --help <proutes_script>`.
+
+You can use the ``proutes`` command in a terminal window to print a summary of
+routes related to your application. Much like the ``pshell`` command (see
+:ref:`interactive_shell`), the ``proutes`` command accepts one argument with
+the format ``config_file#section_name``. The ``config_file`` is the path to
+your application's ``.ini`` file, and ``section_name`` is the ``app`` section
+name inside the ``.ini`` file which points to your application. By default,
+the ``section_name`` is ``main`` and can be omitted.
For example:
@@ -312,23 +365,63 @@ For example:
:linenos:
$ $VENV/bin/proutes development.ini
- 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>
-
-``proutes`` generates a table with three columns: *Name*, *Pattern*,
-and *View*. The items listed in the
-Name column are route names, the items listed 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 ``proutes``
-is executed.
+ Name Pattern View Method
+ ---- ------- ---- ------
+ debugtoolbar /_debug_toolbar/*subpath <wsgiapp> *
+ __static/ /static/*subpath dummy_starter:static/ *
+ __static2/ /static2/*subpath /var/www/static/ *
+ __pdt_images/ /pdt_images/*subpath pyramid_debugtoolbar:static/img/ *
+ a / <unknown> *
+ no_view_attached / <unknown> *
+ route_and_view_attached / app1.standard_views.route_and_view_attached *
+ method_conflicts /conflicts app1.standard_conflicts <route mismatch>
+ multiview /multiview app1.standard_views.multiview GET,PATCH
+ not_post /not_post app1.standard_views.multview !POST,*
+
+``proutes`` generates a table with four columns: *Name*, *Pattern*, *View*, and
+*Method*. The items listed in the Name column are route names, the items
+listed in the Pattern column are route patterns, 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, and the items listed in the
+Method column are the request methods that are associated with the route name.
+The View column may show ``<unknown>`` if no associated view callable could be
+found. The Method column, for the route name, may show either ``<route
+mismatch>`` if the view callable does not accept any of the route's request
+methods, or ``*`` if the view callable will accept any of the route's request
+methods. If no routes are configured within your application, nothing will be
+printed to the console when ``proutes`` is executed.
+
+It is convenient when using the ``proutes`` command often to configure which
+columns and the order you would like to view them. To facilitate this,
+``proutes`` will look for a special ``[proutes]`` section in your ``.ini`` file
+and use those as defaults.
+
+For example you may remove the request method and place the view first:
+
+.. code-block:: text
+ :linenos:
+
+ [proutes]
+ format = view
+ name
+ pattern
+
+You can also separate the formats with commas or spaces:
+
+.. code-block:: text
+ :linenos:
+
+ [proutes]
+ format = view name pattern
+
+ [proutes]
+ format = view, name, pattern
+
+If you want to temporarily configure the columns and order, there is the
+argument ``--format``, which is a comma separated list of columns you want to
+include. The current available formats are ``name``, ``pattern``, ``view``, and
+``method``.
+
.. index::
pair: tweens; printing
@@ -339,17 +432,18 @@ is executed.
Displaying "Tweens"
-------------------
-A :term:`tween` is a bit of code that sits between the main Pyramid
-application request handler and the WSGI application which calls it. A user
-can get a representation of both the implicit tween ordering (the ordering
-specified by calls to :meth:`pyramid.config.Configurator.add_tween`) and the
-explicit tween ordering (specified by the ``pyramid.tweens`` configuration
-setting) orderings using the ``ptweens`` command. Tween factories
-will show up represented by their standard Python dotted name in the
-``ptweens`` output.
+.. seealso:: See also the output of :ref:`ptweens --help <ptweens_script>`.
-For example, here's the ``ptweens`` command run against a system
-configured without any explicit tweens:
+A :term:`tween` is a bit of code that sits between the main Pyramid application
+request handler and the WSGI application which calls it. A user can get a
+representation of both the implicit tween ordering (the ordering specified by
+calls to :meth:`pyramid.config.Configurator.add_tween`) and the explicit tween
+ordering (specified by the ``pyramid.tweens`` configuration setting) using the
+``ptweens`` command. Tween factories will show up represented by their
+standard Python dotted name in the ``ptweens`` output.
+
+For example, here's the ``ptweens`` command run against a system configured
+without any explicit tweens:
.. code-block:: text
:linenos:
@@ -359,15 +453,15 @@ configured without any explicit tweens:
Implicit Tween Chain
- Position Name Alias
+ Position Name Alias
-------- ---- -----
- - INGRESS
0 pyramid_debugtoolbar.toolbar.toolbar_tween_factory pdbt
1 pyramid.tweens.excview_tween_factory excview
- - MAIN
-Here's the ``ptweens`` command run against a system configured *with*
-explicit tweens defined in its ``development.ini`` file:
+Here's the ``ptweens`` command run against a system configured *with* explicit
+tweens defined in its ``development.ini`` file:
.. code-block:: text
:linenos:
@@ -377,13 +471,13 @@ explicit tweens defined in its ``development.ini`` file:
Explicit Tween Chain (used)
- Position Name
- -------- ----
- - INGRESS
- 0 starter.tween_factory2
- 1 starter.tween_factory1
- 2 pyramid.tweens.excview_tween_factory
- - MAIN
+ Position Name
+ -------- ----
+ - INGRESS
+ 0 starter.tween_factory2
+ 1 starter.tween_factory1
+ 2 pyramid.tweens.excview_tween_factory
+ - MAIN
Implicit Tween Chain (not used)
@@ -394,9 +488,9 @@ explicit tweens defined in its ``development.ini`` file:
1 pyramid.tweens.excview_tween_factory
- MAIN
-Here's the application configuration section of the ``development.ini`` used
-by the above ``ptweens`` command which reports that the explicit tween chain
-is used:
+Here's the application configuration section of the ``development.ini`` used by
+the above ``ptweens`` command which reports that the explicit tween chain is
+used:
.. code-block:: ini
:linenos:
@@ -416,6 +510,7 @@ is used:
See :ref:`registering_tweens` for more information about tweens.
+
.. index::
single: invoking a request
single: prequest
@@ -425,18 +520,20 @@ See :ref:`registering_tweens` for more information about tweens.
Invoking a Request
------------------
+.. seealso:: See also the output of :ref:`prequest --help <prequest_script>`.
+
You can use the ``prequest`` command-line utility to send a request to your
application and see the response body without starting a server.
There are two required arguments to ``prequest``:
-- The config file/section: follows the format ``config_file#section_name``
+- The config file/section: follows the format ``config_file#section_name``,
where ``config_file`` is the path to your application's ``.ini`` file and
``section_name`` is the ``app`` section name inside the ``.ini`` file. The
- ``section_name`` is optional, it defaults to ``main``. For example:
+ ``section_name`` is optional; it defaults to ``main``. For example:
``development.ini``.
-- The path: this should be the non-url-quoted path element of the URL to the
+- The path: this should be the non-URL-quoted path element of the URL to the
resource you'd like to be rendered on the server. For example, ``/``.
For example::
@@ -446,61 +543,73 @@ For example::
This will print the body of the response to the console on which it was
invoked.
-Several options are supported by ``prequest``. These should precede any
-config file name or URL.
+Several options are supported by ``prequest``. These should precede any config
+file name or URL.
-``prequest`` has a ``-d`` (aka ``--display-headers``) option which prints the
+``prequest`` has a ``-d`` (i.e., ``--display-headers``) option which prints the
status and headers returned by the server before the output::
$ $VENV/bin/prequest -d development.ini /
-This will print the status, then the headers, then the body of the response
-to the console.
+This will print the status, headers, and the body of the response to the
+console.
You can add request header values by using the ``--header`` option::
$ $VENV/bin/prequest --header=Host:example.com development.ini /
-Headers are added to the WSGI environment by converting them to their
-CGI/WSGI equivalents (e.g. ``Host=example.com`` will insert the ``HTTP_HOST``
-header variable as the value ``example.com``). Multiple ``--header`` options
-can be supplied. The special header value ``content-type`` sets the
-``CONTENT_TYPE`` in the WSGI environment.
+Headers are added to the WSGI environment by converting them to their CGI/WSGI
+equivalents (e.g., ``Host=example.com`` will insert the ``HTTP_HOST`` header
+variable as the value ``example.com``). Multiple ``--header`` options can be
+supplied. The special header value ``content-type`` sets the ``CONTENT_TYPE``
+in the WSGI environment.
-By default, ``prequest`` sends a ``GET`` request. You can change this by
-using the ``-m`` (aka ``--method``) option. ``GET``, ``HEAD``, ``POST`` and
-``DELETE`` are currently supported. When you use ``POST``, the standard
-input of the ``prequest`` process is used as the ``POST`` body::
+By default, ``prequest`` sends a ``GET`` request. You can change this by using
+the ``-m`` (aka ``--method``) option. ``GET``, ``HEAD``, ``POST``, and
+``DELETE`` are currently supported. When you use ``POST``, the standard input
+of the ``prequest`` process is used as the ``POST`` body::
$ $VENV/bin/prequest -mPOST development.ini / < somefile
+
Using Custom Arguments to Python when Running ``p*`` Scripts
------------------------------------------------------------
.. versionadded:: 1.5
-Each of Pyramid's console scripts (``pserve``, ``pviews``, etc) can be run
+Each of Pyramid's console scripts (``pserve``, ``pviews``, etc.) can be run
directly using ``python -m``, allowing custom arguments to be sent to the
-python interpreter at runtime. For example::
+Python interpreter at runtime. For example::
python -3 -m pyramid.scripts.pserve development.ini
-Showing All Installed Distributions and their Versions
+
+.. index::
+ single: pdistreport
+ single: distributions, showing installed
+ single: showing installed distributions
+
+.. _showing_distributions:
+
+Showing All Installed Distributions and Their Versions
------------------------------------------------------
.. versionadded:: 1.5
-You can use the ``pdistreport`` command to show the Pyramid version in use, the
-Python version in use, and all installed versions of Python distributions in
-your Python environment::
+.. seealso:: See also the output of :ref:`pdistreport --help
+ <pdistreport_script>`.
+
+You can use the ``pdistreport`` command to show the :app:`Pyramid` version in
+use, the Python version in use, and all installed versions of Python
+distributions in your Python environment::
$ $VENV/bin/pdistreport
- Pyramid version: 1.5dev
- Platform Linux-3.2.0-51-generic-x86_64-with-debian-wheezy-sid
- Packages:
- authapp 0.0
- /home/chrism/projects/foo/src/authapp
- beautifulsoup4 4.1.3
+ Pyramid version: 1.5dev
+ Platform Linux-3.2.0-51-generic-x86_64-with-debian-wheezy-sid
+ Packages:
+ authapp 0.0
+ /home/chrism/projects/foo/src/authapp
+ beautifulsoup4 4.1.3
/home/chrism/projects/foo/lib/python2.7/site-packages/beautifulsoup4-4.1.3-py2.7.egg
... more output ...
@@ -509,41 +618,40 @@ pastebin when you are having problems and need someone with more familiarity
with Python packaging and distribution than you have to look at your
environment.
+
.. _writing_a_script:
Writing a Script
----------------
All web applications are, at their hearts, systems which accept a request and
-return a response. When a request is accepted by a :app:`Pyramid`
-application, the system receives state from the request which is later relied
-on by your application code. For example, one :term:`view callable` may assume
-it's working against a request that has a ``request.matchdict`` of a
-particular composition, while another assumes a different composition of the
-matchdict.
+return a response. When a request is accepted by a :app:`Pyramid` application,
+the system receives state from the request which is later relied on by your
+application code. For example, one :term:`view callable` may assume it's
+working against a request that has a ``request.matchdict`` of a particular
+composition, while another assumes a different composition of the matchdict.
In the meantime, it's convenient to be able to write a Python script that can
-work "in a Pyramid environment", for instance to update database tables used
-by your :app:`Pyramid` application. But a "real" Pyramid environment doesn't
-have a completely static state independent of a request; your application
-(and Pyramid itself) is almost always reliant on being able to obtain
-information from a request. When you run a Python script that simply imports
-code from your application and tries to run it, there just is no request
-data, because there isn't any real web request. Therefore some parts of your
-application and some Pyramid APIs will not work.
+work "in a Pyramid environment", for instance to update database tables used by
+your :app:`Pyramid` application. But a "real" Pyramid environment doesn't have
+a completely static state independent of a request; your application (and
+Pyramid itself) is almost always reliant on being able to obtain information
+from a request. When you run a Python script that simply imports code from
+your application and tries to run it, there just is no request data, because
+there isn't any real web request. Therefore some parts of your application and
+some Pyramid APIs will not work.
For this reason, :app:`Pyramid` makes it possible to run a script in an
environment much like the environment produced when a particular
:term:`request` reaches your :app:`Pyramid` application. This is achieved by
-using the :func:`pyramid.paster.bootstrap` command in the body of your
-script.
+using the :func:`pyramid.paster.bootstrap` command in the body of your script.
.. versionadded:: 1.1
:func:`pyramid.paster.bootstrap`
In the simplest case, :func:`pyramid.paster.bootstrap` can be used with a
single argument, which accepts the :term:`PasteDeploy` ``.ini`` file
-representing Pyramid your application configuration as a single argument:
+representing your Pyramid application's configuration as a single argument:
.. code-block:: python
@@ -579,14 +687,13 @@ registry
closer
- A parameterless callable that can be used to pop an internal
- :app:`Pyramid` threadlocal stack (used by
- :func:`pyramid.threadlocal.get_current_registry` and
- :func:`pyramid.threadlocal.get_current_request`) when your scripting job
- is finished.
+ A parameterless callable that can be used to pop an internal :app:`Pyramid`
+ threadlocal stack (used by :func:`pyramid.threadlocal.get_current_registry`
+ and :func:`pyramid.threadlocal.get_current_request`) when your scripting
+ job is finished.
-Let's assume that the ``/path/to/my/development.ini`` file used in the
-example above looks like so:
+Let's assume that the ``/path/to/my/development.ini`` file used in the example
+above looks like so:
.. code-block:: ini
@@ -603,15 +710,15 @@ example above looks like so:
use = egg:MyProject
The configuration loaded by the above bootstrap example will use the
-configuration implied by the ``[pipeline:main]`` section of your
-configuration file by default. Specifying ``/path/to/my/development.ini`` is
-logically equivalent to specifying ``/path/to/my/development.ini#main``. In
-this case, we'll be using a configuration that includes an ``app`` object
-which is wrapped in the Paste "translogger" :term:`middleware` (which logs
-requests to the console).
+configuration implied by the ``[pipeline:main]`` section of your configuration
+file by default. Specifying ``/path/to/my/development.ini`` is logically
+equivalent to specifying ``/path/to/my/development.ini#main``. In this case,
+we'll be using a configuration that includes an ``app`` object which is wrapped
+in the Paste "translogger" :term:`middleware` (which logs requests to the
+console).
-You can also specify a particular *section* of the PasteDeploy ``.ini`` file
-to load instead of ``main``:
+You can also specify a particular *section* of the PasteDeploy ``.ini`` file to
+load instead of ``main``:
.. code-block:: python
@@ -624,13 +731,14 @@ The above example specifies the ``another`` ``app``, ``pipeline``, or
object present in the ``env`` dictionary returned by
:func:`pyramid.paster.bootstrap` will be a :app:`Pyramid` :term:`router`.
+
Changing the Request
~~~~~~~~~~~~~~~~~~~~
By default, Pyramid will generate a request object in the ``env`` dictionary
-for the URL ``http://localhost:80/``. This means that any URLs generated
-by Pyramid during the execution of your script will be anchored here. This
-is generally not what you want.
+for the URL ``http://localhost:80/``. This means that any URLs generated by
+Pyramid during the execution of your script will be anchored here. This is
+generally not what you want.
So how do we make Pyramid generate the correct URLs?
@@ -642,10 +750,10 @@ Assuming that you have a route configured in your application like so:
You need to inform the Pyramid environment that the WSGI application is
handling requests from a certain base. For example, we want to simulate
-mounting our application at `https://example.com/prefix`, to ensure that
-the generated URLs are correct for our deployment. This can be done by
-either mutating the resulting request object, or more simply by constructing
-the desired request and passing it into :func:`~pyramid.paster.bootstrap`:
+mounting our application at `https://example.com/prefix`, to ensure that the
+generated URLs are correct for our deployment. This can be done by either
+mutating the resulting request object, or more simply by constructing the
+desired request and passing it into :func:`~pyramid.paster.bootstrap`:
.. code-block:: python
@@ -664,6 +772,7 @@ Now you can readily use Pyramid's APIs for generating URLs:
env['request'].route_url('verify', code='1337')
# will return 'https://example.com/prefix/verify/1337'
+
Cleanup
~~~~~~~
@@ -679,6 +788,7 @@ callback:
env['closer']()
+
Setting Up Logging
~~~~~~~~~~~~~~~~~~
@@ -695,6 +805,7 @@ use the following command:
See :ref:`logging_chapter` for more information on logging within
:app:`Pyramid`.
+
.. index::
single: console script
@@ -704,43 +815,43 @@ Making Your Script into a Console Script
----------------------------------------
A "console script" is :term:`setuptools` terminology for a script that gets
-installed into the ``bin`` directory of a Python :term:`virtualenv` (or
-"base" Python environment) when a :term:`distribution` which houses that
-script is installed. Because it's installed into the ``bin`` directory of a
-virtualenv when the distribution is installed, it's a convenient way to
-package and distribute functionality that you can call from the command-line.
-It's often more convenient to create a console script than it is to create a
-``.py`` script and instruct people to call it with the "right" Python
-interpreter. A console script generates a file that lives in ``bin``, and when it's
-invoked it will always use the "right" Python environment, which means it
-will always be invoked in an environment where all the libraries it needs
-(such as Pyramid) are available.
+installed into the ``bin`` directory of a Python :term:`virtualenv` (or "base"
+Python environment) when a :term:`distribution` which houses that script is
+installed. Because it's installed into the ``bin`` directory of a virtualenv
+when the distribution is installed, it's a convenient way to package and
+distribute functionality that you can call from the command-line. It's often
+more convenient to create a console script than it is to create a ``.py``
+script and instruct people to call it with the "right" Python interpreter. A
+console script generates a file that lives in ``bin``, and when it's invoked it
+will always use the "right" Python environment, which means it will always be
+invoked in an environment where all the libraries it needs (such as Pyramid)
+are available.
In general, you can make your script into a console script by doing the
following:
- Use an existing distribution (such as one you've already created via
- ``pcreate``) or create a new distribution that possesses at least one
- package or module. It should, within any module within the distribution,
- house a callable (usually a function) that takes no arguments and which
- runs any of the code you wish to run.
+ ``pcreate``) or create a new distribution that possesses at least one package
+ or module. It should, within any module within the distribution, house a
+ callable (usually a function) that takes no arguments and which runs any of
+ the code you wish to run.
- Add a ``[console_scripts]`` section to the ``entry_points`` argument of the
- distribution which creates a mapping between a script name and a dotted
- name representing the callable you added to your distribution.
+ distribution which creates a mapping between a script name and a dotted name
+ representing the callable you added to your distribution.
- Run ``setup.py develop``, ``setup.py install``, or ``easy_install`` to get
- your distribution reinstalled. When you reinstall your distribution, a
- file representing the script that you named in the last step will be in the
- ``bin`` directory of the virtualenv in which you installed the
- distribution. It will be executable. Invoking it from a terminal will
- execute your callable.
+ your distribution reinstalled. When you reinstall your distribution, a file
+ representing the script that you named in the last step will be in the
+ ``bin`` directory of the virtualenv in which you installed the distribution.
+ It will be executable. Invoking it from a terminal will execute your
+ callable.
As an example, let's create some code that can be invoked by a console script
-that prints the deployment settings of a Pyramid application. To do so,
-we'll pretend you have a distribution with a package in it named
-``myproject``. Within this package, we'll pretend you've added a
-``scripts.py`` module which contains the following code:
+that prints the deployment settings of a Pyramid application. To do so, we'll
+pretend you have a distribution with a package in it named ``myproject``.
+Within this package, we'll pretend you've added a ``scripts.py`` module which
+contains the following code:
.. code-block:: python
:linenos:
@@ -799,7 +910,7 @@ defined in that config file.
After adding this script to the package, you'll need to tell your
distribution's ``setup.py`` about its existence. Within your distribution's
-top-level directory your ``setup.py`` file will look something like this:
+top-level directory, your ``setup.py`` file will look something like this:
.. code-block:: python
:linenos:
@@ -842,9 +953,9 @@ top-level directory your ``setup.py`` file will look something like this:
""",
)
-We're going to change the setup.py file to add an ``[console_scripts]``
-section with in the ``entry_points`` string. Within this section, you should
-specify a ``scriptname = dotted.path.to:yourfunction`` line. For example::
+We're going to change the setup.py file to add a ``[console_scripts]`` section
+within the ``entry_points`` string. Within this section, you should specify a
+``scriptname = dotted.path.to:yourfunction`` line. For example::
[console_scripts]
show_settings = myproject.scripts:settings_show
@@ -852,9 +963,9 @@ specify a ``scriptname = dotted.path.to:yourfunction`` line. For example::
The ``show_settings`` name will be the name of the script that is installed
into ``bin``. The colon (``:``) between ``myproject.scripts`` and
``settings_show`` above indicates that ``myproject.scripts`` is a Python
-module, and ``settings_show`` is the function in that module which contains
-the code you'd like to run as the result of someone invoking the
-``show_settings`` script from their command line.
+module, and ``settings_show`` is the function in that module which contains the
+code you'd like to run as the result of someone invoking the ``show_settings``
+script from their command line.
The result will be something like:
@@ -901,29 +1012,28 @@ The result will be something like:
""",
)
-Once you've done this, invoking ``$$VENV/bin/python setup.py
-develop`` will install a file named ``show_settings`` into the
-``$somevirtualenv/bin`` directory with a small bit of Python code that points
-to your entry point. It will be executable. Running it without any
-arguments will print an error and exit. Running it with a single argument
-that is the path of a config file will print the settings. Running it with
-an ``--omit=foo`` argument will omit the settings that have keys that start
-with ``foo``. Running it with two "omit" options (e.g. ``--omit=foo
---omit=bar``) will omit all settings that have keys that start with either
-``foo`` or ``bar``::
+Once you've done this, invoking ``$$VENV/bin/python setup.py develop`` will
+install a file named ``show_settings`` into the ``$somevirtualenv/bin``
+directory with a small bit of Python code that points to your entry point. It
+will be executable. Running it without any arguments will print an error and
+exit. Running it with a single argument that is the path of a config file will
+print the settings. Running it with an ``--omit=foo`` argument will omit the
+settings that have keys that start with ``foo``. Running it with two "omit"
+options (e.g., ``--omit=foo --omit=bar``) will omit all settings that have keys
+that start with either ``foo`` or ``bar``::
$ $VENV/bin/show_settings development.ini --omit=pyramid --omit=debugtoolbar
- debug_routematch False
- debug_templates True
- reload_templates True
- mako.directories []
- debug_notfound False
- default_locale_name en
- reload_resources False
- debug_authorization False
- reload_assets False
- prevent_http_cache False
-
-Pyramid's ``pserve``, ``pcreate``, ``pshell``, ``prequest``, ``ptweens`` and
+ debug_routematch False
+ debug_templates True
+ reload_templates True
+ mako.directories []
+ debug_notfound False
+ default_locale_name en
+ reload_resources False
+ debug_authorization False
+ reload_assets False
+ prevent_http_cache False
+
+Pyramid's ``pserve``, ``pcreate``, ``pshell``, ``prequest``, ``ptweens``, and
other ``p*`` scripts are implemented as console scripts. When you invoke one
of those, you are using a console script.
diff --git a/docs/narr/configuration.rst b/docs/narr/configuration.rst
index 52615533d..cde166b21 100644
--- a/docs/narr/configuration.rst
+++ b/docs/narr/configuration.rst
@@ -3,23 +3,26 @@
.. _configuration_narr:
-Application Configuration
+Application Configuration
=========================
Most people already understand "configuration" as settings that influence the
-operation of an application. For instance, it's easy to think of the values
-in a ``.ini`` file parsed at application startup time as "configuration".
-However, if you're reasonably open-minded, it's easy to think of *code* as
-configuration too. Since Pyramid, like most other web application platforms,
-is a *framework*, it calls into code that you write (as opposed to a
-*library*, which is code that exists purely for you to call). The act of
-plugging application code that you've written into :app:`Pyramid` is also
-referred to within this documentation as "configuration"; you are configuring
+operation of an application. For instance, it's easy to think of the values in
+a ``.ini`` file parsed at application startup time as "configuration". However,
+if you're reasonably open-minded, it's easy to think of *code* as configuration
+too. Since Pyramid, like most other web application platforms, is a
+*framework*, it calls into code that you write (as opposed to a *library*,
+which is code that exists purely for you to call). The act of plugging
+application code that you've written into :app:`Pyramid` is also referred to
+within this documentation as "configuration"; you are configuring
:app:`Pyramid` to call the code that makes up your application.
-There are two ways to configure a :app:`Pyramid` application:
-:term:`imperative configuration` and :term:`declarative configuration`. Both
-are described below.
+.. seealso::
+ For information on ``.ini`` files for Pyramid applications see the
+ :ref:`startup_chapter` chapter.
+
+There are two ways to configure a :app:`Pyramid` application: :term:`imperative
+configuration` and :term:`declarative configuration`. Both are described below.
.. index::
single: imperative configuration
@@ -29,9 +32,9 @@ are described below.
Imperative Configuration
------------------------
-"Imperative configuration" just means configuration done by Python
-statements, one after the next. Here's one of the simplest :app:`Pyramid`
-applications, configured imperatively:
+"Imperative configuration" just means configuration done by Python statements,
+one after the next. Here's one of the simplest :app:`Pyramid` applications,
+configured imperatively:
.. code-block:: python
:linenos:
@@ -53,9 +56,9 @@ applications, configured imperatively:
We won't talk much about what this application does yet. Just note that the
"configuration' statements take place underneath the ``if __name__ ==
'__main__':`` stanza in the form of method calls on a :term:`Configurator`
-object (e.g. ``config.add_view(...)``). These statements take place one
-after the other, and are executed in order, so the full power of Python,
-including conditionals, can be employed in this mode of configuration.
+object (e.g., ``config.add_view(...)``). These statements take place one after
+the other, and are executed in order, so the full power of Python, including
+conditionals, can be employed in this mode of configuration.
.. index::
single: view_config
@@ -68,13 +71,13 @@ Declarative Configuration
-------------------------
It's sometimes painful to have all configuration done by imperative code,
-because often the code for a single application may live in many files. If
-the configuration is centralized in one place, you'll need to have at least
-two files open at once to see the "big picture": the file that represents the
-configuration, and the file that contains the implementation objects
-referenced by the configuration. To avoid this, :app:`Pyramid` allows you to
-insert :term:`configuration decoration` statements very close to code that is
-referred to by the declaration itself. For example:
+because often the code for a single application may live in many files. If the
+configuration is centralized in one place, you'll need to have at least two
+files open at once to see the "big picture": the file that represents the
+configuration, and the file that contains the implementation objects referenced
+by the configuration. To avoid this, :app:`Pyramid` allows you to insert
+:term:`configuration decoration` statements very close to code that is referred
+to by the declaration itself. For example:
.. code-block:: python
:linenos:
@@ -86,20 +89,19 @@ referred to by the declaration itself. For example:
def hello(request):
return Response('Hello')
-The mere existence of configuration decoration doesn't cause any
-configuration registration to be performed. Before it has any effect on the
-configuration of a :app:`Pyramid` application, a configuration decoration
-within application code must be found through a process known as a
-:term:`scan`.
+The mere existence of configuration decoration doesn't cause any configuration
+registration to be performed. Before it has any effect on the configuration of
+a :app:`Pyramid` application, a configuration decoration within application
+code must be found through a process known as a :term:`scan`.
For example, the :class:`pyramid.view.view_config` decorator in the code
-example above adds an attribute to the ``hello`` function, making it
-available for a :term:`scan` to find it later.
+example above adds an attribute to the ``hello`` function, making it available
+for a :term:`scan` to find it later.
-A :term:`scan` of a :term:`module` or a :term:`package` and its subpackages
-for decorations happens when the :meth:`pyramid.config.Configurator.scan`
-method is invoked: scanning implies searching for configuration declarations
-in a package and its subpackages. For example:
+A :term:`scan` of a :term:`module` or a :term:`package` and its subpackages for
+decorations happens when the :meth:`pyramid.config.Configurator.scan` method is
+invoked: scanning implies searching for configuration declarations in a package
+and its subpackages. For example:
.. code-block:: python
:linenos:
@@ -121,16 +123,16 @@ in a package and its subpackages. For example:
server.serve_forever()
The scanning machinery imports each module and subpackage in a package or
-module recursively, looking for special attributes attached to objects
-defined within a module. These special attributes are typically attached to
-code via the use of a :term:`decorator`. For example, the
+module recursively, looking for special attributes attached to objects defined
+within a module. These special attributes are typically attached to code via
+the use of a :term:`decorator`. For example, the
:class:`~pyramid.view.view_config` decorator can be attached to a function or
instance method.
-Once scanning is invoked, and :term:`configuration decoration` is found by
-the scanner, a set of calls are made to a :term:`Configurator` on your
-behalf: these calls replace the need to add imperative configuration
-statements that don't live near the code being configured.
+Once scanning is invoked, and :term:`configuration decoration` is found by the
+scanner, a set of calls are made to a :term:`Configurator` on your behalf.
+These calls replace the need to add imperative configuration statements that
+don't live near the code being configured.
The combination of :term:`configuration decoration` and the invocation of a
:term:`scan` is collectively known as :term:`declarative configuration`.
@@ -146,7 +148,7 @@ In the example above, the scanner translates the arguments to
Summary
-------
-There are two ways to configure a :app:`Pyramid` application: declaratively
-and imperatively. You can choose the mode you're most comfortable with; both
-are completely equivalent. Examples in this documentation will use both
-modes interchangeably.
+There are two ways to configure a :app:`Pyramid` application: declaratively and
+imperatively. You can choose the mode with which you're most comfortable; both
+are completely equivalent. Examples in this documentation will use both modes
+interchangeably.
diff --git a/docs/narr/environment.rst b/docs/narr/environment.rst
index 412635f08..743266d2c 100644
--- a/docs/narr/environment.rst
+++ b/docs/narr/environment.rst
@@ -13,7 +13,6 @@
single: reload settings
single: default_locale_name
single: environment variables
- single: Mako environment settings
single: ini file settings
single: PasteDeploy settings
@@ -22,39 +21,36 @@
Environment Variables and ``.ini`` File Settings
================================================
-:app:`Pyramid` behavior can be configured through a combination of
-operating system environment variables and ``.ini`` configuration file
-application section settings. The meaning of the environment
-variables and the configuration file settings overlap.
+:app:`Pyramid` behavior can be configured through a combination of operating
+system environment variables and ``.ini`` configuration file application
+section settings. The meaning of the environment variables and the
+configuration file settings overlap.
-.. note:: Where a configuration file setting exists with the same
- meaning as an environment variable, and both are present at
- application startup time, the environment variable setting
- takes precedence.
+.. note::
+ Where a configuration file setting exists with the same meaning as an
+ environment variable, and both are present at application startup time, the
+ environment variable setting takes precedence.
-The term "configuration file setting name" refers to a key in the
-``.ini`` configuration for your application. The configuration file
-setting names documented in this chapter are reserved for
-:app:`Pyramid` use. You should not use them to indicate
-application-specific configuration settings.
+The term "configuration file setting name" refers to a key in the ``.ini``
+configuration for your application. The configuration file setting names
+documented in this chapter are reserved for :app:`Pyramid` use. You should not
+use them to indicate application-specific configuration settings.
Reloading Templates
-------------------
-When this value is true, templates are automatically reloaded whenever
-they are modified without restarting the application, so you can see
-changes to templates take effect immediately during development. This
-flag is meaningful to Chameleon and Mako templates, as well as most
-third-party template rendering extensions.
-
-+---------------------------------+--------------------------------+
-| Environment Variable Name | Config File Setting Name |
-+=================================+================================+
-| ``PYRAMID_RELOAD_TEMPLATES`` | ``pyramid.reload_templates`` |
-| | or ``reload_templates`` |
-| | |
-| | |
-+---------------------------------+--------------------------------+
+When this value is true, templates are automatically reloaded whenever they are
+modified without restarting the application, so you can see changes to
+templates take effect immediately during development. This flag is meaningful
+to Chameleon and Mako templates, as well as most third-party template rendering
+extensions.
+
++-------------------------------+--------------------------------+
+| Environment Variable Name | Config File Setting Name |
++===============================+================================+
+| ``PYRAMID_RELOAD_TEMPLATES`` | ``pyramid.reload_templates`` |
+| | or ``reload_templates`` |
++-------------------------------+--------------------------------+
Reloading Assets
----------------
@@ -65,24 +61,22 @@ Don't cache any asset file data when this value is true.
See also :ref:`overriding_assets_section`.
-+---------------------------------+-----------------------------+
-| Environment Variable Name | Config File Setting Name |
-+=================================+=============================+
-| ``PYRAMID_RELOAD_ASSETS`` | ``pyramid.reload_assets`` |
-| | or ``reload_assets`` |
-| | |
-| | |
-+---------------------------------+-----------------------------+
++----------------------------+-----------------------------+
+| Environment Variable Name | Config File Setting Name |
++============================+=============================+
+| ``PYRAMID_RELOAD_ASSETS`` | ``pyramid.reload_assets`` |
+| | or ``reload_assets`` |
++----------------------------+-----------------------------+
-.. note:: For backwards compatibility purposes, aliases can be
- used for configurating asset reloading: ``PYRAMID_RELOAD_RESOURCES`` (envvar)
- and ``pyramid.reload_resources`` (config file).
+.. note:: For backwards compatibility purposes, aliases can be used for
+ configuring asset reloading: ``PYRAMID_RELOAD_RESOURCES`` (envvar) and
+ ``pyramid.reload_resources`` (config file).
Debugging Authorization
-----------------------
-Print view authorization failure and success information to stderr
-when this value is true.
+Print view authorization failure and success information to stderr when this
+value is true.
.. seealso::
@@ -93,28 +87,24 @@ when this value is true.
+=================================+===================================+
| ``PYRAMID_DEBUG_AUTHORIZATION`` | ``pyramid.debug_authorization`` |
| | or ``debug_authorization`` |
-| | |
-| | |
+---------------------------------+-----------------------------------+
Debugging Not Found Errors
--------------------------
-Print view-related ``NotFound`` debug messages to stderr
-when this value is true.
+Print view-related ``NotFound`` debug messages to stderr when this value is
+true.
.. seealso::
See also :ref:`debug_notfound_section`.
-+---------------------------------+------------------------------+
-| Environment Variable Name | Config File Setting Name |
-+=================================+==============================+
-| ``PYRAMID_DEBUG_NOTFOUND`` | ``pyramid.debug_notfound`` |
-| | or ``debug_notfound`` |
-| | |
-| | |
-+---------------------------------+------------------------------+
++----------------------------+------------------------------+
+| Environment Variable Name | Config File Setting Name |
++============================+==============================+
+| ``PYRAMID_DEBUG_NOTFOUND`` | ``pyramid.debug_notfound`` |
+| | or ``debug_notfound`` |
++----------------------------+------------------------------+
Debugging Route Matching
------------------------
@@ -126,24 +116,22 @@ this value is true.
See also :ref:`debug_routematch_section`.
-+---------------------------------+--------------------------------+
-| Environment Variable Name | Config File Setting Name |
-+=================================+================================+
-| ``PYRAMID_DEBUG_ROUTEMATCH`` | ``pyramid.debug_routematch`` |
-| | or ``debug_routematch`` |
-| | |
-| | |
-+---------------------------------+--------------------------------+
++------------------------------+--------------------------------+
+| Environment Variable Name | Config File Setting Name |
++==============================+================================+
+| ``PYRAMID_DEBUG_ROUTEMATCH`` | ``pyramid.debug_routematch`` |
+| | or ``debug_routematch`` |
++------------------------------+--------------------------------+
.. _preventing_http_caching:
Preventing HTTP Caching
-------------------------
+-----------------------
Prevent the ``http_cache`` view configuration argument from having any effect
-globally in this process when this value is true. No http caching-related
-response headers will be set by the Pyramid ``http_cache`` view configuration
-feature when this is true.
+globally in this process when this value is true. No HTTP caching-related
+response headers will be set by the :app:`Pyramid` ``http_cache`` view
+configuration feature when this is true.
.. seealso::
@@ -154,8 +142,26 @@ feature when this is true.
+=================================+==================================+
| ``PYRAMID_PREVENT_HTTP_CACHE`` | ``pyramid.prevent_http_cache`` |
| | or ``prevent_http_cache`` |
-| | |
-| | |
++---------------------------------+----------------------------------+
+
+Preventing Cache Busting
+------------------------
+
+Prevent the ``cachebust`` static view configuration argument from having any
+effect globally in this process when this value is true. No cache buster will
+be configured or used when this is true.
+
+.. versionadded:: 1.6
+
+.. seealso::
+
+ See also :ref:`cache_busting`.
+
++---------------------------------+----------------------------------+
+| Environment Variable Name | Config File Setting Name |
++=================================+==================================+
+| ``PYRAMID_PREVENT_CACHEBUST`` | ``pyramid.prevent_cachebust`` |
+| | or ``prevent_cachebust`` |
+---------------------------------+----------------------------------+
Debugging All
@@ -163,36 +169,32 @@ Debugging All
Turns on all ``debug*`` settings.
-+---------------------------------+-----------------------------+
-| Environment Variable Name | Config File Setting Name |
-+=================================+=============================+
-| ``PYRAMID_DEBUG_ALL`` | ``pyramid.debug_all`` |
-| | or ``debug_all`` |
-| | |
-| | |
-+---------------------------------+-----------------------------+
++----------------------------+---------------------------+
+| Environment Variable Name | Config File Setting Name |
++============================+===========================+
+| ``PYRAMID_DEBUG_ALL`` | ``pyramid.debug_all`` |
+| | or ``debug_all`` |
++----------------------------+---------------------------+
Reloading All
-------------
Turns on all ``reload*`` settings.
-+---------------------------------+-----------------------------+
-| Environment Variable Name | Config File Setting Name |
-+=================================+=============================+
-| ``PYRAMID_RELOAD_ALL`` | ``pyramid.reload_all`` |
-| | or ``reload_all`` |
-| | |
-| | |
-+---------------------------------+-----------------------------+
++---------------------------+----------------------------+
+| Environment Variable Name | Config File Setting Name |
++===========================+============================+
+| ``PYRAMID_RELOAD_ALL`` | ``pyramid.reload_all`` or |
+| | ``reload_all`` |
++---------------------------+----------------------------+
.. _default_locale_name_setting:
Default Locale Name
---------------------
+-------------------
-The value supplied here is used as the default locale name when a
-:term:`locale negotiator` is not registered.
+The value supplied here is used as the default locale name when a :term:`locale
+negotiator` is not registered.
.. seealso::
@@ -203,8 +205,6 @@ The value supplied here is used as the default locale name when a
+=================================+===================================+
| ``PYRAMID_DEFAULT_LOCALE_NAME`` | ``pyramid.default_locale_name`` |
| | or ``default_locale_name`` |
-| | |
-| | |
+---------------------------------+-----------------------------------+
.. _including_packages:
@@ -214,19 +214,16 @@ Including Packages
``pyramid.includes`` instructs your application to include other packages.
Using the setting is equivalent to using the
-:meth:`pyramid.config.Configurator.include` method.
+:meth:`pyramid.config.Configurator.include` method.
-+---------------------------------+
-| Config File Setting Name |
-+=================================+
-| ``pyramid.includes`` |
-| |
-| |
-| |
-+---------------------------------+
++--------------------------+
+| Config File Setting Name |
++==========================+
+| ``pyramid.includes`` |
++--------------------------+
-The value assigned to ``pyramid.includes`` should be a sequence. The
-sequence can take several different forms.
+The value assigned to ``pyramid.includes`` should be a sequence. The sequence
+can take several different forms.
1) It can be a string.
@@ -285,7 +282,7 @@ Plain Python
++++++++++++
Using the following ``pyramid.includes`` setting in your plain-Python Pyramid
-application:
+application:
.. code-block:: python
:linenos:
@@ -320,33 +317,29 @@ This value allows you to perform explicit :term:`tween` ordering in your
configuration. Tweens are bits of code used by add-on authors to extend
Pyramid. They form a chain, and require ordering.
-Ideally, you won't need to use the ``pyramid.tweens`` setting at all. Tweens
+Ideally you won't need to use the ``pyramid.tweens`` setting at all. Tweens
are generally ordered and included "implicitly" when an add-on package which
registers a tween is "included". Packages are included when you name a
``pyramid.includes`` setting in your configuration or when you call
:meth:`pyramid.config.Configurator.include`.
Authors of included add-ons provide "implicit" tween configuration ordering
-hints to Pyramid when their packages are included. However, the implicit
-tween ordering is only best-effort. Pyramid will attempt to provide an
-implicit order of tweens as best it can using hints provided by add-on
-authors, but because it's only best-effort, if very precise tween ordering is
-required, the only surefire way to get it is to use an explicit tween order.
-You may be required to inspect your tween ordering (see
-:ref:`displaying_tweens`) and add a ``pyramid.tweens`` configuration value at
-the behest of an add-on author.
-
-+---------------------------------+
-| Config File Setting Name |
-+=================================+
-| ``pyramid.tweens`` |
-| |
-| |
-| |
-+---------------------------------+
-
-The value assigned to ``pyramid.tweens`` should be a sequence. The
-sequence can take several different forms.
+hints to Pyramid when their packages are included. However, the implicit tween
+ordering is only best-effort. Pyramid will attempt to provide an implicit
+order of tweens as best it can using hints provided by add-on authors, but
+because it's only best-effort, if very precise tween ordering is required, the
+only surefire way to get it is to use an explicit tween order. You may be
+required to inspect your tween ordering (see :ref:`displaying_tweens`) and add
+a ``pyramid.tweens`` configuration value at the behest of an add-on author.
+
++---------------------------+
+| Config File Setting Name |
++===========================+
+| ``pyramid.tweens`` |
++---------------------------+
+
+The value assigned to ``pyramid.tweens`` should be a sequence. The sequence
+can take several different forms.
1) It can be a string.
@@ -354,11 +347,11 @@ sequence can take several different forms.
pkg.tween_factory1 pkg.tween_factory2 pkg.tween_factory3
- The tween names can also be separated by carriage returns::
+ The tween names can also be separated by carriage returns::
- pkg.tween_factory1
- pkg.tween_factory2
- pkg.tween_factory3
+ pkg.tween_factory1
+ pkg.tween_factory2
+ pkg.tween_factory3
2) It can be a Python list, where the values are strings::
@@ -369,8 +362,8 @@ Each value in the sequence should be a :term:`dotted Python name`.
PasteDeploy Configuration vs. Plain-Python Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Using the following ``pyramid.tweens`` setting in the PasteDeploy ``.ini``
-file in your application:
+Using the following ``pyramid.tweens`` setting in the PasteDeploy ``.ini`` file
+in your application:
.. code-block:: ini
@@ -396,162 +389,14 @@ Is equivalent to using the following statements in your configuration code:
It is fine to use both or either form.
-.. _mako_template_renderer_settings:
-
-Mako Template Render Settings
------------------------------
-
-Mako derives additional settings to configure its template renderer that
-should be set when using it. Many of these settings are optional and only need
-to be set if they should be different from the default. The Mako Template
-Renderer uses a subclass of Mako's `template lookup
-<http://www.makotemplates.org/docs/usage.html#usage_lookup>`_ and accepts
-several arguments to configure it.
-
-Mako Directories
-~~~~~~~~~~~~~~~~
-
-The value(s) supplied here are passed in as the template directories. They
-should be in :term:`asset specification` format, for example:
-``my.package:templates``.
-
-+-----------------------------+
-| Config File Setting Name |
-+=============================+
-| ``mako.directories`` |
-| |
-| |
-| |
-+-----------------------------+
-
-Mako Module Directory
-~~~~~~~~~~~~~~~~~~~~~
-
-The value supplied here tells Mako where to store compiled Mako templates. If
-omitted, compiled templates will be stored in memory. This value should be an
-absolute path, for example: ``%(here)s/data/templates`` would use a directory
-called ``data/templates`` in the same parent directory as the INI file.
-
-+-----------------------------+
-| Config File Setting Name |
-+=============================+
-| ``mako.module_directory`` |
-| |
-| |
-| |
-+-----------------------------+
-
-Mako Input Encoding
-~~~~~~~~~~~~~~~~~~~
-
-The encoding that Mako templates are assumed to have. By default this is set
-to ``utf-8``. If you wish to use a different template encoding, this value
-should be changed accordingly.
-
-+-----------------------------+
-| Config File Setting Name |
-+=============================+
-| ``mako.input_encoding`` |
-| |
-| |
-| |
-+-----------------------------+
-
-Mako Error Handler
-~~~~~~~~~~~~~~~~~~
-
-A callable (or a :term:`dotted Python name` which names a callable) which is
-called whenever Mako compile or runtime exceptions occur. The callable is
-passed the current context as well as the exception. If the callable returns
-True, the exception is considered to be handled, else it is re-raised after
-the function completes. Is used to provide custom error-rendering functions.
-
-+-----------------------------+
-| Config File Setting Name |
-+=============================+
-| ``mako.error_handler`` |
-| |
-| |
-| |
-+-----------------------------+
-
-Mako Default Filters
-~~~~~~~~~~~~~~~~~~~~
-
-List of string filter names that will be applied to all Mako expressions.
-
-+-----------------------------+
-| Config File Setting Name |
-+=============================+
-| ``mako.default_filters`` |
-| |
-| |
-| |
-+-----------------------------+
-
-Mako Import
-~~~~~~~~~~~
-
-String list of Python statements, typically individual "import" lines, which
-will be placed into the module level preamble of all generated Python modules.
-
-
-+-----------------------------+
-| Config File Setting Name |
-+=============================+
-| ``mako.imports`` |
-| |
-| |
-| |
-+-----------------------------+
-
-
-Mako Strict Undefined
-~~~~~~~~~~~~~~~~~~~~~
-
-``true`` or ``false``, representing the "strict undefined" behavior of Mako
-(see `Mako Context Variables
-<http://www.makotemplates.org/docs/runtime.html#context-variables>`_). By
-default, this is ``false``.
-
-+-----------------------------+
-| Config File Setting Name |
-+=============================+
-| ``mako.strict_undefined`` |
-| |
-| |
-| |
-+-----------------------------+
-
-Mako Preprocessor
-~~~~~~~~~~~~~~~~~
-
-.. versionadded:: 1.1
-
-A callable (or a :term:`dotted Python name` which names a callable) which is
-called to preprocess the source before the template is called. The callable
-will be passed the full template source before it is parsed. The return
-result of the callable will be used as the template source code.
-
-
-+-----------------------------+
-| Config File Setting Name |
-+=============================+
-| ``mako.preprocessor`` |
-| |
-| |
-| |
-+-----------------------------+
-
Examples
--------
-Let's presume your configuration file is named ``MyProject.ini``, and
-there is a section representing your application named ``[app:main]``
-within the file that represents your :app:`Pyramid` application.
-The configuration file settings documented in the above "Config File
-Setting Name" column would go in the ``[app:main]`` section. Here's
-an example of such a section:
+Let's presume your configuration file is named ``MyProject.ini``, and there is
+a section representing your application named ``[app:main]`` within the file
+that represents your :app:`Pyramid` application. The configuration file
+settings documented in the above "Config File Setting Name" column would go in
+the ``[app:main]`` section. Here's an example of such a section:
.. code-block:: ini
:linenos:
@@ -561,41 +406,39 @@ an example of such a section:
pyramid.reload_templates = true
pyramid.debug_authorization = true
-You can also use environment variables to accomplish the same purpose
-for settings documented as such. For example, you might start your
-:app:`Pyramid` application using the following command line:
+You can also use environment variables to accomplish the same purpose for
+settings documented as such. For example, you might start your :app:`Pyramid`
+application using the following command line:
.. code-block:: text
$ PYRAMID_DEBUG_AUTHORIZATION=1 PYRAMID_RELOAD_TEMPLATES=1 \
$VENV/bin/pserve MyProject.ini
-If you started your application this way, your :app:`Pyramid`
-application would behave in the same manner as if you had placed the
-respective settings in the ``[app:main]`` section of your
-application's ``.ini`` file.
+If you started your application this way, your :app:`Pyramid` application would
+behave in the same manner as if you had placed the respective settings in the
+``[app:main]`` section of your application's ``.ini`` file.
-If you want to turn all ``debug`` settings (every setting that starts
-with ``pyramid.debug_``). on in one fell swoop, you can use
-``PYRAMID_DEBUG_ALL=1`` as an environment variable setting or you may use
-``pyramid.debug_all=true`` in the config file. Note that this does not affect
-settings that do not start with ``pyramid.debug_*`` such as
-``pyramid.reload_templates``.
+If you want to turn all ``debug`` settings (every setting that starts with
+``pyramid.debug_``) on in one fell swoop, you can use ``PYRAMID_DEBUG_ALL=1``
+as an environment variable setting or you may use ``pyramid.debug_all=true`` in
+the config file. Note that this does not affect settings that do not start
+with ``pyramid.debug_*`` such as ``pyramid.reload_templates``.
If you want to turn all ``pyramid.reload`` settings (every setting that starts
with ``pyramid.reload_``) on in one fell swoop, you can use
``PYRAMID_RELOAD_ALL=1`` as an environment variable setting or you may use
-``pyramid.reload_all=true`` in the config file. Note that this does not
-affect settings that do not start with ``pyramid.reload_*`` such as
+``pyramid.reload_all=true`` in the config file. Note that this does not affect
+settings that do not start with ``pyramid.reload_*`` such as
``pyramid.debug_notfound``.
.. note::
Specifying configuration settings via environment variables is generally
- most useful during development, where you may wish to augment or
- override the more permanent settings in the configuration file.
- This is useful because many of the reload and debug settings may
- have performance or security (i.e., disclosure) implications
- that make them undesirable in a production environment.
+ most useful during development, where you may wish to augment or override
+ the more permanent settings in the configuration file. This is useful
+ because many of the reload and debug settings may have performance or
+ security (i.e., disclosure) implications that make them undesirable in a
+ production environment.
.. index::
single: reload_templates
@@ -606,13 +449,13 @@ Understanding the Distinction Between ``reload_templates`` and ``reload_assets``
The difference between ``pyramid.reload_assets`` and
``pyramid.reload_templates`` is a bit subtle. Templates are themselves also
-treated by :app:`Pyramid` as asset files (along with other static files), so the
-distinction can be confusing. It's helpful to read
+treated by :app:`Pyramid` as asset files (along with other static files), so
+the distinction can be confusing. It's helpful to read
:ref:`overriding_assets_section` for some context about assets in general.
-When ``pyramid.reload_templates`` is true, :app:`Pyramid` takes advantage of the
-underlying templating systems' ability to check for file modifications to an
-individual template file. When ``pyramid.reload_templates`` is true but
+When ``pyramid.reload_templates`` is true, :app:`Pyramid` takes advantage of
+the underlying templating system's ability to check for file modifications to
+an individual template file. When ``pyramid.reload_templates`` is true, but
``pyramid.reload_assets`` is *not* true, the template filename returned by the
``pkg_resources`` package (used under the hood by asset resolution) is cached
by :app:`Pyramid` on the first request. Subsequent requests for the same
@@ -625,21 +468,21 @@ because it has some effect).
However, when ``pyramid.reload_assets`` is true, :app:`Pyramid` will not cache
the template filename, meaning you can see the effect of changing the content
of an overridden asset directory for templates without restarting the server
-after every change. Subsequent requests for the same template file may
-return different filenames based on the current state of overridden asset
-directories. Setting ``pyramid.reload_assets`` to ``True`` affects performance
-*dramatically*, slowing things down by an order of magnitude for each
-template rendering. However, it's convenient to enable when moving files
-around in overridden asset directories. ``pyramid.reload_assets`` makes the
-system *very slow* when templates are in use. Never set
-``pyramid.reload_assets`` to ``True`` on a production system.
+after every change. Subsequent requests for the same template file may return
+different filenames based on the current state of overridden asset directories.
+Setting ``pyramid.reload_assets`` to ``True`` affects performance
+*dramatically*, slowing things down by an order of magnitude for each template
+rendering. However, it's convenient to enable when moving files around in
+overridden asset directories. ``pyramid.reload_assets`` makes the system *very
+slow* when templates are in use. Never set ``pyramid.reload_assets`` to
+``True`` on a production system.
.. index::
par: settings; adding custom
.. _adding_a_custom_setting:
-Adding A Custom Setting
+Adding a Custom Setting
-----------------------
From time to time, you may need to add a custom setting to your application.
@@ -656,12 +499,12 @@ Here's how:
debug_frobnosticator = True
- In the ``main()`` function that represents the place that your Pyramid WSGI
- application is created, anticipate that you'll be getting this key/value
- pair as a setting and do any type conversion necessary.
+ application is created, anticipate that you'll be getting this key/value pair
+ as a setting and do any type conversion necessary.
- If you've done any type conversion of your custom value, reset the
- converted values into the ``settings`` dictionary *before* you pass the
- dictionary as ``settings`` to the :term:`Configurator`. For example:
+ If you've done any type conversion of your custom value, reset the converted
+ values into the ``settings`` dictionary *before* you pass the dictionary as
+ ``settings`` to the :term:`Configurator`. For example:
.. code-block:: python
@@ -673,16 +516,17 @@ Here's how:
settings['debug_frobnosticator'] = debug_frobnosticator
config = Configurator(settings=settings)
- .. note:: It's especially important that you mutate the ``settings``
- dictionary with the converted version of the variable *before* passing
- it to the Configurator: the configurator makes a *copy* of ``settings``,
- it doesn't use the one you pass directly.
-
-- When creating an ``includeme`` function that will be later added to your
+ .. note::
+ It's especially important that you mutate the ``settings`` dictionary with
+ the converted version of the variable *before* passing it to the
+ Configurator: the configurator makes a *copy* of ``settings``, it doesn't
+ use the one you pass directly.
+
+- When creating an ``includeme`` function that will be later added to your
application's configuration you may access the ``settings`` dictionary
through the instance of the :term:`Configurator` that is passed into the
function as its only argument. For Example:
-
+
.. code-block:: python
def includeme(config):
@@ -699,8 +543,8 @@ Here's how:
settings = request.registry.settings
debug_frobnosticator = settings['debug_frobnosticator']
- If you wish to use the value in code that does not have access to the
- request and you wish to use the value, you'll need to use the
+ If you wish to use the value in code that does not have access to the request
+ and you wish to use the value, you'll need to use the
:func:`pyramid.threadlocal.get_current_registry` API to obtain the current
registry, then ask for its ``settings`` attribute. For example:
@@ -709,7 +553,3 @@ Here's how:
registry = pyramid.threadlocal.get_current_registry()
settings = registry.settings
debug_frobnosticator = settings['debug_frobnosticator']
-
-
-
-
diff --git a/docs/narr/events.rst b/docs/narr/events.rst
index 09caac898..c10d4cc47 100644
--- a/docs/narr/events.rst
+++ b/docs/narr/events.rst
@@ -9,18 +9,18 @@
.. _events_chapter:
Using Events
-=============
+============
-An *event* is an object broadcast by the :app:`Pyramid` framework
-at interesting points during the lifetime of an application. You
-don't need to use events in order to create most :app:`Pyramid`
-applications, but they can be useful when you want to perform slightly
-advanced operations. For example, subscribing to an event can allow
-you to run some code as the result of every new request.
+An *event* is an object broadcast by the :app:`Pyramid` framework at
+interesting points during the lifetime of an application. You don't need to
+use events in order to create most :app:`Pyramid` applications, but they can be
+useful when you want to perform slightly advanced operations. For example,
+subscribing to an event can allow you to run some code as the result of every
+new request.
-Events in :app:`Pyramid` are always broadcast by the framework.
-However, they only become useful when you register a *subscriber*. A
-subscriber is a function that accepts a single argument named `event`:
+Events in :app:`Pyramid` are always broadcast by the framework. However, they
+only become useful when you register a *subscriber*. A subscriber is a
+function that accepts a single argument named `event`:
.. code-block:: python
:linenos:
@@ -28,23 +28,20 @@ subscriber is a function that accepts a single argument named `event`:
def mysubscriber(event):
print(event)
-The above is a subscriber that simply prints the event to the console
-when it's called.
+The above is a subscriber that simply prints the event to the console when it's
+called.
The mere existence of a subscriber function, however, is not sufficient to
arrange for it to be called. To arrange for the subscriber to be called,
-you'll need to use the
-:meth:`pyramid.config.Configurator.add_subscriber` method or you'll
-need to use the :func:`pyramid.events.subscriber` decorator to decorate a
-function found via a :term:`scan`.
+you'll need to use the :meth:`pyramid.config.Configurator.add_subscriber`
+method or you'll need to use the :func:`pyramid.events.subscriber` decorator to
+decorate a function found via a :term:`scan`.
Configuring an Event Listener Imperatively
------------------------------------------
-You can imperatively configure a subscriber function to be called
-for some event type via the
-:meth:`~pyramid.config.Configurator.add_subscriber`
-method:
+You can imperatively configure a subscriber function to be called for some
+event type via the :meth:`~pyramid.config.Configurator.add_subscriber` method:
.. code-block:: python
:linenos:
@@ -58,10 +55,9 @@ method:
config.add_subscriber(mysubscriber, NewRequest)
-The first argument to
-:meth:`~pyramid.config.Configurator.add_subscriber` is the
-subscriber function (or a :term:`dotted Python name` which refers
-to a subscriber callable); the second argument is the event type.
+The first argument to :meth:`~pyramid.config.Configurator.add_subscriber` is
+the subscriber function (or a :term:`dotted Python name` which refers to a
+subscriber callable); the second argument is the event type.
.. seealso::
@@ -70,8 +66,8 @@ to a subscriber callable); the second argument is the event type.
Configuring an Event Listener Using a Decorator
-----------------------------------------------
-You can configure a subscriber function to be called for some event
-type via the :func:`pyramid.events.subscriber` function.
+You can configure a subscriber function to be called for some event type via
+the :func:`pyramid.events.subscriber` function.
.. code-block:: python
:linenos:
@@ -83,9 +79,9 @@ type via the :func:`pyramid.events.subscriber` function.
def mysubscriber(event):
event.request.foo = 1
-When the :func:`~pyramid.events.subscriber` decorator is used a
-:term:`scan` must be performed against the package containing the
-decorated function for the decorator to have any effect.
+When the :func:`~pyramid.events.subscriber` decorator is used, a :term:`scan`
+must be performed against the package containing the decorated function for the
+decorator to have any effect.
Either of the above registration examples implies that every time the
:app:`Pyramid` framework emits an event object that supplies an
@@ -96,13 +92,12 @@ As you can see, a subscription is made in terms of a *class* (such as
:class:`pyramid.events.NewResponse`). The event object sent to a subscriber
will always be an object that possesses an :term:`interface`. For
:class:`pyramid.events.NewResponse`, that interface is
-:class:`pyramid.interfaces.INewResponse`. The interface documentation
-provides information about available attributes and methods of the event
-objects.
+:class:`pyramid.interfaces.INewResponse`. The interface documentation provides
+information about available attributes and methods of the event objects.
-The return value of a subscriber function is ignored. Subscribers to
-the same event type are not guaranteed to be called in any particular
-order relative to each other.
+The return value of a subscriber function is ignored. Subscribers to the same
+event type are not guaranteed to be called in any particular order relative to
+each other.
All the concrete :app:`Pyramid` event types are documented in the
:ref:`events_module` API documentation.
@@ -110,8 +105,8 @@ All the concrete :app:`Pyramid` event types are documented in the
An Example
----------
-If you create event listener functions in a ``subscribers.py`` file in
-your application like so:
+If you create event listener functions in a ``subscribers.py`` file in your
+application like so:
.. code-block:: python
:linenos:
@@ -122,9 +117,8 @@ your application like so:
def handle_new_response(event):
print('response', event.response)
-You may configure these functions to be called at the appropriate
-times by adding the following code to your application's
-configuration startup:
+You may configure these functions to be called at the appropriate times by
+adding the following code to your application's configuration startup:
.. code-block:: python
:linenos:
@@ -136,22 +130,21 @@ configuration startup:
config.add_subscriber('myproject.subscribers.handle_new_response',
'pyramid.events.NewResponse')
-Either mechanism causes the functions in ``subscribers.py`` to be
-registered as event subscribers. Under this configuration, when the
-application is run, each time a new request or response is detected, a
-message will be printed to the console.
+Either mechanism causes the functions in ``subscribers.py`` to be registered as
+event subscribers. Under this configuration, when the application is run, each
+time a new request or response is detected, a message will be printed to the
+console.
-Each of our subscriber functions accepts an ``event`` object and
-prints an attribute of the event object. This begs the question: how
-can we know which attributes a particular event has?
+Each of our subscriber functions accepts an ``event`` object and prints an
+attribute of the event object. This begs the question: how can we know which
+attributes a particular event has?
We know that :class:`pyramid.events.NewRequest` event objects have a
-``request`` attribute, which is a :term:`request` object, because the
-interface defined at :class:`pyramid.interfaces.INewRequest` says it must.
-Likewise, we know that :class:`pyramid.interfaces.NewResponse` events have a
-``response`` attribute, which is a response object constructed by your
-application, because the interface defined at
-:class:`pyramid.interfaces.INewResponse` says it must
+``request`` attribute, which is a :term:`request` object, because the interface
+defined at :class:`pyramid.interfaces.INewRequest` says it must. Likewise, we
+know that :class:`pyramid.interfaces.NewResponse` events have a ``response``
+attribute, which is a response object constructed by your application, because
+the interface defined at :class:`pyramid.interfaces.INewResponse` says it must
(:class:`pyramid.events.NewResponse` objects also have a ``request``).
.. _custom_events:
@@ -159,21 +152,20 @@ application, because the interface defined at
Creating Your Own Events
------------------------
-In addition to using the events that the Pyramid framework creates,
-you can create your own events for use in your application. This can
-be useful to decouple parts of your application.
+In addition to using the events that the Pyramid framework creates, you can
+create your own events for use in your application. This can be useful to
+decouple parts of your application.
-For example, suppose your application has to do many things when a new
-document is created. Rather than putting all this logic in the view
-that creates the document, you can create the document in your view
-and then fire a custom event. Subscribers to the custom event can take
-other actions, such as indexing the document, sending email, or
-sending a message to a remote system.
+For example, suppose your application has to do many things when a new document
+is created. Rather than putting all this logic in the view that creates the
+document, you can create the document in your view and then fire a custom
+event. Subscribers to the custom event can take other actions, such as indexing
+the document, sending email, or sending a message to a remote system.
-An event is simply an object. There are no required attributes or
-method for your custom events. In general, your events should keep
-track of the information that subscribers will need. Here are some
-example custom event classes:
+An event is simply an object. There are no required attributes or method for
+your custom events. In general, your events should keep track of the
+information that subscribers will need. Here are some example custom event
+classes:
.. code-block:: python
:linenos:
@@ -193,11 +185,10 @@ example custom event classes:
Some Pyramid applications choose to define custom events classes in an
``events`` module.
-You can subscribe to custom events in the same way that you subscribe
-to Pyramid events -- either imperatively or with a decorator. You can
-also use custom events with :ref:`subscriber predicates
-<subscriber_predicates>`. Here's an example of subscribing to a custom
-event with a decorator:
+You can subscribe to custom events in the same way that you subscribe to
+Pyramid events—either imperatively or with a decorator. You can also use custom
+events with :ref:`subscriber predicates <subscriber_predicates>`. Here's an
+example of subscribing to a custom event with a decorator:
.. code-block:: python
:linenos:
@@ -211,12 +202,12 @@ event with a decorator:
# index the document using our application's index_doc function
index_doc(event.doc, event.request)
-The above example assumes that the application defines a
-``DocCreated`` event class and an ``index_doc`` function.
+The above example assumes that the application defines a ``DocCreated`` event
+class and an ``index_doc`` function.
-To fire your custom events use the
-:meth:`pyramid.registry.Registry.notify` method, which is most often
-accessed as ``request.registry.notify``. For example:
+To fire your custom events use the :meth:`pyramid.registry.Registry.notify`
+method, which is most often accessed as ``request.registry.notify``. For
+example:
.. code-block:: python
:linenos:
@@ -229,11 +220,10 @@ accessed as ``request.registry.notify``. For example:
request.registry.notify(event)
return {'document': doc}
-This example view will notify all subscribers to the custom
-``DocCreated`` event.
+This example view will notify all subscribers to the custom ``DocCreated``
+event.
-Note that when you fire an event, all subscribers are run
-synchronously so it's generally not a good idea
-to create event handlers that may take a long time to run. Although
-event handlers could be used as a central place to spawn tasks on your
-own message queues.
+Note that when you fire an event, all subscribers are run synchronously so it's
+generally not a good idea to create event handlers that may take a long time to
+run. Although event handlers could be used as a central place to spawn tasks on
+your own message queues.
diff --git a/docs/narr/extconfig.rst b/docs/narr/extconfig.rst
index 6587aef92..fee8d0d3a 100644
--- a/docs/narr/extconfig.rst
+++ b/docs/narr/extconfig.rst
@@ -7,9 +7,9 @@ Extending Pyramid Configuration
===============================
Pyramid allows you to extend its Configurator with custom directives. Custom
-directives can use other directives, they can add a custom :term:`action`,
-they can participate in :term:`conflict resolution`, and they can provide
-some number of :term:`introspectable` objects.
+directives can use other directives, they can add a custom :term:`action`, they
+can participate in :term:`conflict resolution`, and they can provide some
+number of :term:`introspectable` objects.
.. index::
single: add_directive
@@ -20,18 +20,17 @@ some number of :term:`introspectable` objects.
Adding Methods to the Configurator via ``add_directive``
--------------------------------------------------------
-Framework extension writers can add arbitrary methods to a
-:term:`Configurator` by using the
-:meth:`pyramid.config.Configurator.add_directive` method of the configurator.
-Using :meth:`~pyramid.config.Configurator.add_directive` makes it possible to
-extend a Pyramid configurator in arbitrary ways, and allows it to perform
-application-specific tasks more succinctly.
+Framework extension writers can add arbitrary methods to a :term:`Configurator`
+by using the :meth:`pyramid.config.Configurator.add_directive` method of the
+configurator. Using :meth:`~pyramid.config.Configurator.add_directive` makes it
+possible to extend a Pyramid configurator in arbitrary ways, and allows it to
+perform application-specific tasks more succinctly.
The :meth:`~pyramid.config.Configurator.add_directive` method accepts two
-positional arguments: a method name and a callable object. The callable
-object is usually a function that takes the configurator instance as its
-first argument and accepts other arbitrary positional and keyword arguments.
-For example:
+positional arguments: a method name and a callable object. The callable object
+is usually a function that takes the configurator instance as its first
+argument and accepts other arbitrary positional and keyword arguments. For
+example:
.. code-block:: python
:linenos:
@@ -48,8 +47,8 @@ For example:
add_newrequest_subscriber)
Once :meth:`~pyramid.config.Configurator.add_directive` is called, a user can
-then call the added directive by its given name as if it were a built-in
-method of the Configurator:
+then call the added directive by its given name as if it were a built-in method
+of the Configurator:
.. code-block:: python
:linenos:
@@ -59,9 +58,9 @@ method of the Configurator:
config.add_newrequest_subscriber(mysubscriber)
-A call to :meth:`~pyramid.config.Configurator.add_directive` is often
-"hidden" within an ``includeme`` function within a "frameworky" package meant
-to be included as per :ref:`including_configuration` via
+A call to :meth:`~pyramid.config.Configurator.add_directive` is often "hidden"
+within an ``includeme`` function within a "frameworky" package meant to be
+included as per :ref:`including_configuration` via
:meth:`~pyramid.config.Configurator.include`. For example, if you put this
code in a package named ``pyramid_subscriberhelpers``:
@@ -72,8 +71,8 @@ code in a package named ``pyramid_subscriberhelpers``:
config.add_directive('add_newrequest_subscriber',
add_newrequest_subscriber)
-The user of the add-on package ``pyramid_subscriberhelpers`` would then be
-able to install it and subsequently do:
+The user of the add-on package ``pyramid_subscriberhelpers`` would then be able
+to install it and subsequently do:
.. code-block:: python
:linenos:
@@ -91,13 +90,12 @@ Using ``config.action`` in a Directive
If a custom directive can't do its work exclusively in terms of existing
configurator methods (such as
-:meth:`pyramid.config.Configurator.add_subscriber`, as above), the directive
-may need to make use of the :meth:`pyramid.config.Configurator.action`
-method. This method adds an entry to the list of "actions" that Pyramid will
-attempt to process when :meth:`pyramid.config.Configurator.commit` is called.
-An action is simply a dictionary that includes a :term:`discriminator`,
-possibly a callback function, and possibly other metadata used by Pyramid's
-action system.
+:meth:`pyramid.config.Configurator.add_subscriber` as above), the directive may
+need to make use of the :meth:`pyramid.config.Configurator.action` method. This
+method adds an entry to the list of "actions" that Pyramid will attempt to
+process when :meth:`pyramid.config.Configurator.commit` is called. An action is
+simply a dictionary that includes a :term:`discriminator`, possibly a callback
+function, and possibly other metadata used by Pyramid's action system.
Here's an example directive which uses the "action" method:
@@ -122,15 +120,15 @@ closure function named ``register`` is passed as the second argument named
When the :meth:`~pyramid.config.Configurator.action` method is called, it
appends an action to the list of pending configuration actions. All pending
-actions with the same discriminator value are potentially in conflict with
-one another (see :ref:`conflict_detection`). When the
+actions with the same discriminator value are potentially in conflict with one
+another (see :ref:`conflict_detection`). When the
:meth:`~pyramid.config.Configurator.commit` method of the Configurator is
called (either explicitly or as the result of calling
:meth:`~pyramid.config.Configurator.make_wsgi_app`), conflicting actions are
-potentially automatically resolved as per
-:ref:`automatic_conflict_resolution`. If a conflict cannot be automatically
-resolved, a :exc:`pyramid.exceptions.ConfigurationConflictError` is raised
-and application startup is prevented.
+potentially automatically resolved as per :ref:`automatic_conflict_resolution`.
+If a conflict cannot be automatically resolved, a
+:exc:`pyramid.exceptions.ConfigurationConflictError` is raised and application
+startup is prevented.
In our above example, therefore, if a consumer of our ``add_jammyjam``
directive did this:
@@ -146,14 +144,14 @@ generated by the two calls are in direct conflict. Automatic conflict
resolution cannot resolve the conflict (because no ``config.include`` is
involved), and the user provided no intermediate
:meth:`pyramid.config.Configurator.commit` call between the calls to
-``add_jammyjam`` to ensure that the successive calls did not conflict with
-each other.
+``add_jammyjam`` to ensure that the successive calls did not conflict with each
+other.
This demonstrates the purpose of the discriminator argument to the action
method: it's used to indicate a uniqueness constraint for an action. Two
actions with the same discriminator will conflict unless the conflict is
-automatically or manually resolved. A discriminator can be any hashable
-object, but it is generally a string or a tuple. *You use a discriminator to
+automatically or manually resolved. A discriminator can be any hashable object,
+but it is generally a string or a tuple. *You use a discriminator to
declaratively ensure that the user doesn't provide ambiguous configuration
statements.*
@@ -169,21 +167,20 @@ appended to the pending actions list. When the pending configuration actions
are processed during :meth:`~pyramid.config.Configurator.commit`, and no
conflicts occur, the *callable* provided as the second argument to the
:meth:`~pyramid.config.Configurator.action` method within ``add_jammyjam`` is
-called with no arguments. The callable in ``add_jammyjam`` is the
-``register`` closure function. It simply sets the value
-``config.registry.jammyjam`` to whatever the user passed in as the
-``jammyjam`` argument to the ``add_jammyjam`` function. Therefore, the
-result of the user's call to our directive will set the ``jammyjam``
-attribute of the registry to the string ``first``. *A callable is used by a
-directive to defer the result of a user's call to the directive until
-conflict detection has had a chance to do its job*.
+called with no arguments. The callable in ``add_jammyjam`` is the ``register``
+closure function. It simply sets the value ``config.registry.jammyjam`` to
+whatever the user passed in as the ``jammyjam`` argument to the
+``add_jammyjam`` function. Therefore, the result of the user's call to our
+directive will set the ``jammyjam`` attribute of the registry to the string
+``first``. *A callable is used by a directive to defer the result of a user's
+call to the directive until conflict detection has had a chance to do its job*.
Other arguments exist to the :meth:`~pyramid.config.Configurator.action`
-method, including ``args``, ``kw``, ``order``, and ``introspectables``.
+method, including ``args``, ``kw``, ``order``, and ``introspectables``.
-``args`` and ``kw`` exist as values, which, if passed, will be used as
-arguments to the ``callable`` function when it is called back. For example
-our directive might use them like so:
+``args`` and ``kw`` exist as values, which if passed will be used as arguments
+to the ``callable`` function when it is called back. For example, our
+directive might use them like so:
.. code-block:: python
:linenos:
@@ -198,29 +195,132 @@ our directive might use them like so:
In the above example, when this directive is used to generate an action, and
that action is committed, ``config.registry.jammyjam_args`` will be set to
``('one',)`` and ``config.registry.jammyjam_kw`` will be set to
-``{'two':'two'}``. ``args`` and ``kw`` are honestly not very useful when
-your ``callable`` is a closure function, because you already usually have
-access to every local in the directive without needing them to be passed
-back. They can be useful, however, if you don't use a closure as a callable.
+``{'two':'two'}``. ``args`` and ``kw`` are honestly not very useful when your
+``callable`` is a closure function, because you already usually have access to
+every local in the directive without needing them to be passed back. They can
+be useful, however, if you don't use a closure as a callable.
``order`` is a crude order control mechanism. ``order`` defaults to the
integer ``0``; it can be set to any other integer. All actions that share an
order will be called before other actions that share a higher order. This
makes it possible to write a directive with callable logic that relies on the
-execution of the callable of another directive being done first. For
-example, Pyramid's :meth:`pyramid.config.Configurator.add_view` directive
-registers an action with a higher order than the
+execution of the callable of another directive being done first. For example,
+Pyramid's :meth:`pyramid.config.Configurator.add_view` directive registers an
+action with a higher order than the
:meth:`pyramid.config.Configurator.add_route` method. Due to this, the
-``add_view`` method's callable can assume that, if a ``route_name`` was
-passed to it, that a route by this name was already registered by
-``add_route``, and if such a route has not already been registered, it's a
-configuration error (a view that names a nonexistent route via its
-``route_name`` parameter will never be called).
+``add_view`` method's callable can assume that, if a ``route_name`` was passed
+to it, that a route by this name was already registered by ``add_route``, and
+if such a route has not already been registered, it's a configuration error (a
+view that names a nonexistent route via its ``route_name`` parameter will never
+be called).
-``introspectables`` is a sequence of :term:`introspectable` objects. You can
-pass a sequence of introspectables to the
-:meth:`~pyramid.config.Configurator.action` method, which allows you to
-augment Pyramid's configuration introspection system.
+.. versionchanged:: 1.6
+ As of Pyramid 1.6 it is possible for one action to invoke another. See
+ :ref:`ordering_actions` for more information.
+
+Finally, ``introspectables`` is a sequence of :term:`introspectable` objects.
+You can pass a sequence of introspectables to the
+:meth:`~pyramid.config.Configurator.action` method, which allows you to augment
+Pyramid's configuration introspection system.
+
+.. _ordering_actions:
+
+Ordering Actions
+----------------
+
+In Pyramid every :term:`action` has an inherent ordering relative to other
+actions. The logic within actions is deferred until a call to
+:meth:`pyramid.config.Configurator.commit` (which is automatically invoked by
+:meth:`pyramid.config.Configurator.make_wsgi_app`). This means you may call
+``config.add_view(route_name='foo')`` **before** ``config.add_route('foo',
+'/foo')`` because nothing actually happens until commit-time. During a commit
+cycle, conflicts are resolved, and actions are ordered and executed.
+
+By default, almost every action in Pyramid has an ``order`` of
+:const:`pyramid.config.PHASE3_CONFIG`. Every action within the same order-level
+will be executed in the order it was called. This means that if an action must
+be reliably executed before or after another action, the ``order`` must be
+defined explicitly to make this work. For example, views are dependent on
+routes being defined. Thus the action created by
+:meth:`pyramid.config.Configurator.add_route` has an ``order`` of
+:const:`pyramid.config.PHASE2_CONFIG`.
+
+Pre-defined Phases
+~~~~~~~~~~~~~~~~~~
+
+:const:`pyramid.config.PHASE0_CONFIG`
+
+- This phase is reserved for developers who want to execute actions prior to
+ Pyramid's core directives.
+
+:const:`pyramid.config.PHASE1_CONFIG`
+
+- :meth:`pyramid.config.Configurator.add_renderer`
+- :meth:`pyramid.config.Configurator.add_route_predicate`
+- :meth:`pyramid.config.Configurator.add_subscriber_predicate`
+- :meth:`pyramid.config.Configurator.add_view_predicate`
+- :meth:`pyramid.config.Configurator.set_authorization_policy`
+- :meth:`pyramid.config.Configurator.set_default_permission`
+- :meth:`pyramid.config.Configurator.set_view_mapper`
+
+:const:`pyramid.config.PHASE2_CONFIG`
+
+- :meth:`pyramid.config.Configurator.add_route`
+- :meth:`pyramid.config.Configurator.set_authentication_policy`
+
+:const:`pyramid.config.PHASE3_CONFIG`
+
+- The default for all builtin or custom directives unless otherwise specified.
+
+Calling Actions from Actions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. versionadded:: 1.6
+
+Pyramid's configurator allows actions to be added during a commit-cycle as long
+as they are added to the current or a later ``order`` phase. This means that
+your custom action can defer decisions until commit-time and then do things
+like invoke :meth:`pyramid.config.Configurator.add_route`. It can also provide
+better conflict detection if your addon needs to call more than one other
+action.
+
+For example, let's make an addon that invokes ``add_route`` and ``add_view``,
+but we want it to conflict with any other call to our addon:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.config import PHASE0_CONFIG
+
+ def includeme(config):
+ config.add_directive('add_auto_route', add_auto_route)
+
+ def add_auto_route(config, name, view):
+ def register():
+ config.add_view(route_name=name, view=view)
+ config.add_route(name, '/' + name)
+ config.action(('auto route', name), register, order=PHASE0_CONFIG)
+
+Now someone else can use your addon and be informed if there is a conflict
+between this route and another, or two calls to ``add_auto_route``. Notice how
+we had to invoke our action **before** ``add_view`` or ``add_route``. If we
+tried to invoke this afterward, the subsequent calls to ``add_view`` and
+``add_route`` would cause conflicts because that phase had already been
+executed, and the configurator cannot go back in time to add more views during
+that commit-cycle.
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.config import Configurator
+
+ def main(global_config, **settings):
+ config = Configurator()
+ config.include('auto_route_addon')
+ config.add_auto_route('foo', my_view)
+
+ def my_view(request):
+ return request.response
.. _introspection:
@@ -239,16 +339,16 @@ All built-in Pyramid directives (such as
introspectables when called. For example, when you register a view via
``add_view``, the directive registers at least one introspectable: an
introspectable about the view registration itself, providing human-consumable
-values for the arguments it was passed. You can later use the introspection
-query system to determine whether a particular view uses a renderer, or
-whether a particular view is limited to a particular request method, or which
-routes a particular view is registered against. The Pyramid "debug toolbar"
-makes use of the introspection system in various ways to display information
-to Pyramid developers.
+values for the arguments passed into it. You can later use the introspection
+query system to determine whether a particular view uses a renderer, or whether
+a particular view is limited to a particular request method, or against which
+routes a particular view is registered. The Pyramid "debug toolbar" makes use
+of the introspection system in various ways to display information to Pyramid
+developers.
-Introspection values are set when a sequence of :term:`introspectable`
-objects is passed to the :meth:`~pyramid.config.Configurator.action` method.
-Here's an example of a directive which uses introspectables:
+Introspection values are set when a sequence of :term:`introspectable` objects
+is passed to the :meth:`~pyramid.config.Configurator.action` method. Here's an
+example of a directive which uses introspectables:
.. code-block:: python
:linenos:
@@ -268,9 +368,9 @@ Here's an example of a directive which uses introspectables:
config.add_directive('add_jammyjam', add_jammyjam)
If you notice, the above directive uses the ``introspectable`` attribute of a
-Configurator (:attr:`pyramid.config.Configurator.introspectable`) to create
-an introspectable object. The introspectable object's constructor requires
-at least four arguments: the ``category_name``, the ``discriminator``, the
+Configurator (:attr:`pyramid.config.Configurator.introspectable`) to create an
+introspectable object. The introspectable object's constructor requires at
+least four arguments: the ``category_name``, the ``discriminator``, the
``title``, and the ``type_name``.
The ``category_name`` is a string representing the logical category for this
@@ -290,19 +390,19 @@ The ``type_name`` is a value that can be used to subtype this introspectable
within its category for sorting and presentation purposes. It can be any
value.
-An introspectable is also dictionary-like. It can contain any set of
-key/value pairs, typically related to the arguments passed to its related
-directive. While the category_name, discriminator, title and type_name are
-*metadata* about the introspectable, the values provided as key/value pairs
+An introspectable is also dictionary-like. It can contain any set of key/value
+pairs, typically related to the arguments passed to its related directive.
+While the ``category_name``, ``discriminator``, ``title``, and ``type_name``
+are *metadata* about the introspectable, the values provided as key/value pairs
are the actual data provided by the introspectable. In the above example, we
set the ``value`` key to the value of the ``value`` argument passed to the
directive.
Our directive above mutates the introspectable, and passes it in to the
``action`` method as the first element of a tuple as the value of the
-``introspectable`` keyword argument. This associates this introspectable
-with the action. Introspection tools will then display this introspectable
-in their index.
+``introspectable`` keyword argument. This associates this introspectable with
+the action. Introspection tools will then display this introspectable in their
+index.
Introspectable Relationships
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -333,30 +433,29 @@ Two introspectables may have relationships between each other.
config.add_directive('add_jammyjam', add_jammyjam)
In the above example, the ``add_jammyjam`` directive registers two
-introspectables. The first is related to the ``value`` passed to the
-directive; the second is related to the ``template`` passed to the directive.
-If you believe a concept within a directive is important enough to have its
-own introspectable, you can cause the same directive to register more than
-one introspectable, registering one introspectable for the "main idea" and
-another for a related concept.
+introspectables: the first is related to the ``value`` passed to the directive,
+and the second is related to the ``template`` passed to the directive. If you
+believe a concept within a directive is important enough to have its own
+introspectable, you can cause the same directive to register more than one
+introspectable, registering one introspectable for the "main idea" and another
+for a related concept.
The call to ``intr.relate`` above
-(:meth:`pyramid.interfaces.IIntrospectable.relate`) is passed two arguments:
-a category name and a directive. The example above effectively indicates
-that the directive wishes to form a relationship between the ``intr``
-introspectable and the ``tmpl_intr`` introspectable; the arguments passed to
-``relate`` are the category name and discriminator of the ``tmpl_intr``
-introspectable.
-
-Relationships need not be made between two introspectables created by the
-same directive. Instead, a relationship can be formed between an
-introspectable created in one directive and another introspectable created in
-another by calling ``relate`` on either side with the other directive's
-category name and discriminator. An error will be raised at configuration
-commit time if you attempt to relate an introspectable with another
-nonexistent introspectable, however.
+(:meth:`pyramid.interfaces.IIntrospectable.relate`) is passed two arguments: a
+category name and a directive. The example above effectively indicates that
+the directive wishes to form a relationship between the ``intr`` introspectable
+and the ``tmpl_intr`` introspectable; the arguments passed to ``relate`` are
+the category name and discriminator of the ``tmpl_intr`` introspectable.
+
+Relationships need not be made between two introspectables created by the same
+directive. Instead a relationship can be formed between an introspectable
+created in one directive and another introspectable created in another by
+calling ``relate`` on either side with the other directive's category name and
+discriminator. An error will be raised at configuration commit time if you
+attempt to relate an introspectable with another nonexistent introspectable,
+however.
Introspectable relationships will show up in frontend system renderings of
-introspection values. For example, if a view registration names a route
-name, the introspectable related to the view callable will show a reference
-to the route to which it relates to and vice versa.
+introspection values. For example, if a view registration names a route name,
+the introspectable related to the view callable will show a reference to the
+route to which it relates and vice versa.
diff --git a/docs/narr/extending.rst b/docs/narr/extending.rst
index 8462a9da7..d28eb341d 100644
--- a/docs/narr/extending.rst
+++ b/docs/narr/extending.rst
@@ -1,13 +1,13 @@
.. _extending_chapter:
-Extending An Existing :app:`Pyramid` Application
-===================================================
+Extending an Existing :app:`Pyramid` Application
+================================================
-If a :app:`Pyramid` developer has obeyed certain constraints while building
-an application, a third party should be able to change the application's
-behavior without needing to modify its source code. The behavior of a
-:app:`Pyramid` application that obeys certain constraints can be *overridden*
-or *extended* without modification.
+If a :app:`Pyramid` developer has obeyed certain constraints while building an
+application, a third party should be able to change the application's behavior
+without needing to modify its source code. The behavior of a :app:`Pyramid`
+application that obeys certain constraints can be *overridden* or *extended*
+without modification.
We'll define some jargon here for the benefit of identifying the parties
involved in such an effort.
@@ -16,10 +16,10 @@ Developer
The original application developer.
Integrator
- Another developer who wishes to reuse the application written by the
- original application developer in an unanticipated context. He may also
- wish to modify the original application without changing the original
- application's source code.
+ Another developer who wishes to reuse the application written by the original
+ application developer in an unanticipated context. They may also wish to
+ modify the original application without changing the original application's
+ source code.
The Difference Between "Extensible" and "Pluggable" Applications
----------------------------------------------------------------
@@ -27,31 +27,31 @@ The Difference Between "Extensible" and "Pluggable" Applications
Other web frameworks, such as :term:`Django`, advertise that they allow
developers to create "pluggable applications". They claim that if you create
an application in a certain way, it will be integratable in a sensible,
-structured way into another arbitrarily-written application or project
-created by a third-party developer.
+structured way into another arbitrarily-written application or project created
+by a third-party developer.
:app:`Pyramid`, as a platform, does not claim to provide such a feature. The
platform provides no guarantee that you can create an application and package
it up such that an arbitrary integrator can use it as a subcomponent in a
larger Pyramid application or project. Pyramid does not mandate the
constraints necessary for such a pattern to work satisfactorily. Because
-Pyramid is not very "opinionated", developers are able to use wildly
-different patterns and technologies to build an application. A given Pyramid
-application may happen to be reusable by a particular third party integrator,
-because the integrator and the original developer may share similar base
-technology choices (such as the use of a particular relational database or
-ORM). But the same application may not be reusable by a different developer,
-because he has made different technology choices which are incompatible with
-the original developer's.
+Pyramid is not very "opinionated", developers are able to use wildly different
+patterns and technologies to build an application. A given Pyramid application
+may happen to be reusable by a particular third party integrator because the
+integrator and the original developer may share similar base technology choices
+(such as the use of a particular relational database or ORM). But the same
+application may not be reusable by a different developer, because they have
+made different technology choices which are incompatible with the original
+developer's.
As a result, the concept of a "pluggable application" is left to layers built
above Pyramid, such as a "CMS" layer or "application server" layer. Such
-layers are apt to provide the necessary "opinions" (such as mandating a
-storage layer, a templating system, and a structured, well-documented pattern
-of registering that certain URLs map to certain bits of code) which makes the
-concept of a "pluggable application" possible. "Pluggable applications",
-thus, should not plug into Pyramid itself but should instead plug into a
-system written atop Pyramid.
+layers are apt to provide the necessary "opinions" (such as mandating a storage
+layer, a templating system, and a structured, well-documented pattern of
+registering that certain URLs map to certain bits of code) which makes the
+concept of a "pluggable application" possible. "Pluggable applications", thus,
+should not plug into Pyramid itself but should instead plug into a system
+written atop Pyramid.
Although it does not provide for "pluggable applications", Pyramid *does*
provide a rich set of mechanisms which allows for the extension of a single
@@ -64,13 +64,13 @@ Pyramid applications are *extensible*.
.. _building_an_extensible_app:
-Rules for Building An Extensible Application
+Rules for Building an Extensible Application
--------------------------------------------
There is only one rule you need to obey if you want to build a maximally
extensible :app:`Pyramid` application: as a developer, you should factor any
-overrideable :term:`imperative configuration` you've created into functions
-which can be used via :meth:`pyramid.config.Configurator.include` rather than
+overridable :term:`imperative configuration` you've created into functions
+which can be used via :meth:`pyramid.config.Configurator.include`, rather than
inlined as calls to methods of a :term:`Configurator` within the ``main``
function in your application's ``__init__.py``. For example, rather than:
@@ -84,8 +84,8 @@ function in your application's ``__init__.py``. For example, rather than:
config.add_view('myapp.views.view1', name='view1')
config.add_view('myapp.views.view2', name='view2')
-You should move the calls to ``add_view`` outside of the (non-reusable)
-``if __name__ == '__main__'`` block, and into a reusable function:
+You should move the calls to ``add_view`` outside of the (non-reusable) ``if
+__name__ == '__main__'`` block, and into a reusable function:
.. code-block:: python
:linenos:
@@ -100,13 +100,12 @@ You should move the calls to ``add_view`` outside of the (non-reusable)
config.add_view('myapp.views.view1', name='view1')
config.add_view('myapp.views.view2', name='view2')
-Doing this allows an integrator to maximally reuse the configuration
-statements that relate to your application by allowing him to selectively
-include or disinclude the configuration functions you've created from an
-"override package".
+Doing this allows an integrator to maximally reuse the configuration statements
+that relate to your application by allowing them to selectively include or
+exclude the configuration functions you've created from an "override package".
-Alternately, you can use :term:`ZCML` for the purpose of making configuration
-extensible and overrideable. :term:`ZCML` declarations that belong to an
+Alternatively you can use :term:`ZCML` for the purpose of making configuration
+extensible and overridable. :term:`ZCML` declarations that belong to an
application can be overridden and extended by integrators as necessary in a
similar fashion. If you use only :term:`ZCML` to configure your application,
it will automatically be maximally extensible without any manual effort. See
@@ -115,16 +114,15 @@ it will automatically be maximally extensible without any manual effort. See
Fundamental Plugpoints
~~~~~~~~~~~~~~~~~~~~~~
-The fundamental "plug points" of an application developed using
-:app:`Pyramid` are *routes*, *views*, and *assets*. Routes are declarations
-made using the :meth:`pyramid.config.Configurator.add_route` method. Views
-are declarations made using the :meth:`pyramid.config.Configurator.add_view`
-method. Assets are files that are
-accessed by :app:`Pyramid` using the :term:`pkg_resources` API such as static
-files and templates via a :term:`asset specification`. Other directives and
-configurator methods also deal in routes, views, and assets. For example, the
-``add_handler`` directive of the ``pyramid_handlers`` package adds a single
-route, and some number of views.
+The fundamental "plug points" of an application developed using :app:`Pyramid`
+are *routes*, *views*, and *assets*. Routes are declarations made using the
+:meth:`pyramid.config.Configurator.add_route` method. Views are declarations
+made using the :meth:`pyramid.config.Configurator.add_view` method. Assets are
+files that are accessed by :app:`Pyramid` using the :term:`pkg_resources` API
+such as static files and templates via a :term:`asset specification`. Other
+directives and configurator methods also deal in routes, views, and assets.
+For example, the ``add_handler`` directive of the ``pyramid_handlers`` package
+adds a single route and some number of views.
.. index::
single: extending an existing application
@@ -133,10 +131,9 @@ Extending an Existing Application
---------------------------------
The steps for extending an existing application depend largely on whether the
-application does or does not use configuration decorators and/or imperative
-code.
+application does or does not use configuration decorators or imperative code.
-If The Application Has Configuration Decorations
+If the Application Has Configuration Decorations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You've inherited a :app:`Pyramid` application which you'd like to extend or
@@ -155,9 +152,9 @@ registers more views or routes.
config.add_view('mypackage.views.myview', name='myview')
If you want to *override* configuration in the application, you *may* need to
-run :meth:`pyramid.config.Configurator.commit` after performing the scan of
-the original package, then add additional configuration that registers more
-views or routes which performs overrides.
+run :meth:`pyramid.config.Configurator.commit` after performing the scan of the
+original package, then add additional configuration that registers more views
+or routes which perform overrides.
.. code-block:: python
:linenos:
@@ -170,11 +167,11 @@ views or routes which performs overrides.
Once this is done, you should be able to extend or override the application
like any other (see :ref:`extending_the_application`).
-You can alternately just prevent a :term:`scan` from happening (by omitting
-any call to the :meth:`pyramid.config.Configurator.scan` method). This will
+You can alternatively just prevent a :term:`scan` from happening by omitting
+any call to the :meth:`pyramid.config.Configurator.scan` method. This will
cause the decorators attached to objects in the target application to do
-nothing. At this point, you will need to convert all the configuration done
-in decorators into equivalent imperative configuration or ZCML and add that
+nothing. At this point, you will need to convert all the configuration done in
+decorators into equivalent imperative configuration or ZCML, and add that
configuration or ZCML to a separate Python package as described in
:ref:`extending_the_application`.
@@ -183,37 +180,37 @@ configuration or ZCML to a separate Python package as described in
Extending the Application
~~~~~~~~~~~~~~~~~~~~~~~~~
-To extend or override the behavior of an existing application, you will need
-to create a new package which includes the configuration of the old package,
-and you'll perhaps need to create implementations of the types of things
-you'd like to override (such as views), which are referred to within the
-original package.
+To extend or override the behavior of an existing application, you will need to
+create a new package which includes the configuration of the old package, and
+you'll perhaps need to create implementations of the types of things you'd like
+to override (such as views), to which they are referred within the original
+package.
-The general pattern for extending an existing application looks something
-like this:
+The general pattern for extending an existing application looks something like
+this:
- Create a new Python package. The easiest way to do this is to create a new
:app:`Pyramid` application using the scaffold mechanism. See
:ref:`creating_a_project` for more information.
-- In the new package, create Python files containing views and other
- overridden elements, such as templates and static assets as necessary.
+- In the new package, create Python files containing views and other overridden
+ elements, such as templates and static assets as necessary.
- Install the new package into the same Python environment as the original
- application (e.g. ``$VENV/bin/python setup.py develop`` or
+ application (e.g., ``$VENV/bin/python setup.py develop`` or
``$VENV/bin/python setup.py install``).
- Change the ``main`` function in the new package's ``__init__.py`` to include
the original :app:`Pyramid` application's configuration functions via
:meth:`pyramid.config.Configurator.include` statements or a :term:`scan`.
-- Wire the new views and assets created in the new package up using
- imperative registrations within the ``main`` function of the
- ``__init__.py`` file of the new application. This wiring should happen
- *after* including the configuration functions of the old application.
- These registrations will extend or override any registrations performed by
- the original application. See :ref:`overriding_views`,
- :ref:`overriding_routes` and :ref:`overriding_resources`.
+- Wire the new views and assets created in the new package up using imperative
+ registrations within the ``main`` function of the ``__init__.py`` file of the
+ new application. This wiring should happen *after* including the
+ configuration functions of the old application. These registrations will
+ extend or override any registrations performed by the original application.
+ See :ref:`overriding_views`, :ref:`overriding_routes`, and
+ :ref:`overriding_resources`.
.. index::
pair: overriding; views
@@ -221,17 +218,17 @@ like this:
.. _overriding_views:
Overriding Views
-~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~
-The :term:`view configuration` declarations you make which *override*
+The :term:`view configuration` declarations that you make which *override*
application behavior will usually have the same :term:`view predicate`
-attributes as the original you wish to override. These ``<view>``
-declarations will point at "new" view code, in the override package you've
-created. The new view code itself will usually be cut-n-paste copies of view
-callables from the original application with slight tweaks.
+attributes as the original that you wish to override. These ``<view>``
+declarations will point at "new" view code in the override package that you've
+created. The new view code itself will usually be copy-and-paste copies of
+view callables from the original application with slight tweaks.
-For example, if the original application has the following
-``configure_views`` configuration method:
+For example, if the original application has the following ``configure_views``
+configuration method:
.. code-block:: python
:linenos:
@@ -254,13 +251,13 @@ configuration function:
config.include(configure_views)
config.add_view('theoverrideapp.views.theview', name='theview')
-In this case, the ``theoriginalapp.views.theview`` view will never be
-executed. Instead, a new view, ``theoverrideapp.views.theview`` will be
-executed instead, when request circumstances dictate.
+In this case, the ``theoriginalapp.views.theview`` view will never be executed.
+Instead, a new view, ``theoverrideapp.views.theview`` will be executed when
+request circumstances dictate.
A similar pattern can be used to *extend* the application with ``add_view``
-declarations. Just register a new view against some other set of predicates
-to make sure the URLs it implies are available on some other page rendering.
+declarations. Just register a new view against some other set of predicates to
+make sure the URLs it implies are available on some other page rendering.
.. index::
pair: overriding; routes
@@ -270,13 +267,13 @@ to make sure the URLs it implies are available on some other page rendering.
Overriding Routes
~~~~~~~~~~~~~~~~~
-Route setup is currently typically performed in a sequence of ordered calls
-to :meth:`~pyramid.config.Configurator.add_route`. Because these calls are
+Route setup is currently typically performed in a sequence of ordered calls to
+:meth:`~pyramid.config.Configurator.add_route`. Because these calls are
ordered relative to each other, and because this ordering is typically
important, you should retain their relative ordering when performing an
-override. Typically, this means *copying* all the ``add_route`` statements
-into the override package's file and changing them as necessary. Then
-disinclude any ``add_route`` statements from the original application.
+override. Typically this means *copying* all the ``add_route`` statements into
+the override package's file and changing them as necessary. Then exclude any
+``add_route`` statements from the original application.
.. index::
pair: overriding; assets
@@ -288,9 +285,8 @@ Overriding Assets
Assets are files on the filesystem that are accessible within a Python
*package*. An entire chapter is devoted to assets: :ref:`assets_chapter`.
-Within this chapter is a section named :ref:`overriding_assets_section`.
-This section of that chapter describes in detail how to override package
-assets with other assets by using the
-:meth:`pyramid.config.Configurator.override_asset` method. Add such
-``override_asset`` calls to your override package's ``__init__.py`` to
-perform overrides.
+Within this chapter is a section named :ref:`overriding_assets_section`. This
+section of that chapter describes in detail how to override package assets with
+other assets by using the :meth:`pyramid.config.Configurator.override_asset`
+method. Add such ``override_asset`` calls to your override package's
+``__init__.py`` to perform overrides.
diff --git a/docs/narr/firstapp.rst b/docs/narr/firstapp.rst
index e73ef66ac..6a952dec9 100644
--- a/docs/narr/firstapp.rst
+++ b/docs/narr/firstapp.rst
@@ -4,7 +4,7 @@
.. _firstapp_chapter:
Creating Your First :app:`Pyramid` Application
-=================================================
+==============================================
In this chapter, we will walk through the creation of a tiny :app:`Pyramid`
application. After we're finished creating the application, we'll explain in
@@ -37,28 +37,27 @@ On Windows:
C:\> %VENV%\Scripts\python.exe helloworld.py
-This command will not return and nothing will be printed to the console.
-When port 8080 is visited by a browser on the URL ``/hello/world``, the
-server will simply serve up the text "Hello world!". If your application is
-running on your local system, using `<http://localhost:8080/hello/world>`_
-in a browser will show this result.
+This command will not return and nothing will be printed to the console. When
+port 8080 is visited by a browser on the URL ``/hello/world``, the server will
+simply serve up the text "Hello world!". If your application is running on
+your local system, using `<http://localhost:8080/hello/world>`_ in a browser
+will show this result.
Each time you visit a URL served by the application in a browser, a logging
line will be emitted to the console displaying the hostname, the date, the
-request method and path, and some additional information. This output is
-done by the wsgiref server we've used to serve this application. It logs an
-"access log" in Apache combined logging format to the console.
+request method and path, and some additional information. This output is done
+by the wsgiref server we've used to serve this application. It logs an "access
+log" in Apache combined logging format to the console.
Press ``Ctrl-C`` (or ``Ctrl-Break`` on Windows) to stop the application.
Now that we have a rudimentary understanding of what the application does,
-let's examine it piece-by-piece.
+let's examine it piece by piece.
Imports
~~~~~~~
-The above ``helloworld.py`` script uses the following set of import
-statements:
+The above ``helloworld.py`` script uses the following set of import statements:
.. literalinclude:: helloworld.py
:linenos:
@@ -71,32 +70,32 @@ The script imports the :class:`~pyramid.config.Configurator` class from the
Like many other Python web frameworks, :app:`Pyramid` uses the :term:`WSGI`
protocol to connect an application and a web server together. The
-:mod:`wsgiref` server is used in this example as a WSGI server for
-convenience, as it is shipped within the Python standard library.
+:mod:`wsgiref` server is used in this example as a WSGI server for convenience,
+as it is shipped within the Python standard library.
-The script also imports the :class:`pyramid.response.Response` class for
-later use. An instance of this class will be used to create a web response.
+The script also imports the :class:`pyramid.response.Response` class for later
+use. An instance of this class will be used to create a web response.
View Callable Declarations
~~~~~~~~~~~~~~~~~~~~~~~~~~
-The above script, beneath its set of imports, defines a function
-named ``hello_world``.
+The above script, beneath its set of imports, defines a function named
+``hello_world``.
.. literalinclude:: helloworld.py
:linenos:
:pyobject: hello_world
-The function accepts a single argument (``request``) and it returns an
-instance of the :class:`pyramid.response.Response` class. The single
-argument to the class' constructor is a string computed from parameters
-matched from the URL. This value becomes the body of the response.
+The function accepts a single argument (``request``) and it returns an instance
+of the :class:`pyramid.response.Response` class. The single argument to the
+class' constructor is a string computed from parameters matched from the URL.
+This value becomes the body of the response.
-This function is known as a :term:`view callable`. A view callable
-accepts a single argument, ``request``. It is expected to return a
-:term:`response` object. A view callable doesn't need to be a function; it
-can be represented via another type of object, like a class or an instance,
-but for our purposes here, a function serves us well.
+This function is known as a :term:`view callable`. A view callable accepts a
+single argument, ``request``. It is expected to return a :term:`response`
+object. A view callable doesn't need to be a function; it can be represented
+via another type of object, like a class or an instance, but for our purposes
+here, a function serves us well.
A view callable is always called with a :term:`request` object. A request
object is a representation of an HTTP request sent to :app:`Pyramid` via the
@@ -105,10 +104,10 @@ active :term:`WSGI` server.
A view callable is required to return a :term:`response` object because a
response object has all the information necessary to formulate an actual HTTP
response; this object is then converted to text by the :term:`WSGI` server
-which called Pyramid and it is sent back to the requesting browser. To
-return a response, each view callable creates an instance of the
-:class:`~pyramid.response.Response` class. In the ``hello_world`` function,
-a string is passed as the body to the response.
+which called Pyramid and it is sent back to the requesting browser. To return
+a response, each view callable creates an instance of the
+:class:`~pyramid.response.Response` class. In the ``hello_world`` function, a
+string is passed as the body to the response.
.. index::
single: imperative configuration
@@ -120,16 +119,16 @@ a string is passed as the body to the response.
Application Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~
-In the above script, the following code represents the *configuration* of
-this simple application. The application is configured using the previously
-defined imports and function definitions, placed within the confines of an
-``if`` statement:
+In the above script, the following code represents the *configuration* of this
+simple application. The application is configured using the previously defined
+imports and function definitions, placed within the confines of an ``if``
+statement:
.. literalinclude:: helloworld.py
:linenos:
:lines: 9-15
-Let's break this down piece-by-piece.
+Let's break this down piece by piece.
Configurator Construction
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -140,26 +139,26 @@ Configurator Construction
The ``if __name__ == '__main__':`` line in the code sample above represents a
Python idiom: the code inside this if clause is not invoked unless the script
-containing this code is run directly from the operating system command
-line. For example, if the file named ``helloworld.py`` contains the entire
-script body, the code within the ``if`` statement will only be invoked when
-``python helloworld.py`` is executed from the command line.
-
-Using the ``if`` clause is necessary -- or at least best practice -- because
-code in a Python ``.py`` file may be eventually imported via the Python
-``import`` statement by another ``.py`` file. ``.py`` files that are
-imported by other ``.py`` files are referred to as *modules*. By using the
-``if __name__ == '__main__':`` idiom, the script above is indicating that it does
-not want the code within the ``if`` statement to execute if this module is
-imported from another; the code within the ``if`` block should only be run
-during a direct script execution.
+containing this code is run directly from the operating system command line.
+For example, if the file named ``helloworld.py`` contains the entire script
+body, the code within the ``if`` statement will only be invoked when ``python
+helloworld.py`` is executed from the command line.
+
+Using the ``if`` clause is necessary—or at least best practice—because code in
+a Python ``.py`` file may be eventually imported via the Python ``import``
+statement by another ``.py`` file. ``.py`` files that are imported by other
+``.py`` files are referred to as *modules*. By using the ``if __name__ ==
+'__main__':`` idiom, the script above is indicating that it does not want the
+code within the ``if`` statement to execute if this module is imported from
+another; the code within the ``if`` block should only be run during a direct
+script execution.
The ``config = Configurator()`` line above creates an instance of the
:class:`~pyramid.config.Configurator` class. The resulting ``config`` object
represents an API which the script uses to configure this particular
:app:`Pyramid` application. Methods called on the Configurator will cause
-registrations to be made in an :term:`application registry` associated with
-the application.
+registrations to be made in an :term:`application registry` associated with the
+application.
.. _adding_configuration:
@@ -170,13 +169,13 @@ Adding Configuration
:linenos:
:lines: 11-12
-First line above calls the :meth:`pyramid.config.Configurator.add_route`
-method, which registers a :term:`route` to match any URL path that begins
-with ``/hello/`` followed by a string.
+The first line above calls the :meth:`pyramid.config.Configurator.add_route`
+method, which registers a :term:`route` to match any URL path that begins with
+``/hello/`` followed by a string.
-The second line registers the ``hello_world`` function as a
-:term:`view callable` and makes sure that it will be called when the
-``hello`` route is matched.
+The second line registers the ``hello_world`` function as a :term:`view
+callable` and makes sure that it will be called when the ``hello`` route is
+matched.
.. index::
single: make_wsgi_app
@@ -190,25 +189,24 @@ WSGI Application Creation
:lines: 13
After configuring views and ending configuration, the script creates a WSGI
-*application* via the :meth:`pyramid.config.Configurator.make_wsgi_app`
-method. A call to ``make_wsgi_app`` implies that all configuration is
-finished (meaning all method calls to the configurator, which sets up views
-and various other configuration settings, have been performed). The
-``make_wsgi_app`` method returns a :term:`WSGI` application object that can
-be used by any WSGI server to present an application to a requestor.
-:term:`WSGI` is a protocol that allows servers to talk to Python
-applications. We don't discuss :term:`WSGI` in any depth within this book,
-but you can learn more about it by visiting `wsgi.org
-<http://wsgi.org>`_.
-
-The :app:`Pyramid` application object, in particular, is an instance of a
-class representing a :app:`Pyramid` :term:`router`. It has a reference to
-the :term:`application registry` which resulted from method calls to the
-configurator used to configure it. The :term:`router` consults the registry
-to obey the policy choices made by a single application. These policy
-choices were informed by method calls to the :term:`Configurator` made
-earlier; in our case, the only policy choices made were implied by calls
-to its ``add_view`` and ``add_route`` methods.
+*application* via the :meth:`pyramid.config.Configurator.make_wsgi_app` method.
+A call to ``make_wsgi_app`` implies that all configuration is finished
+(meaning all method calls to the configurator, which sets up views and various
+other configuration settings, have been performed). The ``make_wsgi_app``
+method returns a :term:`WSGI` application object that can be used by any WSGI
+server to present an application to a requestor. :term:`WSGI` is a protocol
+that allows servers to talk to Python applications. We don't discuss
+:term:`WSGI` in any depth within this book, but you can learn more about it by
+visiting `wsgi.org <http://wsgi.org>`_.
+
+The :app:`Pyramid` application object, in particular, is an instance of a class
+representing a :app:`Pyramid` :term:`router`. It has a reference to the
+:term:`application registry` which resulted from method calls to the
+configurator used to configure it. The :term:`router` consults the registry to
+obey the policy choices made by a single application. These policy choices
+were informed by method calls to the :term:`Configurator` made earlier; in our
+case, the only policy choices made were implied by calls to its ``add_view``
+and ``add_route`` methods.
WSGI Application Serving
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -217,37 +215,36 @@ WSGI Application Serving
:linenos:
:lines: 14-15
-Finally, we actually serve the application to requestors by starting up a
-WSGI server. We happen to use the :mod:`wsgiref` ``make_server`` server
-maker for this purpose. We pass in as the first argument ``'0.0.0.0'``,
-which means "listen on all TCP interfaces." By default, the HTTP server
-listens only on the ``127.0.0.1`` interface, which is problematic if you're
-running the server on a remote system and you wish to access it with a web
-browser from a local system. We also specify a TCP port number to listen on,
-which is 8080, passing it as the second argument. The final argument is the
-``app`` object (a :term:`router`), which is the application we wish to
-serve. Finally, we call the server's ``serve_forever`` method, which starts
-the main loop in which it will wait for requests from the outside world.
-
-When this line is invoked, it causes the server to start listening on TCP
-port 8080. The server will serve requests forever, or at least until we stop
-it by killing the process which runs it (usually by pressing ``Ctrl-C``
-or ``Ctrl-Break`` in the terminal we used to start it).
+Finally, we actually serve the application to requestors by starting up a WSGI
+server. We happen to use the :mod:`wsgiref` ``make_server`` server maker for
+this purpose. We pass in as the first argument ``'0.0.0.0'``, which means
+"listen on all TCP interfaces". By default, the HTTP server listens only on
+the ``127.0.0.1`` interface, which is problematic if you're running the server
+on a remote system and you wish to access it with a web browser from a local
+system. We also specify a TCP port number to listen on, which is 8080, passing
+it as the second argument. The final argument is the ``app`` object (a
+:term:`router`), which is the application we wish to serve. Finally, we call
+the server's ``serve_forever`` method, which starts the main loop in which it
+will wait for requests from the outside world.
+
+When this line is invoked, it causes the server to start listening on TCP port
+8080. The server will serve requests forever, or at least until we stop it by
+killing the process which runs it (usually by pressing ``Ctrl-C`` or
+``Ctrl-Break`` in the terminal we used to start it).
Conclusion
~~~~~~~~~~
Our hello world application is one of the simplest possible :app:`Pyramid`
applications, configured "imperatively". We can see that it's configured
-imperatively because the full power of Python is available to us as we
-perform configuration tasks.
+imperatively because the full power of Python is available to us as we perform
+configuration tasks.
References
----------
-For more information about the API of a :term:`Configurator` object,
-see :class:`~pyramid.config.Configurator` .
+For more information about the API of a :term:`Configurator` object, see
+:class:`~pyramid.config.Configurator` .
For more information about :term:`view configuration`, see
:ref:`view_config_chapter`.
-
diff --git a/docs/narr/hellotraversal.rst b/docs/narr/hellotraversal.rst
index 0a93b8f16..543e2171f 100644
--- a/docs/narr/hellotraversal.rst
+++ b/docs/narr/hellotraversal.rst
@@ -1,64 +1,60 @@
.. _hello_traversal_chapter:
Hello Traversal World
-======================
-
+=====================
.. index::
single: traversal quick example
-Traversal is an alternative to URL dispatch which allows Pyramid
-applications to map URLs to code.
+Traversal is an alternative to URL dispatch which allows Pyramid applications
+to map URLs to code.
-If code speaks louder than words, maybe this will help. Here is a
-single-file Pyramid application that uses traversal:
+If code speaks louder than words, maybe this will help. Here is a single-file
+Pyramid application that uses traversal:
.. literalinclude:: hellotraversal.py
:linenos:
-You may notice that this application is intentionally very similar to
-the "hello world" app from :doc:`firstapp`.
+You may notice that this application is intentionally very similar to the
+"hello world" application from :doc:`firstapp`.
On lines 5-6, we create a trivial :term:`resource` class that's just a
dictionary subclass.
-On lines 8-9, we hard-code a :term:`resource tree` in our :term:`root
-factory` function.
+On lines 8-9, we hard-code a :term:`resource tree` in our :term:`root factory`
+function.
-On lines 11-13 we define a single :term:`view callable` that can
-display a single instance of our Resource class, passed as the
-``context`` argument.
+On lines 11-13, we define a single :term:`view callable` that can display a
+single instance of our ``Resource`` class, passed as the ``context`` argument.
-The rest of the file sets up and serves our pyramid WSGI app. Line 18
-is where our view gets configured for use whenever the traversal ends
-with an instance of our Resource class.
+The rest of the file sets up and serves our :app:`Pyramid` WSGI app. Line 18
+is where our view gets configured for use whenever the traversal ends with an
+instance of our ``Resource`` class.
-Interestingly, there are no URLs explicitly configured in this
-application. Instead, the URL space is defined entirely by the keys in
-the resource tree.
+Interestingly, there are no URLs explicitly configured in this application.
+Instead, the URL space is defined entirely by the keys in the resource tree.
Example requests
----------------
-If this example is running on http://localhost:8080, and the user
-browses to http://localhost:8080/a/b, Pyramid will call
-``get_root(request)`` to get the root resource, then traverse the tree
-from there by key; starting from the root, it will find the child with
-key ``"a"``, then its child with key ``"b"``; then use that as the
-``context`` argument for calling ``hello_world_of_resources``.
+If this example is running on http://localhost:8080, and the user browses to
+http://localhost:8080/a/b, Pyramid will call ``get_root(request)`` to get the
+root resource, then traverse the tree from there by key; starting from the
+root, it will find the child with key ``"a"``, then its child with key ``"b"``;
+then use that as the ``context`` argument for calling
+``hello_world_of_resources``.
-Or, if the user browses to http://localhost:8080/ , Pyramid will
-stop at the root - the outermost Resource instance, in this case - and
-use that as the ``context`` argument to the same view.
+Or, if the user browses to http://localhost:8080/, Pyramid will stop at the
+root—the outermost ``Resource`` instance, in this case—and use that as the
+``context`` argument to the same view.
-Or, if the user browses to a key that doesn't exist in this resource
-tree, like http://localhost:8080/xyz or
-http://localhost:8080/a/b/c/d, the traversal will end by raising a
-KeyError, and Pyramid will turn that into a 404 HTTP response.
+Or, if the user browses to a key that doesn't exist in this resource tree, like
+http://localhost:8080/xyz or http://localhost:8080/a/b/c/d, the traversal will
+end by raising a KeyError, and Pyramid will turn that into a 404 HTTP response.
-A more complicated application could have many types of resources,
-with different view callables defined for each type, and even multiple
-views for each type.
+A more complicated application could have many types of resources, with
+different view callables defined for each type, and even multiple views for
+each type.
.. seealso::
@@ -66,4 +62,3 @@ views for each type.
For more about *why* you might use traversal, see
:doc:`muchadoabouttraversal`.
-
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index 4da36e730..7ff119b53 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -14,12 +14,12 @@ in various ways.
Changing the Not Found View
---------------------------
-When :app:`Pyramid` can't map a URL to view code, it invokes a :term:`Not
-Found View`, which is a :term:`view callable`. The default Not Found View
-can be overridden through application configuration.
+When :app:`Pyramid` can't map a URL to view code, it invokes a :term:`Not Found
+View`, which is a :term:`view callable`. The default Not Found View can be
+overridden through application configuration.
-If your application uses :term:`imperative configuration`, you can replace
-the Not Found View by using the
+If your application uses :term:`imperative configuration`, you can replace the
+Not Found View by using the
:meth:`pyramid.config.Configurator.add_notfound_view` method:
.. code-block:: python
@@ -77,14 +77,14 @@ Views can carry predicates limiting their applicability. For example:
config = Configurator()
config.scan()
-The ``notfound_get`` view will be called when a view could not be found and
-the request method was ``GET``. The ``notfound_post`` view will be called
-when a view could not be found and the request method was ``POST``.
+The ``notfound_get`` view will be called when a view could not be found and the
+request method was ``GET``. The ``notfound_post`` view will be called when a
+view could not be found and the request method was ``POST``.
Like any other view, the Not Found View must accept at least a ``request``
-parameter, or both ``context`` and ``request``. The ``request`` is the
-current :term:`request` representing the denied action. The ``context`` (if
-used in the call signature) will be the instance of the
+parameter, or both ``context`` and ``request``. The ``request`` is the current
+:term:`request` representing the denied action. The ``context`` (if used in
+the call signature) will be the instance of the
:exc:`~pyramid.httpexceptions.HTTPNotFound` exception that caused the view to
be called.
@@ -106,13 +106,13 @@ callable:
.. note::
- When a Not Found View callable is invoked, it is passed a
- :term:`request`. The ``exception`` attribute of the request will be an
- instance of the :exc:`~pyramid.httpexceptions.HTTPNotFound` exception that
- caused the Not Found View to be called. The value of
- ``request.exception.message`` will be a value explaining why the Not Found
- error was raised. This message has different values depending whether the
- ``pyramid.debug_notfound`` environment setting is true or false.
+ When a Not Found View callable is invoked, it is passed a :term:`request`.
+ The ``exception`` attribute of the request will be an instance of the
+ :exc:`~pyramid.httpexceptions.HTTPNotFound` exception that caused the Not
+ Found View to be called. The value of ``request.exception.message`` will be
+ a value explaining why the Not Found exception was raised. This message has
+ different values depending on whether the ``pyramid.debug_notfound``
+ environment setting is true or false.
.. note::
@@ -124,9 +124,9 @@ callable:
.. warning::
- When a Not Found View callable accepts an argument list as
- described in :ref:`request_and_context_view_definitions`, the ``context``
- passed as the first argument to the view callable will be the
+ When a Not Found View callable accepts an argument list as described in
+ :ref:`request_and_context_view_definitions`, the ``context`` passed as the
+ first argument to the view callable will be the
:exc:`~pyramid.httpexceptions.HTTPNotFound` exception instance. If
available, the resource context will still be available as
``request.context``.
@@ -140,13 +140,13 @@ Changing the Forbidden View
---------------------------
When :app:`Pyramid` can't authorize execution of a view based on the
-:term:`authorization policy` in use, it invokes a :term:`forbidden view`.
-The default forbidden response has a 403 status code and is very plain, but
-the view which generates it can be overridden as necessary.
+:term:`authorization policy` in use, it invokes a :term:`forbidden view`. The
+default forbidden response has a 403 status code and is very plain, but the
+view which generates it can be overridden as necessary.
The :term:`forbidden view` callable is a view callable like any other. The
-:term:`view configuration` which causes it to be a "forbidden" view consists
-of using the :meth:`pyramid.config.Configurator.add_forbidden_view` API or the
+:term:`view configuration` which causes it to be a "forbidden" view consists of
+using the :meth:`pyramid.config.Configurator.add_forbidden_view` API or the
:class:`pyramid.view.forbidden_view_config` decorator.
For example, you can add a forbidden view by using the
@@ -181,14 +181,11 @@ as a forbidden view:
config.scan()
Like any other view, the forbidden view must accept at least a ``request``
-parameter, or both ``context`` and ``request``. If a forbidden view
-callable accepts both ``context`` and ``request``, the HTTP Exception is passed
-as context. The ``context`` as found by the router when view was
-denied (that you normally would expect) is available as
-``request.context``. The ``request`` is the current :term:`request`
-representing the denied action.
-
-
+parameter, or both ``context`` and ``request``. If a forbidden view callable
+accepts both ``context`` and ``request``, the HTTP Exception is passed as
+context. The ``context`` as found by the router when the view was denied (which
+you normally would expect) is available as ``request.context``. The
+``request`` is the current :term:`request` representing the denied action.
Here's some sample code that implements a minimal forbidden view:
@@ -203,15 +200,15 @@ Here's some sample code that implements a minimal forbidden view:
.. note::
- When a forbidden view callable is invoked, it is passed a
- :term:`request`. The ``exception`` attribute of the request will be an
- instance of the :exc:`~pyramid.httpexceptions.HTTPForbidden` exception
- that caused the forbidden view to be called. The value of
- ``request.exception.message`` will be a value explaining why the forbidden
- was raised and ``request.exception.result`` will be extended information
- about the forbidden exception. These messages have different values
- depending whether the ``pyramid.debug_authorization`` environment setting
- is true or false.
+ When a forbidden view callable is invoked, it is passed a :term:`request`.
+ The ``exception`` attribute of the request will be an instance of the
+ :exc:`~pyramid.httpexceptions.HTTPForbidden` exception that caused the
+ forbidden view to be called. The value of ``request.exception.message``
+ will be a value explaining why the forbidden exception was raised, and
+ ``request.exception.result`` will be extended information about the
+ forbidden exception. These messages have different values depending on
+ whether the ``pyramid.debug_authorization`` environment setting is true or
+ false.
.. index::
single: request factory
@@ -223,11 +220,11 @@ Changing the Request Factory
Whenever :app:`Pyramid` handles a request from a :term:`WSGI` server, it
creates a :term:`request` object based on the WSGI environment it has been
-passed. By default, an instance of the :class:`pyramid.request.Request`
-class is created to represent the request object.
+passed. By default, an instance of the :class:`pyramid.request.Request` class
+is created to represent the request object.
-The class (aka "factory") that :app:`Pyramid` uses to create a request object
-instance can be changed by passing a ``request_factory`` argument to the
+The class (a.k.a., "factory") that :app:`Pyramid` uses to create a request
+object instance can be changed by passing a ``request_factory`` argument to the
constructor of the :term:`configurator`. This argument can be either a
callable or a :term:`dotted Python name` representing a callable.
@@ -242,7 +239,7 @@ callable or a :term:`dotted Python name` representing a callable.
config = Configurator(request_factory=MyRequest)
If you're doing imperative configuration, and you'd rather do it after you've
-already constructed a :term:`configurator` it can also be registered via the
+already constructed a :term:`configurator`, it can also be registered via the
:meth:`pyramid.config.Configurator.set_request_factory` method:
.. code-block:: python
@@ -262,19 +259,19 @@ already constructed a :term:`configurator` it can also be registered via the
.. _adding_request_method:
-Adding Methods or Properties to Request Object
-----------------------------------------------
+Adding Methods or Properties to a Request Object
+------------------------------------------------
-.. versionadded:: 1.4.
+.. versionadded:: 1.4
Since each Pyramid application can only have one :term:`request` factory,
-:ref:`changing the request factory <changing_the_request_factory>`
-is not that extensible, especially if you want to build composable features
-(e.g., Pyramid add-ons and plugins).
+:ref:`changing the request factory <changing_the_request_factory>` is not that
+extensible, especially if you want to build composable features (e.g., Pyramid
+add-ons and plugins).
A lazy property can be registered to the request object via the
-:meth:`pyramid.config.Configurator.add_request_method` API. This allows you
-to specify a callable that will be available on the request object, but will not
+:meth:`pyramid.config.Configurator.add_request_method` API. This allows you to
+specify a callable that will be available on the request object, but will not
actually execute the function until accessed.
.. warning::
@@ -298,9 +295,10 @@ actually execute the function until accessed.
config.add_request_method(total)
config.add_request_method(prop, reify=True)
-In the above example, ``total`` is added as a method. However, ``prop`` is added
-as a property and its result is cached per-request by setting ``reify=True``.
-This way, we eliminate the overhead of running the function multiple times.
+In the above example, ``total`` is added as a method. However, ``prop`` is
+added as a property and its result is cached per-request by setting
+``reify=True``. This way, we eliminate the overhead of running the function
+multiple times.
>>> request.total(1, 2, 3)
6
@@ -349,18 +347,67 @@ We attach and cache an object named ``extra`` to the ``request`` object.
the property
.. index::
+ single: response factory
+
+.. _changing_the_response_factory:
+
+Changing the Response Factory
+-----------------------------
+
+.. versionadded:: 1.6
+
+Whenever :app:`Pyramid` returns a response from a view, it creates a
+:term:`response` object. By default, an instance of the
+:class:`pyramid.response.Response` class is created to represent the response
+object.
+
+The factory that :app:`Pyramid` uses to create a response object instance can
+be changed by passing a :class:`pyramid.interfaces.IResponseFactory` argument
+to the constructor of the :term:`configurator`. This argument can be either a
+callable or a :term:`dotted Python name` representing a callable.
+
+The factory takes a single positional argument, which is a :term:`Request`
+object. The argument may be ``None``.
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.response import Response
+
+ class MyResponse(Response):
+ pass
+
+ config = Configurator(response_factory=lambda r: MyResponse())
+
+If you're doing imperative configuration and you'd rather do it after you've
+already constructed a :term:`configurator`, it can also be registered via the
+:meth:`pyramid.config.Configurator.set_response_factory` method:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.config import Configurator
+ from pyramid.response import Response
+
+ class MyResponse(Response):
+ pass
+
+ config = Configurator()
+ config.set_response_factory(lambda r: MyResponse())
+
+.. index::
single: before render event
single: adding renderer globals
.. _beforerender_event:
-Using The Before Render Event
+Using the Before Render Event
-----------------------------
Subscribers to the :class:`pyramid.events.BeforeRender` event may introspect
and modify the set of :term:`renderer globals` before they are passed to a
-:term:`renderer`. This event object iself has a dictionary-like interface
-that can be used for this purpose. For example:
+:term:`renderer`. This event object iself has a dictionary-like interface that
+can be used for this purpose. For example:
.. code-block:: python
:linenos:
@@ -372,22 +419,22 @@ that can be used for this purpose. For example:
def add_global(event):
event['mykey'] = 'foo'
-An object of this type is sent as an event just before a :term:`renderer`
-is invoked.
+An object of this type is sent as an event just before a :term:`renderer` is
+invoked.
-If a subscriber attempts to add a key that already exist in the renderer
+If a subscriber attempts to add a key that already exists in the renderer
globals dictionary, a :exc:`KeyError` is raised. This limitation is enforced
because event subscribers do not possess any relative ordering. The set of
keys added to the renderer globals dictionary by all
-:class:`pyramid.events.BeforeRender` subscribers and renderer globals
-factories must be unique.
+:class:`pyramid.events.BeforeRender` subscribers and renderer globals factories
+must be unique.
The dictionary returned from the view is accessible through the
:attr:`rendering_val` attribute of a :class:`~pyramid.events.BeforeRender`
event.
-Suppose you return ``{'mykey': 'somevalue', 'mykey2': 'somevalue2'}`` from
-your view callable, like so:
+Suppose you return ``{'mykey': 'somevalue', 'mykey2': 'somevalue2'}`` from your
+view callable, like so:
.. code-block:: python
:linenos:
@@ -443,24 +490,23 @@ A response callback is a callable which accepts two positional parameters:
response.cache_control.max_age = 360
request.add_response_callback(cache_callback)
-No response callback is called if an unhandled exception happens in
-application code, or if the response object returned by a :term:`view
-callable` is invalid. Response callbacks *are*, however, invoked when a
-:term:`exception view` is rendered successfully: in such a case, the
-:attr:`request.exception` attribute of the request when it enters a response
-callback will be an exception object instead of its default value of
-``None``.
+No response callback is called if an unhandled exception happens in application
+code, or if the response object returned by a :term:`view callable` is invalid.
+Response callbacks *are*, however, invoked when a :term:`exception view` is
+rendered successfully. In such a case, the :attr:`request.exception` attribute
+of the request when it enters a response callback will be an exception object
+instead of its default value of ``None``.
Response callbacks are called in the order they're added
-(first-to-most-recently-added). All response callbacks are called *before*
-the :class:`~pyramid.events.NewResponse` event is sent. Errors raised by
-response callbacks are not handled specially. They will be propagated to the
-caller of the :app:`Pyramid` router application.
+(first-to-most-recently-added). All response callbacks are called *before* the
+:class:`~pyramid.events.NewResponse` event is sent. Errors raised by response
+callbacks are not handled specially. They will be propagated to the caller of
+the :app:`Pyramid` router application.
A response callback has a lifetime of a *single* request. If you want a
response callback to happen as the result of *every* request, you must
-re-register the callback into every new request (perhaps within a subscriber
-of a :class:`~pyramid.events.NewRequest` event).
+re-register the callback into every new request (perhaps within a subscriber of
+a :class:`~pyramid.events.NewRequest` event).
.. index::
single: finished callback
@@ -471,15 +517,15 @@ Using Finished Callbacks
------------------------
A :term:`finished callback` is a function that will be called unconditionally
-by the :app:`Pyramid` :term:`router` at the very end of request processing.
-A finished callback can be used to perform an action at the end of a request
+by the :app:`Pyramid` :term:`router` at the very end of request processing. A
+finished callback can be used to perform an action at the end of a request
unconditionally.
The :meth:`pyramid.request.Request.add_finished_callback` method is used to
register a finished callback.
-A finished callback is a callable which accepts a single positional
-parameter: ``request``. For example:
+A finished callback is a callable which accepts a single positional parameter:
+``request``. For example:
.. code-block:: python
:linenos:
@@ -494,29 +540,27 @@ parameter: ``request``. For example:
request.add_finished_callback(log_callback)
Finished callbacks are called in the order they're added
-(first-to-most-recently-added). Finished callbacks (unlike a
-:term:`response callback`) are *always* called, even if an exception
-happens in application code that prevents a response from being
-generated.
-
-The set of finished callbacks associated with a request are called *very
-late* in the processing of that request; they are essentially the very last
-thing called by the :term:`router` before a request "ends". They are called
-after response processing has already occurred in a top-level ``finally:``
-block within the router request processing code. As a result, mutations
-performed to the ``request`` provided to a finished callback will have no
-meaningful effect, because response processing will have already occurred,
-and the request's scope will expire almost immediately after all finished
-callbacks have been processed.
-
-Errors raised by finished callbacks are not handled specially. They
-will be propagated to the caller of the :app:`Pyramid` router
-application.
+(first-to-most-recently-added). Finished callbacks (unlike a :term:`response
+callback`) are *always* called, even if an exception happens in application
+code that prevents a response from being generated.
+
+The set of finished callbacks associated with a request are called *very late*
+in the processing of that request; they are essentially the very last thing
+called by the :term:`router` before a request "ends". They are called after
+response processing has already occurred in a top-level ``finally:`` block
+within the router request processing code. As a result, mutations performed to
+the ``request`` provided to a finished callback will have no meaningful effect,
+because response processing will have already occurred, and the request's scope
+will expire almost immediately after all finished callbacks have been
+processed.
+
+Errors raised by finished callbacks are not handled specially. They will be
+propagated to the caller of the :app:`Pyramid` router application.
A finished callback has a lifetime of a *single* request. If you want a
finished callback to happen as the result of *every* request, you must
-re-register the callback into every new request (perhaps within a subscriber
-of a :class:`~pyramid.events.NewRequest` event).
+re-register the callback into every new request (perhaps within a subscriber of
+a :class:`~pyramid.events.NewRequest` event).
.. index::
single: traverser
@@ -528,8 +572,8 @@ Changing the Traverser
The default :term:`traversal` algorithm that :app:`Pyramid` uses is explained
in :ref:`traversal_algorithm`. Though it is rarely necessary, this default
-algorithm can be swapped out selectively for a different traversal pattern
-via configuration.
+algorithm can be swapped out selectively for a different traversal pattern via
+configuration.
.. code-block:: python
:linenos:
@@ -575,10 +619,10 @@ that implements the following interface:
More than one traversal algorithm can be active at the same time. For
instance, if your :term:`root factory` returns more than one type of object
-conditionally, you could claim that an alternate traverser adapter is "for"
+conditionally, you could claim that an alternative traverser adapter is "for"
only one particular class or interface. 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 used. For example:
+used. Otherwise the default traverser would be used. For example:
.. code-block:: python
:linenos:
@@ -590,13 +634,13 @@ used. Otherwise, the default traverser would be used. For example:
config.add_traverser(Traverser, MyRoot)
If the above stanza was added to a Pyramid ``__init__.py`` file's ``main``
-function, :app:`Pyramid` would use the ``myapp.traversal.Traverser`` only
-when the application :term:`root factory` returned an instance of the
+function, :app:`Pyramid` would use the ``myapp.traversal.Traverser`` only when
+the application :term:`root factory` returned an instance of the
``myapp.resources.MyRoot`` object. Otherwise it would use the default
:app:`Pyramid` traverser to do traversal.
.. index::
- single: url generator
+ single: URL generator
.. _changing_resource_url:
@@ -606,9 +650,8 @@ Changing How :meth:`pyramid.request.Request.resource_url` Generates a URL
When you add a traverser as described in :ref:`changing_the_traverser`, it's
often convenient to continue to use the
:meth:`pyramid.request.Request.resource_url` API. However, since the way
-traversal is done will have been modified, the URLs it generates by default
-may be incorrect when used against resources derived from your custom
-traverser.
+traversal is done will have been modified, the URLs it generates by default may
+be incorrect when used against resources derived from your custom traverser.
If you've added a traverser, you can change how
:meth:`~pyramid.request.Request.resource_url` generates a URL for a specific
@@ -625,13 +668,13 @@ For example:
config.add_resource_url_adapter(ResourceURLAdapter, MyRoot)
-In the above example, the ``myapp.traversal.ResourceURLAdapter`` class will
-be used to provide services to :meth:`~pyramid.request.Request.resource_url`
-any time the :term:`resource` passed to ``resource_url`` is of the class
+In the above example, the ``myapp.traversal.ResourceURLAdapter`` class will be
+used to provide services to :meth:`~pyramid.request.Request.resource_url` any
+time the :term:`resource` passed to ``resource_url`` is of the class
``myapp.resources.MyRoot``. The ``resource_iface`` argument ``MyRoot``
represents the type of interface that must be possessed by the resource for
this resource url factory to be found. If the ``resource_iface`` argument is
-omitted, this resource url adapter will be used for *all* resources.
+omitted, this resource URL adapter will be used for *all* resources.
The API that must be implemented by a class that provides
:class:`~pyramid.interfaces.IResourceURL` is as follows:
@@ -644,8 +687,8 @@ The API that must be implemented by a class that provides
resource
"""
def __init__(self, resource, request):
- """ Accept the resource and request and set self.physical_path and
- self.virtual_path"""
+ """ Accept the resource and request and set self.physical_path and
+ self.virtual_path """
self.virtual_path = some_function_of(resource, request)
self.physical_path = some_other_function_of(resource, request)
@@ -654,7 +697,8 @@ The default context URL generator is available for perusal as the class
<https://github.com/Pylons/pyramid/blob/master/pyramid/traversal.py>`_ of the
:term:`Pylons` GitHub Pyramid repository.
-See :meth:`pyramid.config.add_resource_url_adapter` for more information.
+See :meth:`pyramid.config.Configurator.add_resource_url_adapter` for more
+information.
.. index::
single: IResponse
@@ -672,25 +716,24 @@ callable on a per-type basis by using a hook involving
:meth:`pyramid.config.Configurator.add_response_adapter` or the
:class:`~pyramid.response.response_adapter` decorator.
-Pyramid, in various places, adapts the result of calling a view callable to
-the :class:`~pyramid.interfaces.IResponse` interface to ensure that the
-object returned by the view callable is a "true" response object. The vast
-majority of time, the result of this adaptation is the result object itself,
-as view callables written by "civilians" who read the narrative documentation
-contained in this manual will always return something that implements the
-:class:`~pyramid.interfaces.IResponse` interface. Most typically, this will
-be an instance of the :class:`pyramid.response.Response` class or a subclass.
-If a civilian returns a non-Response object from a view callable that isn't
-configured to use a :term:`renderer`, he will typically expect the router to
+Pyramid, in various places, adapts the result of calling a view callable to the
+:class:`~pyramid.interfaces.IResponse` interface to ensure that the object
+returned by the view callable is a "true" response object. The vast majority
+of time, the result of this adaptation is the result object itself, as view
+callables written by "civilians" who read the narrative documentation contained
+in this manual will always return something that implements the
+:class:`~pyramid.interfaces.IResponse` interface. Most typically, this will be
+an instance of the :class:`pyramid.response.Response` class or a subclass. If a
+civilian returns a non-Response object from a view callable that isn't
+configured to use a :term:`renderer`, they will typically expect the router to
raise an error. However, you can hook Pyramid in such a way that users can
return arbitrary values from a view callable by providing an adapter which
converts the arbitrary return value into something that implements
:class:`~pyramid.interfaces.IResponse`.
For example, if you'd like to allow view callables to return bare string
-objects (without requiring a :term:`renderer` to convert a string to a
-response object), you can register an adapter which converts the string to a
-Response:
+objects (without requiring a :term:`renderer` to convert a string to a response
+object), you can register an adapter which converts the string to a Response:
.. code-block:: python
:linenos:
@@ -705,9 +748,9 @@ Response:
config.add_response_adapter(string_response_adapter, str)
-Likewise, if you want to be able to return a simplified kind of response
-object from view callables, you can use the IResponse hook to register an
-adapter to the more complex IResponse interface:
+Likewise, if you want to be able to return a simplified kind of response object
+from view callables, you can use the IResponse hook to register an adapter to
+the more complex IResponse interface:
.. code-block:: python
:linenos:
@@ -728,9 +771,9 @@ adapter to the more complex IResponse interface:
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
+to make sure that 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:
@@ -740,7 +783,7 @@ to make sure the object implements every attribute and method outlined in
@implementer(IResponse)
class MyResponse(object):
- # ... an implementation of every method and attribute
+ # ... an implementation of every method and attribute
# documented in IResponse should follow ...
When an alternate response object implementation is returned by a view
@@ -755,8 +798,8 @@ startup time, as by their nature, instances of this class (and instances of
subclasses of the class) will natively provide IResponse. The adapter
registered for ``webob.Response`` simply returns the response object.
-Instead of using :meth:`pyramid.config.Configurator.add_response_adapter`,
-you can use the :class:`pyramid.response.response_adapter` decorator:
+Instead of using :meth:`pyramid.config.Configurator.add_response_adapter`, you
+can use the :class:`pyramid.response.response_adapter` decorator:
.. code-block:: python
:linenos:
@@ -792,31 +835,29 @@ callables by employing a :term:`view mapper`.
A view mapper is an object that accepts a set of keyword arguments and which
returns a callable. The returned callable is called with the :term:`view
-callable` object. The returned callable should itself return another
-callable which can be called with the "internal calling protocol" ``(context,
+callable` object. The returned callable should itself return another callable
+which can be called with the "internal calling protocol" ``(context,
request)``.
You can use a view mapper in a number of ways:
-- by setting a ``__view_mapper__`` attribute (which is the view mapper
- object) on the view callable itself
+- by setting a ``__view_mapper__`` attribute (which is the view mapper object)
+ on the view callable itself
-- by passing the mapper object to
- :meth:`pyramid.config.Configurator.add_view` (or its declarative/decorator
- equivalents) as the ``mapper`` argument.
+- by passing the mapper object to :meth:`pyramid.config.Configurator.add_view`
+ (or its declarative and decorator equivalents) as the ``mapper`` argument
-- by registering a *default* view mapper.
+- by registering a *default* view mapper
Here's an example of a view mapper that emulates (somewhat) a Pylons
"controller". The mapper is initialized with some keyword arguments. Its
``__call__`` method accepts the view object (which will be a class). It uses
-the ``attr`` keyword argument it is passed to determine which attribute
-should be used as an action method. The wrapper method it returns accepts
-``(context, request)`` and returns the result of calling the action method
-with keyword arguments implied by the :term:`matchdict` after popping the
-``action`` out of it. This somewhat emulates the Pylons style of calling
-action methods with routing parameters pulled out of the route matching dict
-as keyword arguments.
+the ``attr`` keyword argument it is passed to determine which attribute should
+be used as an action method. The wrapper method it returns accepts ``(context,
+request)`` and returns the result of calling the action method with keyword
+arguments implied by the :term:`matchdict` after popping the ``action`` out of
+it. This somewhat emulates the Pylons style of calling action methods with
+routing parameters pulled out of the route matching dict as keyword arguments.
.. code-block:: python
:linenos:
@@ -868,8 +909,8 @@ The :meth:`pyramid.config.Configurator.set_view_mapper` method can be used to
set a *default* view mapper (overriding the superdefault view mapper used by
Pyramid itself).
-A *single* view registration can use a view mapper by passing the mapper as
-the ``mapper`` argument to :meth:`~pyramid.config.Configurator.add_view`.
+A *single* view registration can use a view mapper by passing the mapper as the
+``mapper`` argument to :meth:`~pyramid.config.Configurator.add_view`.
.. index::
single: configuration decorator
@@ -879,14 +920,14 @@ the ``mapper`` argument to :meth:`~pyramid.config.Configurator.add_view`.
Registering Configuration Decorators
------------------------------------
-Decorators such as :class:`~pyramid.view.view_config` don't change the
-behavior of the functions or classes they're decorating. Instead, when a
-:term:`scan` is performed, a modified version of the function or class is
-registered with :app:`Pyramid`.
+Decorators such as :class:`~pyramid.view.view_config` don't change the behavior
+of the functions or classes they're decorating. Instead when a :term:`scan` is
+performed, a modified version of the function or class is registered with
+:app:`Pyramid`.
You may wish to have your own decorators that offer such behaviour. This is
-possible by using the :term:`Venusian` package in the same way that it is
-used by :app:`Pyramid`.
+possible by using the :term:`Venusian` package in the same way that it is used
+by :app:`Pyramid`.
By way of example, let's suppose you want to write a decorator that registers
the function it wraps with a :term:`Zope Component Architecture` "utility"
@@ -896,8 +937,7 @@ available once your application's configuration is at least partially
completed. A normal decorator would fail as it would be executed before the
configuration had even begun.
-However, using :term:`Venusian`, the decorator could be written as
-follows:
+However, using :term:`Venusian`, the decorator could be written as follows:
.. code-block:: python
:linenos:
@@ -919,18 +959,17 @@ follows:
venusian.attach(wrapped, self.register)
return wrapped
-This decorator could then be used to register functions throughout
-your code:
+This decorator could then be used to register functions throughout your code:
.. code-block:: python
:linenos:
@registerFunction('/some/path')
def my_function():
- do_stuff()
+ do_stuff()
-However, the utility would only be looked up when a :term:`scan` was
-performed, enabling you to set up the utility in advance:
+However, the utility would only be looked up when a :term:`scan` was performed,
+enabling you to set up the utility in advance:
.. code-block:: python
:linenos:
@@ -945,10 +984,10 @@ performed, enabling you to set up the utility in advance:
class UtilityImplementation:
def __init__(self):
- self.registrations = {}
+ self.registrations = {}
def register(self, path, callable_):
- self.registrations[path] = callable_
+ self.registrations[path] = callable_
if __name__ == '__main__':
config = Configurator()
@@ -972,27 +1011,27 @@ Registering Tweens
A :term:`tween` (a contraction of the word "between") is a bit of code that
sits between the Pyramid router's main request handling function and the
upstream WSGI component that uses :app:`Pyramid` as its "app". This is a
-feature that may be used by Pyramid framework extensions, to provide, for
+feature that may be used by Pyramid framework extensions to provide, for
example, Pyramid-specific view timing support bookkeeping code that examines
exceptions before they are returned to the upstream WSGI application. Tweens
-behave a bit like :term:`WSGI` :term:`middleware` but they have the benefit of
+behave a bit like :term:`WSGI` :term:`middleware`, but they have the benefit of
running in a context in which they have access to the Pyramid :term:`request`,
-:term:`response` and :term:`application registry` as well as the Pyramid
+:term:`response`, and :term:`application registry`, as well as the Pyramid
rendering machinery.
Creating a Tween
~~~~~~~~~~~~~~~~
-To create a tween, you must write a "tween factory". A tween factory
-must be a globally importable callable which accepts two arguments:
-``handler`` and ``registry``. ``handler`` will be either the main
-Pyramid request handling function or another tween. ``registry`` will be the
-Pyramid :term:`application registry` represented by this Configurator. A
-tween factory must return the tween (a callable object) when it is called.
+To create a tween, you must write a "tween factory". A tween factory must be a
+globally importable callable which accepts two arguments: ``handler`` and
+``registry``. ``handler`` will be either the main Pyramid request handling
+function or another tween. ``registry`` will be the Pyramid :term:`application
+registry` represented by this Configurator. A tween factory must return the
+tween (a callable object) when it is called.
A tween is called with a single argument, ``request``, which is the
-:term:`request` created by Pyramid's router when it receives a WSGI request.
-A tween should return a :term:`response`, usually the one generated by the
+:term:`request` created by Pyramid's router when it receives a WSGI request. A
+tween should return a :term:`response`, usually the one generated by the
downstream Pyramid application.
You can write the tween factory as a simple closure-returning function:
@@ -1040,14 +1079,14 @@ method:
return response
-You should avoid mutating any state on the tween instance. The tween is
-invoked once per request and any shared mutable state needs to be carefully
-handled to avoid any race conditions.
+You should avoid mutating any state on the tween instance. The tween is invoked
+once per request and any shared mutable state needs to be carefully handled to
+avoid any race conditions.
The closure style performs slightly better and enables you to conditionally
omit the tween from the request processing pipeline (see the following timing
tween example), whereas the class style makes it easier to have shared mutable
-state, and it allows subclassing.
+state and allows subclassing.
Here's a complete example of a tween that logs the time spent processing each
request:
@@ -1082,13 +1121,12 @@ request:
In the above example, the tween factory defines a ``timing_tween`` tween and
returns it if ``asbool(registry.settings.get('do_timing'))`` is true. It
-otherwise simply returns the handler it was given. The ``registry.settings``
-attribute is a handle to the deployment settings provided by the user
-(usually in an ``.ini`` file). In this case, if the user has defined a
-``do_timing`` setting, and that setting is ``True``, the user has said she
-wants to do timing, so the tween factory returns the timing tween; it
-otherwise just returns the handler it has been provided, preventing any
-timing.
+otherwise simply returns the handler which it was given. The
+``registry.settings`` attribute is a handle to the deployment settings provided
+by the user (usually in an ``.ini`` file). In this case, if the user has
+defined a ``do_timing`` setting and that setting is ``True``, the user has said
+they want to do timing, so the tween factory returns the timing tween; it
+otherwise just returns the handler it has been provided, preventing any timing.
The example timing tween simply records the start time, calls the downstream
handler, logs the number of seconds consumed by the downstream handler, and
@@ -1114,29 +1152,28 @@ Pyramid application:
Note that you must use a :term:`dotted Python name` as the first argument to
:meth:`pyramid.config.Configurator.add_tween`; this must point at a tween
factory. You cannot pass the tween factory object itself to the method: it
-must be :term:`dotted Python name` that points to a globally importable
-object. In the above example, we assume that a ``timing_tween_factory``
-tween factory was defined in a module named ``myapp.tweens``, so the tween
-factory is importable as ``myapp.tweens.timing_tween_factory``.
-
-When you use :meth:`pyramid.config.Configurator.add_tween`, you're
-instructing the system to use your tween factory at startup time unless the
-user has provided an explicit tween list in his configuration. This is
-what's meant by an "implicit" tween. A user can always elect to supply an
-explicit tween list, reordering or disincluding implicitly added tweens. See
+must be :term:`dotted Python name` that points to a globally importable object.
+In the above example, we assume that a ``timing_tween_factory`` tween factory
+was defined in a module named ``myapp.tweens``, so the tween factory is
+importable as ``myapp.tweens.timing_tween_factory``.
+
+When you use :meth:`pyramid.config.Configurator.add_tween`, you're instructing
+the system to use your tween factory at startup time unless the user has
+provided an explicit tween list in their configuration. This is what's meant
+by an "implicit" tween. A user can always elect to supply an explicit tween
+list, reordering or disincluding implicitly added tweens. See
:ref:`explicit_tween_ordering` for more information about explicit tween
ordering.
-If more than one call to :meth:`pyramid.config.Configurator.add_tween` is
-made within a single application configuration, the tweens will be chained
-together at application startup time. The *first* tween factory added via
-``add_tween`` will be called with the Pyramid exception view tween factory as
-its ``handler`` argument, then the tween factory added directly after that
-one will be called with the result of the first tween factory as its
-``handler`` argument, and so on, ad infinitum until all tween factories have
-been called. The Pyramid router will use the outermost tween produced by this
-chain (the tween generated by the very last tween factory added) as its
-request handler function. For example:
+If more than one call to :meth:`pyramid.config.Configurator.add_tween` is made
+within a single application configuration, the tweens will be chained together
+at application startup time. The *first* tween factory added via ``add_tween``
+will be called with the Pyramid exception view tween factory as its ``handler``
+argument, then the tween factory added directly after that one will be called
+with the result of the first tween factory as its ``handler`` argument, and so
+on, ad infinitum until all tween factories have been called. The Pyramid router
+will use the outermost tween produced by this chain (the tween generated by the
+very last tween factory added) as its request handler function. For example:
.. code-block:: python
:linenos:
@@ -1147,8 +1184,7 @@ request handler function. For example:
config.add_tween('myapp.tween_factory1')
config.add_tween('myapp.tween_factory2')
-The above example will generate an implicit tween chain that looks like
-this::
+The above example will generate an implicit tween chain that looks like this::
INGRESS (implicit)
myapp.tween_factory2
@@ -1162,37 +1198,36 @@ Suggesting Implicit Tween Ordering
By default, as described above, the ordering of the chain is controlled
entirely by the relative ordering of calls to
:meth:`pyramid.config.Configurator.add_tween`. However, the caller of
-add_tween can provide an optional hint that can influence the implicit tween
-chain ordering by supplying ``under`` or ``over`` (or both) arguments to
-:meth:`~pyramid.config.Configurator.add_tween`. These hints are only
-used when an explicit tween ordering is not used. See
-:ref:`explicit_tween_ordering` for a description of how to set an explicit
-tween ordering.
+``add_tween`` can provide an optional hint that can influence the implicit
+tween chain ordering by supplying ``under`` or ``over`` (or both) arguments to
+:meth:`~pyramid.config.Configurator.add_tween`. These hints are only used when
+an explicit tween ordering is not used. See :ref:`explicit_tween_ordering` for
+a description of how to set an explicit tween ordering.
Allowable values for ``under`` or ``over`` (or both) are:
-- ``None`` (the default).
+- ``None`` (the default),
-- A :term:`dotted Python name` to a tween factory: a string representing the
- predicted dotted name of a tween factory added in a call to ``add_tween``
- in the same configuration session.
+- a :term:`dotted Python name` to a tween factory: a string representing the
+ predicted dotted name of a tween factory added in a call to ``add_tween`` in
+ the same configuration session,
-- One of the constants :attr:`pyramid.tweens.MAIN`,
- :attr:`pyramid.tweens.INGRESS`, or :attr:`pyramid.tweens.EXCVIEW`.
+- one of the constants :attr:`pyramid.tweens.MAIN`,
+ :attr:`pyramid.tweens.INGRESS`, or :attr:`pyramid.tweens.EXCVIEW`, or
-- An iterable of any combination of the above. This allows the user to specify
+- an iterable of any combination of the above. This allows the user to specify
fallbacks if the desired tween is not included, as well as compatibility
with multiple other tweens.
-Effectively, ``over`` means "closer to the request ingress than" and
-``under`` means "closer to the main Pyramid application than".
-You can think of an onion with outer layers over the inner layers,
-the application being under all the layers at the center.
+Effectively, ``over`` means "closer to the request ingress than" and ``under``
+means "closer to the main Pyramid application than". You can think of an onion
+with outer layers over the inner layers, the application being under all the
+layers at the center.
For example, the following call to
-:meth:`~pyramid.config.Configurator.add_tween` will attempt to place the
-tween factory represented by ``myapp.tween_factory`` directly 'above' (in
-``ptweens`` order) the main Pyramid request handler.
+:meth:`~pyramid.config.Configurator.add_tween` will attempt to place the tween
+factory represented by ``myapp.tween_factory`` directly "above" (in ``ptweens``
+order) the main Pyramid request handler.
.. code-block:: python
:linenos:
@@ -1201,8 +1236,7 @@ tween factory represented by ``myapp.tween_factory`` directly 'above' (in
config.add_tween('myapp.tween_factory', over=pyramid.tweens.MAIN)
-The above example will generate an implicit tween chain that looks like
-this::
+The above example will generate an implicit tween chain that looks like this::
INGRESS (implicit)
pyramid.tweens.excview_tween_factory (implicit)
@@ -1210,9 +1244,8 @@ this::
MAIN (implicit)
Likewise, calling the following call to
-:meth:`~pyramid.config.Configurator.add_tween` will attempt to place this
-tween factory 'above' the main handler but 'below' a separately added tween
-factory:
+:meth:`~pyramid.config.Configurator.add_tween` will attempt to place this tween
+factory "above" the main handler but "below" a separately added tween factory:
.. code-block:: python
:linenos:
@@ -1225,8 +1258,7 @@ factory:
over=pyramid.tweens.MAIN,
under='myapp.tween_factory1')
-The above example will generate an implicit tween chain that looks like
-this::
+The above example will generate an implicit tween chain that looks like this::
INGRESS (implicit)
pyramid.tweens.excview_tween_factory (implicit)
@@ -1239,28 +1271,28 @@ Specifying neither ``over`` nor ``under`` is equivalent to specifying
If all options for ``under`` (or ``over``) cannot be found in the current
configuration, it is an error. If some options are specified purely for
-compatibilty with other tweens, just add a fallback of MAIN or INGRESS.
-For example, ``under=('someothertween', 'someothertween2', INGRESS)``.
-This constraint will require the tween to be located under both the
-'someothertween' tween, the 'someothertween2' tween, and INGRESS. If any of
-these is not in the current configuration, this constraint will only organize
-itself based on the tweens that are present.
+compatibilty with other tweens, just add a fallback of ``MAIN`` or ``INGRESS``.
+For example, ``under=('someothertween', 'someothertween2', INGRESS)``. This
+constraint will require the tween to be located under the ``someothertween``
+tween, the ``someothertween2`` tween, and ``INGRESS``. If any of these is not
+in the current configuration, this constraint will only organize itself based
+on the tweens that are present.
.. _explicit_tween_ordering:
Explicit Tween Ordering
~~~~~~~~~~~~~~~~~~~~~~~
-Implicit tween ordering is obviously only best-effort. Pyramid will attempt
-to provide an implicit order of tweens as best it can using hints provided by
-calls to :meth:`~pyramid.config.Configurator.add_tween`, but because it's
-only best-effort, if very precise tween ordering is required, the only
-surefire way to get it is to use an explicit tween order. The deploying user
-can override the implicit tween inclusion and ordering implied by calls to
+Implicit tween ordering is obviously only best-effort. Pyramid will attempt to
+provide an implicit order of tweens as best it can using hints provided by
+calls to :meth:`~pyramid.config.Configurator.add_tween`. But because it's only
+best-effort, if very precise tween ordering is required, the only surefire way
+to get it is to use an explicit tween order. The deploying user can override
+the implicit tween inclusion and ordering implied by calls to
:meth:`~pyramid.config.Configurator.add_tween` entirely by using the
``pyramid.tweens`` settings value. When used, this settings value must be a
-list of Python dotted names which will override the ordering (and inclusion)
-of tween factories in the implicit tween chain. For example:
+list of Python dotted names which will override the ordering (and inclusion) of
+tween factories in the implicit tween chain. For example:
.. code-block:: ini
:linenos:
@@ -1278,19 +1310,19 @@ of tween factories in the implicit tween chain. For example:
In the above configuration, calls made during configuration to
:meth:`pyramid.config.Configurator.add_tween` are ignored, and the user is
telling the system to use the tween factories he has listed in the
-``pyramid.tweens`` configuration setting (each is a :term:`dotted Python
-name` which points to a tween factory) instead of any tween factories added
-via :meth:`pyramid.config.Configurator.add_tween`. The *first* tween factory
-in the ``pyramid.tweens`` list will be used as the producer of the effective
+``pyramid.tweens`` configuration setting (each is a :term:`dotted Python name`
+which points to a tween factory) instead of any tween factories added via
+:meth:`pyramid.config.Configurator.add_tween`. The *first* tween factory in
+the ``pyramid.tweens`` list will be used as the producer of the effective
:app:`Pyramid` request handling function; it will wrap the tween factory
-declared directly "below" it, ad infinitum. The "main" Pyramid request
-handler is implicit, and always "at the bottom".
+declared directly "below" it, ad infinitum. The "main" Pyramid request handler
+is implicit, and always "at the bottom".
.. note::
- Pyramid's own :term:`exception view` handling logic is implemented
- as a tween factory function: :func:`pyramid.tweens.excview_tween_factory`.
- If Pyramid exception view handling is desired, and tween factories are
+ Pyramid's own :term:`exception view` handling logic is implemented as a
+ tween factory function: :func:`pyramid.tweens.excview_tween_factory`. If
+ Pyramid exception view handling is desired, and tween factories are
specified via the ``pyramid.tweens`` configuration setting, the
:func:`pyramid.tweens.excview_tween_factory` function must be added to the
``pyramid.tweens`` configuration setting list explicitly. If it is not
@@ -1299,30 +1331,30 @@ handler is implicit, and always "at the bottom".
Tween Conflicts and Ordering Cycles
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Pyramid will prevent the same tween factory from being added to the tween
-chain more than once using configuration conflict detection. If you wish to
-add the same tween factory more than once in a configuration, you should
-either: a) use a tween factory that is a separate globally importable
-instance object from the factory that it conflicts with b) use a function or
-class as a tween factory with the same logic as the other tween factory it
-conflicts with but with a different ``__name__`` attribute or c) call
+Pyramid will prevent the same tween factory from being added to the tween chain
+more than once using configuration conflict detection. If you wish to add the
+same tween factory more than once in a configuration, you should either: (a)
+use a tween factory that is a separate globally importable instance object from
+the factory that it conflicts with; (b) use a function or class as a tween
+factory with the same logic as the other tween factory it conflicts with, but
+with a different ``__name__`` attribute; or (c) call
:meth:`pyramid.config.Configurator.commit` between calls to
:meth:`pyramid.config.Configurator.add_tween`.
If a cycle is detected in implicit tween ordering when ``over`` and ``under``
-are used in any call to "add_tween", an exception will be raised at startup
+are used in any call to ``add_tween``, an exception will be raised at startup
time.
Displaying Tween Ordering
~~~~~~~~~~~~~~~~~~~~~~~~~
-The ``ptweens`` command-line utility can be used to report the current
-implict and explicit tween chains used by an application. See
+The ``ptweens`` command-line utility can be used to report the current implict
+and explicit tween chains used by an application. See
:ref:`displaying_tweens`.
.. _registering_thirdparty_predicates:
-Adding A Third Party View, Route, or Subscriber Predicate
+Adding a Third Party View, Route, or Subscriber Predicate
---------------------------------------------------------
.. versionadded:: 1.4
@@ -1332,10 +1364,10 @@ Adding A Third Party View, Route, or Subscriber Predicate
View and Route Predicates
~~~~~~~~~~~~~~~~~~~~~~~~~
-View and route predicates used during configuration allow you to narrow the
-set of circumstances under which a view or route will match. For example,
-the ``request_method`` view predicate can be used to ensure a view callable
-is only invoked when the request's method is ``POST``:
+View and route predicates used during configuration allow you to narrow the set
+of circumstances under which a view or route will match. For example, the
+``request_method`` view predicate can be used to ensure a view callable is only
+invoked when the request's method is ``POST``:
.. code-block:: python
@@ -1349,9 +1381,9 @@ Likewise, a similar predicate can be used as a *route* predicate:
config.add_route('name', '/foo', request_method='POST')
-Many other built-in predicates exists (``request_param``, and others). You
-can add third-party predicates to the list of available predicates by using
-one of :meth:`pyramid.config.Configurator.add_view_predicate` or
+Many other built-in predicates exists (``request_param``, and others). You can
+add third-party predicates to the list of available predicates by using one of
+:meth:`pyramid.config.Configurator.add_view_predicate` or
:meth:`pyramid.config.Configurator.add_route_predicate`. The former adds a
view predicate, the latter a route predicate.
@@ -1379,7 +1411,7 @@ the name, is a string representing the name that is expected to be passed to
The second argument is a view or route predicate factory, or a :term:`dotted
Python name` which refers to a view or route predicate factory. A view or
route predicate factory is most often a class with a constructor
-(``__init__``), a ``text`` method, a ``phash`` method and a ``__call__``
+(``__init__``), a ``text`` method, a ``phash`` method, and a ``__call__``
method. For example:
.. code-block:: python
@@ -1399,27 +1431,27 @@ method. For example:
The constructor of a predicate factory takes two arguments: ``val`` and
``config``. The ``val`` argument will be the argument passed to
-``view_config`` (or ``add_view``). In the example above, it will be the
-string ``File``. The second arg, ``config`` will be the Configurator
-instance at the time of configuration.
+``view_config`` (or ``add_view``). In the example above, it will be the string
+``File``. The second argument, ``config``, will be the Configurator instance
+at the time of configuration.
-The ``text`` method must return a string. It should be useful to describe
-the behavior of the predicate in error messages.
+The ``text`` method must return a string. It should be useful to describe the
+behavior of the predicate in error messages.
-The ``phash`` method must return a string or a sequence of strings. It's
-most often the same as ``text``, as long as ``text`` uniquely describes the
-predicate's name and the value passed to the constructor. If ``text`` is
-more general, or doesn't describe things that way, ``phash`` should return a
-string with the name and the value serialized. The result of ``phash`` is
-not seen in output anywhere, it just informs the uniqueness constraints for
-view configuration.
+The ``phash`` method must return a string or a sequence of strings. It's most
+often the same as ``text``, as long as ``text`` uniquely describes the
+predicate's name and the value passed to the constructor. If ``text`` is more
+general, or doesn't describe things that way, ``phash`` should return a string
+with the name and the value serialized. The result of ``phash`` is not seen in
+output anywhere, it just informs the uniqueness constraints for view
+configuration.
The ``__call__`` method of a predicate factory must accept a resource
-(``context``) and a request, and must return ``True`` or ``False``. It is
-the "meat" of the predicate.
+(``context``) and a request, and must return ``True`` or ``False``. It is the
+"meat" of the predicate.
-You can use the same predicate factory as both a view predicate and as a
-route predicate, but you'll need to call ``add_view_predicate`` and
+You can use the same predicate factory as both a view predicate and as a route
+predicate, but you'll need to call ``add_view_predicate`` and
``add_route_predicate`` separately with the same factory.
.. _subscriber_predicates:
@@ -1427,16 +1459,16 @@ route predicate, but you'll need to call ``add_view_predicate`` and
Subscriber Predicates
~~~~~~~~~~~~~~~~~~~~~
-Subscriber predicates work almost exactly like view and route predicates.
-They narrow the set of circumstances in which a subscriber will be called.
-There are several minor differences between a subscriber predicate and a
-view/route predicate:
+Subscriber predicates work almost exactly like view and route predicates. They
+narrow the set of circumstances in which a subscriber will be called. There are
+several minor differences between a subscriber predicate and a view or route
+predicate:
- There are no default subscriber predicates. You must register one to use
one.
-- The ``__call__`` method of a subscriber predicate accepts a single
- ``event`` object instead of a ``context`` and a ``request``.
+- The ``__call__`` method of a subscriber predicate accepts a single ``event``
+ object instead of a ``context`` and a ``request``.
- Not every subscriber predicate can be used with every event type. Some
subscriber predicates will assume a certain event type.
@@ -1470,8 +1502,8 @@ Once you've created a subscriber predicate, it may registered via
Once a subscriber predicate is registered, you can use it in a call to
:meth:`pyramid.config.Configurator.add_subscriber` or to
-:class:`pyramid.events.subscriber`. Here's an example of using the
-previously registered ``request_path_startswith`` predicate in a call to
+:class:`pyramid.events.subscriber`. Here's an example of using the previously
+registered ``request_path_startswith`` predicate in a call to
:meth:`~pyramid.config.Configurator.add_subscriber`:
.. code-block:: python
@@ -1484,7 +1516,7 @@ previously registered ``request_path_startswith`` predicate in a call to
# and at configuration time
- config.add_subscriber(yosubscriber, NewRequest,
+ config.add_subscriber(yosubscriber, NewRequest,
request_path_startswith='/add_yo')
Here's the same subscriber/predicate/event-type combination used via
@@ -1499,22 +1531,19 @@ Here's the same subscriber/predicate/event-type combination used via
def yosubscriber(event):
event.request.yo = 'YO!'
-In either of the above configurations, the ``yosubscriber`` callable will
-only be called if the request path starts with ``/add_yo``. Otherwise the
-event subscriber will not be called.
+In either of the above configurations, the ``yosubscriber`` callable will only
+be called if the request path starts with ``/add_yo``. Otherwise the event
+subscriber will not be called.
Note that the ``request_path_startswith`` subscriber you defined can be used
with events that have a ``request`` attribute, but not ones that do not. So,
for example, the predicate can be used with subscribers registered for
:class:`pyramid.events.NewRequest` and :class:`pyramid.events.ContextFound`
events, but it cannot be used with subscribers registered for
-:class:`pyramid.events.ApplicationCreated` because the latter type of event
-has no ``request`` attribute. The point being: unlike route and view
-predicates, not every type of subscriber predicate will necessarily be
-applicable for use in every subscriber registration. It is not the
-responsibility of the predicate author to make every predicate make sense for
-every event type; it is the responsibility of the predicate consumer to use
-predicates that make sense for a particular event type registration.
-
-
-
+:class:`pyramid.events.ApplicationCreated` because the latter type of event has
+no ``request`` attribute. The point being, unlike route and view predicates,
+not every type of subscriber predicate will necessarily be applicable for use
+in every subscriber registration. It is not the responsibility of the
+predicate author to make every predicate make sense for every event type; it is
+the responsibility of the predicate consumer to use predicates that make sense
+for a particular event type registration.
diff --git a/docs/narr/hybrid.rst b/docs/narr/hybrid.rst
index 4a3258d35..ff26d52ec 100644
--- a/docs/narr/hybrid.rst
+++ b/docs/narr/hybrid.rst
@@ -12,28 +12,26 @@ dispatch. However, to solve a limited set of problems, it's useful to use
.. warning::
Reasoning about the behavior of a "hybrid" URL dispatch + traversal
- application can be challenging. To successfully reason about using
- URL dispatch and traversal together, you need to understand URL
- pattern matching, root factories, and the :term:`traversal`
- algorithm, and the potential interactions between them. Therefore,
- we don't recommend creating an application that relies on hybrid
- behavior unless you must.
+ application can be challenging. To successfully reason about using URL
+ dispatch and traversal together, you need to understand URL pattern
+ matching, root factories, and the :term:`traversal` algorithm, and the
+ potential interactions between them. Therefore, we don't recommend creating
+ an application that relies on hybrid behavior unless you must.
A Review of Non-Hybrid Applications
-----------------------------------
-When used according to the tutorials in its documentation
-:app:`Pyramid` is a "dual-mode" framework: the tutorials explain
-how to create an application in terms of using either :term:`url
-dispatch` *or* :term:`traversal`. This chapter details how you might
-combine these two dispatch mechanisms, but we'll review how they work
-in isolation before trying to combine them.
+When used according to the tutorials in its documentation, :app:`Pyramid` is a
+"dual-mode" framework: the tutorials explain how to create an application in
+terms of using either :term:`URL dispatch` *or* :term:`traversal`. This
+chapter details how you might combine these two dispatch mechanisms, but we'll
+review how they work in isolation before trying to combine them.
URL Dispatch Only
~~~~~~~~~~~~~~~~~
-An application that uses :term:`url dispatch` exclusively to map URLs to code
-will often have statements like this within application startup
+An application that uses :term:`URL dispatch` exclusively to map URLs to code
+will often have statements like this within its application startup
configuration:
.. code-block:: python
@@ -48,11 +46,11 @@ configuration:
config.add_view('myproject.views.bazbuz', route_name='bazbuz')
Each :term:`route` corresponds to one or more view callables. Each view
-callable is associated with a route by passing a ``route_name`` parameter
-that matches its name during a call to
-:meth:`~pyramid.config.Configurator.add_view`. When a route is matched
-during a request, :term:`view lookup` is used to match the request to its
-associated view callable. The presence of calls to
+callable is associated with a route by passing a ``route_name`` parameter that
+matches its name during a call to
+:meth:`~pyramid.config.Configurator.add_view`. When a route is matched during
+a request, :term:`view lookup` is used to match the request to its associated
+view callable. The presence of calls to
:meth:`~pyramid.config.Configurator.add_route` signify that an application is
using URL dispatch.
@@ -72,12 +70,11 @@ declarations that look like this:
When the above configuration is applied to an application, the
``mypackage.views.foobar`` view callable above will be called when the URL
-``/foobar`` is visited. Likewise, the view ``mypackage.views.bazbuz`` will
-be called when the URL ``/bazbuz`` is visited.
+``/foobar`` is visited. Likewise, the view ``mypackage.views.bazbuz`` will be
+called when the URL ``/bazbuz`` is visited.
Typically, an application that uses traversal exclusively won't perform any
-calls to :meth:`pyramid.config.Configurator.add_route` in its startup
-code.
+calls to :meth:`pyramid.config.Configurator.add_route` in its startup code.
.. index::
single: hybrid applications
@@ -85,149 +82,139 @@ code.
Hybrid Applications
-------------------
-Either traversal or url dispatch alone can be used to create a
-:app:`Pyramid` application. However, it is also possible to
-combine the concepts of traversal and url dispatch when building an
-application: the result is a hybrid application. In a hybrid
-application, traversal is performed *after* a particular route has
-matched.
-
-A hybrid application is a lot more like a "pure" traversal-based
-application than it is like a "pure" URL-dispatch based application.
-But unlike in a "pure" traversal-based application, in a hybrid
-application, :term:`traversal` is performed during a request after a
-route has already matched. This means that the URL pattern that
-represents the ``pattern`` argument of a route must match the
-``PATH_INFO`` of a request, and after the route pattern has matched,
-most of the "normal" rules of traversal with respect to :term:`resource
-location` and :term:`view lookup` apply.
+Either traversal or URL dispatch alone can be used to create a :app:`Pyramid`
+application. However, it is also possible to combine the concepts of traversal
+and URL dispatch when building an application, the result of which is a hybrid
+application. In a hybrid application, traversal is performed *after* a
+particular route has matched.
+
+A hybrid application is a lot more like a "pure" traversal-based application
+than it is like a "pure" URL-dispatch based application. But unlike in a "pure"
+traversal-based application, in a hybrid application :term:`traversal` is
+performed during a request after a route has already matched. This means that
+the URL pattern that represents the ``pattern`` argument of a route must match
+the ``PATH_INFO`` of a request, and after the route pattern has matched, most
+of the "normal" rules of traversal with respect to :term:`resource location`
+and :term:`view lookup` apply.
There are only four real differences between a purely traversal-based
application and a hybrid application:
-- In a purely traversal based application, no routes are defined; in a
- hybrid application, at least one route will be defined.
+- In a purely traversal-based application, no routes are defined. In a hybrid
+ application, at least one route will be defined.
-- In a purely traversal based application, the root object used is
- global, implied by the :term:`root factory` provided at startup
- time; in a hybrid application, the :term:`root` object at which
- traversal begins may be varied on a per-route basis.
+- In a purely traversal-based application, the root object used is global,
+ implied by the :term:`root factory` provided at startup time. In a hybrid
+ application, the :term:`root` object at which traversal begins may be varied
+ on a per-route basis.
-- In a purely traversal-based application, the ``PATH_INFO`` of the
- underlying :term:`WSGI` environment is used wholesale as a traversal
- path; in a hybrid application, the traversal path is not the entire
- ``PATH_INFO`` string, but a portion of the URL determined by a
- matching pattern in the matched route configuration's pattern.
+- In a purely traversal-based application, the ``PATH_INFO`` of the underlying
+ :term:`WSGI` environment is used wholesale as a traversal path. In a hybrid
+ application, the traversal path is not the entire ``PATH_INFO`` string, but a
+ portion of the URL determined by a matching pattern in the matched route
+ configuration's pattern.
-- In a purely traversal based application, view configurations which
- do not mention a ``route_name`` argument are considered during
- :term:`view lookup`; in a hybrid application, when a route is
- matched, only view configurations which mention that route's name as
- a ``route_name`` are considered during :term:`view lookup`.
+- In a purely traversal-based application, view configurations which do not
+ mention a ``route_name`` argument are considered during :term:`view lookup`.
+ In a hybrid application, when a route is matched, only view configurations
+ which mention that route's name as a ``route_name`` are considered during
+ :term:`view lookup`.
-More generally, a hybrid application *is* a traversal-based
-application except:
+More generally, a hybrid application *is* a traversal-based application except:
-- the traversal *root* is chosen based on the route configuration of
- the route that matched instead of from the ``root_factory`` supplied
- during application startup configuration.
+- the traversal *root* is chosen based on the route configuration of the route
+ that matched, instead of from the ``root_factory`` supplied during
+ application startup configuration.
-- the traversal *path* is chosen based on the route configuration of
- the route that matched rather than from the ``PATH_INFO`` of a
- request.
+- the traversal *path* is chosen based on the route configuration of the route
+ that matched, rather than from the ``PATH_INFO`` of a request.
-- the set of views that may be chosen during :term:`view lookup` when
- a route matches are limited to those which specifically name a
- ``route_name`` in their configuration that is the same as the
- matched route's ``name``.
+- the set of views that may be chosen during :term:`view lookup` when a route
+ matches are limited to those which specifically name a ``route_name`` in
+ their configuration that is the same as the matched route's ``name``.
-To create a hybrid mode application, use a :term:`route configuration`
-that implies a particular :term:`root factory` and which also includes
-a ``pattern`` argument that contains a special dynamic part: either
-``*traverse`` or ``*subpath``.
+To create a hybrid mode application, use a :term:`route configuration` that
+implies a particular :term:`root factory` and which also includes a ``pattern``
+argument that contains a special dynamic part: either ``*traverse`` or
+``*subpath``.
The Root Object for a Route Match
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A hybrid application implies that traversal is performed during a
-request after a route has matched. Traversal, by definition, must
-always begin at a root object. Therefore it's important to know
-*which* root object will be traversed after a route has matched.
+A hybrid application implies that traversal is performed during a request after
+a route has matched. Traversal, by definition, must always begin at a root
+object. Therefore it's important to know *which* root object will be traversed
+after a route has matched.
-Figuring out which :term:`root` object results from a particular route
-match is straightforward. When a route is matched:
+Figuring out which :term:`root` object results from a particular route match is
+straightforward. When a route is matched:
-- If the route's configuration has a ``factory`` argument which
- points to a :term:`root factory` callable, that callable will be
- called to generate a :term:`root` object.
+- If the route's configuration has a ``factory`` argument which points to a
+ :term:`root factory` callable, that callable will be called to generate a
+ :term:`root` object.
-- If the route's configuration does not have a ``factory``
- argument, the *global* :term:`root factory` will be called to
- generate a :term:`root` object. The global root factory is the
- callable implied by the ``root_factory`` argument passed to the
- :class:`~pyramid.config.Configurator` at application
- startup time.
+- If the route's configuration does not have a ``factory`` argument, the
+ *global* :term:`root factory` will be called to generate a :term:`root`
+ object. The global root factory is the callable implied by the
+ ``root_factory`` argument passed to the :class:`~pyramid.config.Configurator`
+ at application startup time.
- If a ``root_factory`` argument is not provided to the
- :class:`~pyramid.config.Configurator` at startup time, a
- *default* root factory is used. The default root factory is used to
- generate a root object.
+ :class:`~pyramid.config.Configurator` at startup time, a *default* root
+ factory is used. The default root factory is used to generate a root object.
.. note::
Root factories related to a route were explained previously within
- :ref:`route_factories`. Both the global root factory and default
- root factory were explained previously within
- :ref:`the_resource_tree`.
+ :ref:`route_factories`. Both the global root factory and default root
+ factory were explained previously within :ref:`the_resource_tree`.
.. index::
pair: hybrid applications; *traverse route pattern
.. _using_traverse_in_a_route_pattern:
-Using ``*traverse`` In a Route Pattern
+Using ``*traverse`` in a Route Pattern
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A hybrid application most often implies the inclusion of a route
-configuration that contains the special token ``*traverse`` at the end
-of a route's pattern:
+A hybrid application most often implies the inclusion of a route configuration
+that contains the special token ``*traverse`` at the end of a route's pattern:
.. code-block:: python
:linenos:
config.add_route('home', '{foo}/{bar}/*traverse')
-A ``*traverse`` token at the end of the pattern in a route's
-configuration implies a "remainder" *capture* value. When it is used,
-it will match the remainder of the path segments of the URL. This
-remainder becomes the path used to perform traversal.
+A ``*traverse`` token at the end of the pattern in a route's configuration
+implies a "remainder" *capture* value. When it is used, it will match the
+remainder of the path segments of the URL. This remainder becomes the path
+used to perform traversal.
.. note::
- The ``*remainder`` route pattern syntax is explained in more
- detail within :ref:`route_pattern_syntax`.
+ The ``*remainder`` route pattern syntax is explained in more detail within
+ :ref:`route_pattern_syntax`.
A hybrid mode application relies more heavily on :term:`traversal` to do
:term:`resource location` and :term:`view lookup` than most examples indicate
within :ref:`urldispatch_chapter`.
-Because the pattern of the above route ends with ``*traverse``, when this
-route configuration is matched during a request, :app:`Pyramid` will attempt
-to use :term:`traversal` against the :term:`root` object implied by the
-:term:`root factory` that is implied by the route's configuration. Since no
+Because the pattern of the above route ends with ``*traverse``, when this route
+configuration is matched during a request, :app:`Pyramid` will attempt to use
+:term:`traversal` against the :term:`root` object implied by the :term:`root
+factory` that is implied by the route's configuration. Since no
``root_factory`` argument is explicitly specified for this route, this will
-either be the *global* root factory for the application, or the *default*
-root factory. Once :term:`traversal` has found a :term:`context` resource,
+either be the *global* root factory for the application, or the *default* root
+factory. Once :term:`traversal` has found a :term:`context` resource,
:term:`view lookup` will be invoked in almost exactly the same way it would
have been invoked in a "pure" traversal-based application.
-Let's assume there is no *global* :term:`root factory` configured in
-this application. The *default* :term:`root factory` cannot be traversed:
-it has no useful ``__getitem__`` method. So we'll need to associate
-this route configuration with a custom root factory in order to
-create a useful hybrid application. To that end, let's imagine that
-we've created a root factory that looks like so in a module named
-``routes.py``:
+Let's assume there is no *global* :term:`root factory` configured in this
+application. The *default* :term:`root factory` cannot be traversed; it has no
+useful ``__getitem__`` method. So we'll need to associate this route
+configuration with a custom root factory in order to create a useful hybrid
+application. To that end, let's imagine that we've created a root factory that
+looks like so in a module named ``routes.py``:
.. code-block:: python
:linenos:
@@ -246,7 +233,7 @@ we've created a root factory that looks like so in a module named
def root_factory(request):
return root
-Above, we've defined a (bogus) resource tree that can be traversed, and a
+Above we've defined a (bogus) resource tree that can be traversed, and a
``root_factory`` function that can be used as part of a particular route
configuration statement:
@@ -256,8 +243,8 @@ configuration statement:
config.add_route('home', '{foo}/{bar}/*traverse',
factory='mypackage.routes.root_factory')
-The ``factory`` above points at the function we've defined. It will return
-an instance of the ``Resource`` class as a root object whenever this route is
+The ``factory`` above points at the function we've defined. It will return an
+instance of the ``Resource`` class as a root object whenever this route is
matched. Instances of the ``Resource`` class can be used for tree traversal
because they have a ``__getitem__`` method that does something nominally
useful. Since traversal uses ``__getitem__`` to walk the resources of a
@@ -266,39 +253,37 @@ statement is a reasonable thing to do.
.. note::
- We could have also used our ``root_factory`` function as the
- ``root_factory`` argument of the
- :class:`~pyramid.config.Configurator` constructor, instead
- of associating it with a particular route inside the route's
- configuration. Every hybrid route configuration that is matched but
- which does *not* name a ``factory`` attribute will use the use
- global ``root_factory`` function to generate a root object.
+ We could have also used our ``root_factory`` function as the ``root_factory``
+ argument of the :class:`~pyramid.config.Configurator` constructor, instead of
+ associating it with a particular route inside the route's configuration.
+ Every hybrid route configuration that is matched, but which does *not* name a
+ ``factory`` attribute, will use the global ``root_factory`` function to
+ generate a root object.
-When the route configuration named ``home`` above is matched during a
-request, the matchdict generated will be based on its pattern:
+When the route configuration named ``home`` above is matched during a request,
+the matchdict generated will be based on its pattern:
``{foo}/{bar}/*traverse``. The "capture value" implied by the ``*traverse``
element in the pattern will be used to traverse the resource tree in order to
find a context resource, starting from the root object returned from the root
factory. In the above example, the :term:`root` object found will be the
instance named ``root`` in ``routes.py``.
-If the URL that matched a route with the pattern ``{foo}/{bar}/*traverse``,
-is ``http://example.com/one/two/a/b/c``, the traversal path used
-against the root object will be ``a/b/c``. As a result,
-:app:`Pyramid` will attempt to traverse through the edges ``'a'``,
-``'b'``, and ``'c'``, beginning at the root object.
+If the URL that matched a route with the pattern ``{foo}/{bar}/*traverse`` is
+``http://example.com/one/two/a/b/c``, the traversal path used against the root
+object will be ``a/b/c``. As a result, :app:`Pyramid` will attempt to traverse
+through the edges ``'a'``, ``'b'``, and ``'c'``, beginning at the root object.
-In our above example, this particular set of traversal steps will mean that
-the :term:`context` resource of the view would be the ``Resource`` object
-we've named ``'c'`` in our bogus resource tree and the :term:`view name`
-resulting from traversal will be the empty string; if you need a refresher
-about why this outcome is presumed, see :ref:`traversal_algorithm`.
+In our above example, this particular set of traversal steps will mean that the
+:term:`context` resource of the view would be the ``Resource`` object we've
+named ``'c'`` in our bogus resource tree, and the :term:`view name` resulting
+from traversal will be the empty string. If you need a refresher about why
+this outcome is presumed, see :ref:`traversal_algorithm`.
-At this point, a suitable view callable will be found and invoked
-using :term:`view lookup` as described in :ref:`view_configuration`,
-but with a caveat: in order for view lookup to work, we need to define
-a view configuration that will match when :term:`view lookup` is
-invoked after a route matches:
+At this point, a suitable view callable will be found and invoked using
+:term:`view lookup` as described in :ref:`view_configuration`, but with a
+caveat: in order for view lookup to work, we need to define a view
+configuration that will match when :term:`view lookup` is invoked after a route
+matches:
.. code-block:: python
:linenos:
@@ -307,28 +292,28 @@ invoked after a route matches:
factory='mypackage.routes.root_factory')
config.add_view('mypackage.views.myview', route_name='home')
-Note that the above call to
-:meth:`~pyramid.config.Configurator.add_view` includes a ``route_name``
-argument. View configurations that include a ``route_name`` argument are
-meant to associate a particular view declaration with a route, using the
-route's name, in order to indicate that the view should *only be invoked when
-the route matches*.
+Note that the above call to :meth:`~pyramid.config.Configurator.add_view`
+includes a ``route_name`` argument. View configurations that include a
+``route_name`` argument are meant to associate a particular view declaration
+with a route, using the route's name, in order to indicate that the view should
+*only be invoked when the route matches*.
Calls to :meth:`~pyramid.config.Configurator.add_view` may pass a
``route_name`` attribute, which refers to the value of an existing route's
-``name`` argument. In the above example, the route name is ``home``,
-referring to the name of the route defined above it.
+``name`` argument. In the above example, the route name is ``home``, referring
+to the name of the route defined above it.
-The above ``mypackage.views.myview`` view callable will be invoked when:
+The above ``mypackage.views.myview`` view callable will be invoked when the
+following conditions are met:
-- the route named "home" is matched
+- The route named "home" is matched.
-- the :term:`view name` resulting from traversal is the empty string.
+- The :term:`view name` resulting from traversal is the empty string.
-- the :term:`context` resource is any object.
+- The :term:`context` resource is any object.
-It is also possible to declare alternate views that may be invoked
-when a hybrid route is matched:
+It is also possible to declare alternative views that may be invoked when a
+hybrid route is matched:
.. code-block:: python
:linenos:
@@ -340,37 +325,37 @@ when a hybrid route is matched:
name='another')
The ``add_view`` call for ``mypackage.views.another_view`` above names a
-different view and, more importantly, a different :term:`view name`. The
-above ``mypackage.views.another_view`` view will be invoked when:
+different view and, more importantly, a different :term:`view name`. The above
+``mypackage.views.another_view`` view will be invoked when the following
+conditions are met:
-- the route named "home" is matched
+- The route named "home" is matched.
-- the :term:`view name` resulting from traversal is ``another``.
+- The :term:`view name` resulting from traversal is ``another``.
-- the :term:`context` resource is any object.
+- The :term:`context` resource is any object.
For instance, if the URL ``http://example.com/one/two/a/another`` is provided
to an application that uses the previously mentioned resource tree, the
-``mypackage.views.another`` view callable will be called instead of the
-``mypackage.views.myview`` view callable because the :term:`view name` will
-be ``another`` instead of the empty string.
+``mypackage.views.another_view`` view callable will be called instead of the
+``mypackage.views.myview`` view callable because the :term:`view name` will be
+``another`` instead of the empty string.
More complicated matching can be composed. All arguments to *route*
-configuration statements and *view* configuration statements are
-supported in hybrid applications (such as :term:`predicate`
-arguments).
+configuration statements and *view* configuration statements are supported in
+hybrid applications (such as :term:`predicate` arguments).
-Using the ``traverse`` Argument In a Route Definition
+Using the ``traverse`` Argument in a Route Definition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Rather than using the ``*traverse`` remainder marker in a pattern, you
-can use the ``traverse`` argument to the
-:meth:`~pyramid.config.Configurator.add_route` method.
+Rather than using the ``*traverse`` remainder marker in a pattern, you can use
+the ``traverse`` argument to the :meth:`~pyramid.config.Configurator.add_route`
+method.
-When you use the ``*traverse`` remainder marker, the traversal path is
-limited to being the remainder segments of a request URL when a route
-matches. However, when you use the ``traverse`` argument or
-attribute, you have more control over how to compose a traversal path.
+When you use the ``*traverse`` remainder marker, the traversal path is limited
+to being the remainder segments of a request URL when a route matches.
+However, when you use the ``traverse`` argument or attribute, you have more
+control over how to compose a traversal path.
Here's a use of the ``traverse`` pattern in a call to
:meth:`~pyramid.config.Configurator.add_route`:
@@ -381,30 +366,27 @@ Here's a use of the ``traverse`` pattern in a call to
config.add_route('abc', '/articles/{article}/edit',
traverse='/{article}')
-The syntax of the ``traverse`` argument is the same as it is for
-``pattern``.
+The syntax of the ``traverse`` argument is the same as it is for ``pattern``.
-If, as above, the ``pattern`` provided is ``/articles/{article}/edit``,
-and the ``traverse`` argument provided is ``/{article}``, when a
-request comes in that causes the route to match in such a way that the
-``article`` match value is ``1`` (when the request URI is
-``/articles/1/edit``), the traversal path will be generated as ``/1``.
-This means that the root object's ``__getitem__`` will be called with
-the name ``1`` during the traversal phase. If the ``1`` object
-exists, it will become the :term:`context` of the request.
-The :ref:`traversal_chapter` chapter has more information about traversal.
+If, as above, the ``pattern`` provided is ``/articles/{article}/edit``, and the
+``traverse`` argument provided is ``/{article}``, when a request comes in that
+causes the route to match in such a way that the ``article`` match value is
+``1`` (when the request URI is ``/articles/1/edit``), the traversal path will
+be generated as ``/1``. This means that the root object's ``__getitem__`` will
+be called with the name ``1`` during the traversal phase. If the ``1`` object
+exists, it will become the :term:`context` of the request. The
+:ref:`traversal_chapter` chapter has more information about traversal.
-If the traversal path contains segment marker names which are not
-present in the pattern argument, a runtime error will occur. The
-``traverse`` pattern should not contain segment markers that do not
-exist in the ``path``.
+If the traversal path contains segment marker names which are not present in
+the pattern argument, a runtime error will occur. The ``traverse`` pattern
+should not contain segment markers that do not exist in the ``path``.
-Note that the ``traverse`` argument is ignored when attached to a
-route that has a ``*traverse`` remainder marker in its pattern.
+Note that the ``traverse`` argument is ignored when attached to a route that
+has a ``*traverse`` remainder marker in its pattern.
-Traversal will begin at the root object implied by this route (either
-the global root, or the object returned by the ``factory`` associated
-with this route).
+Traversal will begin at the root object implied by this route (either the
+global root, or the object returned by the ``factory`` associated with this
+route).
.. index::
pair: hybrid applications; global views
@@ -412,14 +394,13 @@ with this route).
Making Global Views Match
+++++++++++++++++++++++++
-By default, only view configurations that mention a ``route_name``
-will be found during view lookup when a route that has a ``*traverse``
-in its pattern matches. You can allow views without a ``route_name``
-attribute to match a route by adding the ``use_global_views`` flag to
-the route definition. For example, the ``myproject.views.bazbuz``
-view below will be found if the route named ``abc`` below is matched
-and the ``PATH_INFO`` is ``/abc/bazbuz``, even though the view
-configuration statement does not have the ``route_name="abc"``
+By default, only view configurations that mention a ``route_name`` will be
+found during view lookup when a route that has a ``*traverse`` in its pattern
+matches. You can allow views without a ``route_name`` attribute to match a
+route by adding the ``use_global_views`` flag to the route definition. For
+example, the ``myproject.views.bazbuz`` view below will be found if the route
+named ``abc`` below is matched and the ``PATH_INFO`` is ``/abc/bazbuz``, even
+though the view configuration statement does not have the ``route_name="abc"``
attribute.
.. code-block:: python
@@ -445,113 +426,28 @@ traversal. For instance, the :func:`pyramid.wsgi.wsgiapp2` decorator and the
from the request's subpath when its ``use_subpath`` argument is ``True``, so
it's useful to be able to influence this value.
-When ``*subpath`` exists in a pattern, no path is actually traversed,
-but the traversal algorithm will return a :term:`subpath` list implied
-by the capture value of ``*subpath``. You'll see this pattern most
-commonly in route declarations that look like this:
+When ``*subpath`` exists in a pattern, no path is actually traversed, but the
+traversal algorithm will return a :term:`subpath` list implied by the capture
+value of ``*subpath``. You'll see this pattern most 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)
config.add_route('static', '/static/*subpath')
config.add_view(www, route_name='static')
-``mypackage.views.www`` is an instance of
-:class:`pyramid.static.static_view`. This effectively tells the static
-helper to traverse everything in the subpath as a filename.
-
-.. index::
- pair: hybrid applications; corner cases
-
-Corner Cases
-------------
-
-A number of corner case "gotchas" exist when using a hybrid
-application. We'll detail them here.
-
-Registering a Default View for a Route That Has a ``view`` Attribute
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. warning:: As of :app:`Pyramid` 1.1 this section is slated to be removed in
- a later documentation release because the ability to add views
- directly to the :term:`route configuration` by passing a ``view`` argument
- to ``add_route`` has been deprecated.
-
-It is an error to provide *both* a ``view`` argument to a :term:`route
-configuration` *and* a :term:`view configuration` which names a
-``route_name`` that has no ``name`` value or the empty ``name`` value. For
-example, this pair of declarations will generate a conflict error at startup
-time.
-
-.. code-block:: python
- :linenos:
-
- config.add_route('home', '{foo}/{bar}/*traverse',
- view='myproject.views.home')
- config.add_view('myproject.views.another', route_name='home')
-
-This is because the ``view`` argument to the
-:meth:`~pyramid.config.Configurator.add_route` above is an *implicit*
-default view when that route matches. ``add_route`` calls don't *need* to
-supply a view attribute. For example, this ``add_route`` call:
-
-.. code-block:: python
- :linenos:
-
- config.add_route('home', '{foo}/{bar}/*traverse',
- view='myproject.views.home')
+``mypackage.views.www`` is an instance of :class:`pyramid.static.static_view`.
+This effectively tells the static helper to traverse everything in the subpath
+as a filename.
-Can also be spelled like so:
-
-.. code-block:: python
- :linenos:
-
- config.add_route('home', '{foo}/{bar}/*traverse')
- config.add_view('myproject.views.home', route_name='home')
-
-The two spellings are logically equivalent. In fact, the former is just a
-syntactical shortcut for the latter.
-
-Binding Extra Views Against a Route Configuration that Doesn't Have a ``*traverse`` Element In Its Pattern
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Here's another corner case that just makes no sense:
-
-.. code-block:: python
- :linenos:
-
- config.add_route('abc', '/abc', view='myproject.views.abc')
- config.add_view('myproject.views.bazbuz', name='bazbuz',
- route_name='abc')
-
-The above view declaration is useless, because it will never be matched when
-the route it references has matched. Only the view associated with the route
-itself (``myproject.views.abc``) will ever be invoked when the route matches,
-because the default view is always invoked when a route matches and when no
-post-match traversal is performed.
-
-To make the above view declaration useful, the special ``*traverse``
-token must end the route's pattern. For example:
-
-.. code-block:: python
- :linenos:
-
- config.add_route('abc', '/abc/*traverse', view='myproject.views.abc')
- config.add_view('myproject.views.bazbuz', name='bazbuz',
- route_name='abc')
-
-With the above configuration, the ``myproject.views.bazbuz`` view will
-be invoked when the request URI is ``/abc/bazbuz``, assuming there is
-no object contained by the root object with the key ``bazbuz``. A
-different request URI, such as ``/abc/foo/bar``, would invoke the
-default ``myproject.views.abc`` view.
.. index::
- pair: hybrid urls; generating
+ pair: hybrid URLs; generating
.. _generating_hybrid_urls:
@@ -560,16 +456,16 @@ Generating Hybrid URLs
.. versionadded:: 1.5
-The :meth:`pyramid.request.Request.resource_url` method and the
-:meth:`pyramid.request.Request.resource_path` method both accept optional
+The :meth:`pyramid.request.Request.resource_url` method and the
+:meth:`pyramid.request.Request.resource_path` method both accept optional
keyword arguments that make it easier to generate route-prefixed URLs that
-contain paths to traversal resources:``route_name``, ``route_kw``, and
+contain paths to traversal resources: ``route_name``, ``route_kw``, and
``route_remainder_name``.
Any route that has a pattern that contains a ``*remainder`` pattern (any
-stararg remainder pattern, such as ``*traverse`` or ``*subpath`` or ``*fred``)
-can be used as the target name for ``request.resource_url(..., route_name=)``
-and ``request.resource_path(..., route_name=)``.
+stararg remainder pattern, such as ``*traverse``, ``*subpath``, or ``*fred``)
+can be used as the target name for ``request.resource_url(..., route_name=)``
+and ``request.resource_path(..., route_name=)``.
For example, let's imagine you have a route defined in your Pyramid application
like so:
@@ -578,7 +474,7 @@ like so:
config.add_route('mysection', '/mysection*traverse')
-If you'd like to generate the URL ``http://example.com/mysection/a/``, you can
+If you'd like to generate the URL ``http://example.com/mysection/a/``, you can
use the following incantation, assuming that the variable ``a`` below points to
a resource that is a child of the root with a ``__name__`` of ``a``:
@@ -592,14 +488,14 @@ You can generate only the path portion ``/mysection/a/`` assuming the same:
request.resource_path(a, route_name='mysection')
-The path is virtual host aware, so if the ``X-Vhm-Root`` environ variable is
-present in the request, and it's set to ``/a``, the above call to
-``request.resource_url`` would generate ``http://example.com/mysection/``
-and the above call to ``request.resource_path`` would generate ``/mysection/``.
-See :ref:`virtual_root_support` for more information.
+The path is virtual host aware, so if the ``X-Vhm-Root`` environment variable
+is present in the request, and it's set to ``/a``, the above call to
+``request.resource_url`` would generate ``http://example.com/mysection/``, and
+the above call to ``request.resource_path`` would generate ``/mysection/``. See
+:ref:`virtual_root_support` for more information.
If the route you're trying to use needs simple dynamic part values to be filled
-in to succesfully generate the URL, you can pass these as the ``route_kw``
+in to succesfully generate the URL, you can pass these as the ``route_kw``
argument to ``resource_url`` and ``resource_path``. For example, assuming that
the route definition is like so:
@@ -613,15 +509,15 @@ You can pass ``route_kw`` in to fill in ``{id}`` above:
request.resource_url(a, route_name='mysection', route_kw={'id':'1'})
-If you pass ``route_kw`` but do not pass ``route_name``, ``route_kw`` will
-be ignored.
+If you pass ``route_kw`` but do not pass ``route_name``, ``route_kw`` will be
+ignored.
-By default this feature works by calling ``route_url`` under the hood,
-and passing the value of the resource path to that function as ``traverse``.
-If your route has a different ``*stararg`` remainder name (such as
-``*subpath``), you can tell ``resource_url`` or ``resource_path`` to use that
-instead of ``traverse`` by passing ``route_remainder_name``. For example,
-if you have the following route:
+By default this feature works by calling ``route_url`` under the hood, and
+passing the value of the resource path to that function as ``traverse``. If
+your route has a different ``*stararg`` remainder name (such as ``*subpath``),
+you can tell ``resource_url`` or ``resource_path`` to use that instead of
+``traverse`` by passing ``route_remainder_name``. For example, if you have the
+following route:
.. code-block:: python
@@ -631,10 +527,10 @@ You can fill in the ``*subpath`` value using ``resource_url`` by doing:
.. code-block:: python
- request.resource_path(a, route_name='mysection',
+ request.resource_path(a, route_name='mysection',
route_remainder_name='subpath')
-If you pass ``route_remainder_name`` but do not pass ``route_name``,
+If you pass ``route_remainder_name`` but do not pass ``route_name``,
``route_remainder_name`` will be ignored.
If you try to use ``resource_path`` or ``resource_url`` when the ``route_name``
@@ -642,12 +538,11 @@ argument points at a route that does not have a remainder stararg, an error
will not be raised, but the generated URL will not contain any remainder
information either.
-All other values that are normally passable to ``resource_path`` and
-``resource_url`` (such as ``query``, ``anchor``, ``host``, ``port``, and
+All other values that are normally passable to ``resource_path`` and
+``resource_url`` (such as ``query``, ``anchor``, ``host``, ``port``, and
positional elements) work as you might expect in this configuration.
Note that this feature is incompatible with the ``__resource_url__`` feature
(see :ref:`overriding_resource_url_generation`) implemented on resource
objects. Any ``__resource_url__`` supplied by your resource will be ignored
when you pass ``route_name``.
-
diff --git a/docs/narr/i18n.rst b/docs/narr/i18n.rst
index 1de2c8941..839a48df4 100644
--- a/docs/narr/i18n.rst
+++ b/docs/narr/i18n.rst
@@ -9,16 +9,16 @@
Internationalization and Localization
=====================================
-:term:`Internationalization` (i18n) is the act of creating software
-with a user interface that can potentially be displayed in more than
-one language or cultural context. :term:`Localization` (l10n) is the
-process of displaying the user interface of an internationalized
-application in a *particular* language or cultural context.
+:term:`Internationalization` (i18n) is the act of creating software with a user
+interface that can potentially be displayed in more than one language or
+cultural context. :term:`Localization` (l10n) is the process of displaying the
+user interface of an internationalized application in a *particular* language
+or cultural context.
-:app:`Pyramid` offers internationalization and localization
-subsystems that can be used to translate the text of buttons, error
-messages and other software- and template-defined values into the
-native language of a user of your application.
+:app:`Pyramid` offers internationalization and localization subsystems that can
+be used to translate the text of buttons, error messages, and other software-
+and template-defined values into the native language of a user of your
+application.
.. index::
single: translation string
@@ -29,15 +29,15 @@ native language of a user of your application.
Creating a Translation String
-----------------------------
-While you write your software, you can insert specialized markup into
-your Python code that makes it possible for the system to translate
-text values into the languages used by your application's users. This
-markup creates a :term:`translation string`. A translation string is
-an object that behaves mostly like a normal Unicode object, except that
-it also carries around extra information related to its job as part of
-the :app:`Pyramid` translation machinery.
+While you write your software, you can insert specialized markup into your
+Python code that makes it possible for the system to translate text values into
+the languages used by your application's users. This markup creates a
+:term:`translation string`. A translation string is an object that behaves
+mostly like a normal Unicode object, except that it also carries around extra
+information related to its job as part of the :app:`Pyramid` translation
+machinery.
-Using The ``TranslationString`` Class
+Using the ``TranslationString`` Class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The most primitive way to create a translation string is to use the
@@ -53,17 +53,17 @@ This creates a Unicode-like object that is a TranslationString.
.. note::
- For people more familiar with :term:`Zope` i18n, a TranslationString
- is a lot like a ``zope.i18nmessageid.Message`` object. It is not a
- subclass, however. For people more familiar with :term:`Pylons` or
- :term:`Django` i18n, using a TranslationString is a lot like using
- "lazy" versions of related gettext APIs.
+ For people more familiar with :term:`Zope` i18n, a TranslationString is a
+ lot like a ``zope.i18nmessageid.Message`` object. It is not a subclass,
+ however. For people more familiar with :term:`Pylons` or :term:`Django`
+ i18n, using a TranslationString is a lot like using "lazy" versions of
+ related gettext APIs.
-The first argument to :class:`~pyramid.i18n.TranslationString` is
-the ``msgid``; it is required. It represents the key into the
-translation mappings provided by a particular localization. The
-``msgid`` argument must be a Unicode object or an ASCII string. The
-msgid may optionally contain *replacement markers*. For instance:
+The first argument to :class:`~pyramid.i18n.TranslationString` is the
+``msgid``; it is required. It represents the key into the translation mappings
+provided by a particular localization. The ``msgid`` argument must be a Unicode
+object or an ASCII string. The msgid may optionally contain *replacement
+markers*. For instance:
.. code-block:: python
:linenos:
@@ -71,10 +71,9 @@ msgid may optionally contain *replacement markers*. For instance:
from pyramid.i18n import TranslationString
ts = TranslationString('Add ${number}')
-Within the string above, ``${number}`` is a replacement marker. It
-will be replaced by whatever is in the *mapping* for a translation
-string. The mapping may be supplied at the same time as the
-replacement marker itself:
+Within the string above, ``${number}`` is a replacement marker. It will be
+replaced by whatever is in the *mapping* for a translation string. The mapping
+may be supplied at the same time as the replacement marker itself:
.. code-block:: python
:linenos:
@@ -82,14 +81,14 @@ replacement marker itself:
from pyramid.i18n import TranslationString
ts = TranslationString('Add ${number}', mapping={'number':1})
-Any number of replacement markers can be present in the msgid value,
-any number of times. Only markers which can be replaced by the values
-in the *mapping* will be replaced at translation time. The others
-will not be interpolated and will be output literally.
+Any number of replacement markers can be present in the msgid value, any number
+of times. Only markers which can be replaced by the values in the *mapping*
+will be replaced at translation time. The others will not be interpolated and
+will be output literally.
A translation string should also usually carry a *domain*. The domain
-represents a translation category to disambiguate it from other
-translations of the same msgid, in case they conflict.
+represents a translation category to disambiguate it from other translations of
+the same msgid, in case they conflict.
.. code-block:: python
:linenos:
@@ -98,13 +97,12 @@ translations of the same msgid, in case they conflict.
ts = TranslationString('Add ${number}', mapping={'number':1},
domain='form')
-The above translation string named a domain of ``form``. A
-:term:`translator` function will often use the domain to locate the
-right translator file on the filesystem which contains translations
-for a given domain. In this case, if it were trying to translate
-our msgid to German, it might try to find a translation from a
-:term:`gettext` file within a :term:`translation directory` like this
-one:
+The above translation string named a domain of ``form``. A :term:`translator`
+function will often use the domain to locate the right translator file on the
+filesystem which contains translations for a given domain. In this case, if it
+were trying to translate our msgid to German, it might try to find a
+translation from a :term:`gettext` file within a :term:`translation directory`
+like this one:
.. code-block:: text
@@ -113,14 +111,13 @@ one:
In other words, it would want to take translations from the ``form.mo``
translation file in the German language.
-Finally, the TranslationString constructor accepts a ``default``
-argument. If a ``default`` argument is supplied, it replaces usages
-of the ``msgid`` as the *default value* for the translation string.
-When ``default`` is ``None``, the ``msgid`` value passed to a
-TranslationString is used as an implicit message identifier. Message
-identifiers are matched with translations in translation files, so it
-is often useful to create translation strings with "opaque" message
-identifiers unrelated to their default text:
+Finally, the TranslationString constructor accepts a ``default`` argument. If
+a ``default`` argument is supplied, it replaces usages of the ``msgid`` as the
+*default value* for the translation string. When ``default`` is ``None``, the
+``msgid`` value passed to a TranslationString is used as an implicit message
+identifier. Message identifiers are matched with translations in translation
+files, so it is often useful to create translation strings with "opaque"
+message identifiers unrelated to their default text:
.. code-block:: python
:linenos:
@@ -129,8 +126,7 @@ identifiers unrelated to their default text:
ts = TranslationString('add-number', default='Add ${number}',
domain='form', mapping={'number':1})
-When default text is used, Default text objects may contain
-replacement values.
+When default text is used, Default text objects may contain replacement values.
.. index::
single: translation string factory
@@ -139,10 +135,10 @@ Using the ``TranslationStringFactory`` Class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Another way to generate a translation string is to use the
-:attr:`~pyramid.i18n.TranslationStringFactory` object. This object
-is a *translation string factory*. Basically a translation string
-factory presets the ``domain`` value of any :term:`translation string`
-generated by using it. For example:
+:attr:`~pyramid.i18n.TranslationStringFactory` object. This object is a
+*translation string factory*. Basically a translation string factory presets
+the ``domain`` value of any :term:`translation string` generated by using it.
+For example:
.. code-block:: python
:linenos:
@@ -151,20 +147,18 @@ generated by using it. For example:
_ = TranslationStringFactory('pyramid')
ts = _('add-number', default='Add ${number}', mapping={'number':1})
-.. note:: We assigned the translation string factory to the name
- ``_``. This is a convention which will be supported by translation
- file generation tools.
+.. note:: We assigned the translation string factory to the name ``_``. This
+ is a convention which will be supported by translation file generation
+ tools.
After assigning ``_`` to the result of a
-:func:`~pyramid.i18n.TranslationStringFactory`, the subsequent result
-of calling ``_`` will be a :class:`~pyramid.i18n.TranslationString`
-instance. Even though a ``domain`` value was not passed to ``_`` (as
-would have been necessary if the
-:class:`~pyramid.i18n.TranslationString` constructor were used instead
-of a translation string factory), the ``domain`` attribute of the
-resulting translation string will be ``pyramid``. As a result, the
-previous code example is completely equivalent (except for spelling)
-to:
+:func:`~pyramid.i18n.TranslationStringFactory`, the subsequent result of
+calling ``_`` will be a :class:`~pyramid.i18n.TranslationString` instance.
+Even though a ``domain`` value was not passed to ``_`` (as would have been
+necessary if the :class:`~pyramid.i18n.TranslationString` constructor were used
+instead of a translation string factory), the ``domain`` attribute of the
+resulting translation string will be ``pyramid``. As a result, the previous
+code example is completely equivalent (except for spelling) to:
.. code-block:: python
:linenos:
@@ -173,12 +167,11 @@ to:
ts = _('add-number', default='Add ${number}', mapping={'number':1},
domain='pyramid')
-You can set up your own translation string factory much like the one
-provided above by using the
-:class:`~pyramid.i18n.TranslationStringFactory` class. For example,
-if you'd like to create a translation string factory which presets the
-``domain`` value of generated translation strings to ``form``, you'd
-do something like this:
+You can set up your own translation string factory much like the one provided
+above by using the :class:`~pyramid.i18n.TranslationStringFactory` class. For
+example, if you'd like to create a translation string factory which presets the
+``domain`` value of generated translation strings to ``form``, you'd do
+something like this:
.. code-block:: python
:linenos:
@@ -187,72 +180,68 @@ do something like this:
_ = TranslationStringFactory('form')
ts = _('add-number', default='Add ${number}', mapping={'number':1})
-Creating a unique domain for your application via a translation string
-factory is best practice. Using your own unique translation domain
-allows another person to reuse your application without needing to
-merge your translation files with his own. Instead, he can just
-include your package's :term:`translation directory` via the
-:meth:`pyramid.config.Configurator.add_translation_dirs`
-method.
+Creating a unique domain for your application via a translation string factory
+is best practice. Using your own unique translation domain allows another
+person to reuse your application without needing to merge your translation
+files with their own. Instead they can just include your package's
+:term:`translation directory` via the
+:meth:`pyramid.config.Configurator.add_translation_dirs` method.
.. note::
For people familiar with Zope internationalization, a
TranslationStringFactory is a lot like a
- ``zope.i18nmessageid.MessageFactory`` object. It is not a
- subclass, however.
+ ``zope.i18nmessageid.MessageFactory`` object. It is not a subclass,
+ however.
.. index::
single: gettext
single: translation directories
-Working With ``gettext`` Translation Files
+Working with ``gettext`` Translation Files
------------------------------------------
-The basis of :app:`Pyramid` translation services is
-GNU :term:`gettext`. Once your application source code files and templates
-are marked up with translation markers, you can work on translations
-by creating various kinds of gettext files.
+The basis of :app:`Pyramid` translation services is GNU :term:`gettext`. Once
+your application source code files and templates are marked up with translation
+markers, you can work on translations by creating various kinds of gettext
+files.
.. note::
- The steps a developer must take to work with :term:`gettext`
- :term:`message catalog` files within a :app:`Pyramid`
- application are very similar to the steps a :term:`Pylons`
- developer must take to do the same. See the `Pylons
- internationalization documentation
- <http://wiki.pylonshq.com/display/pylonsdocs/Internationalization+and+Localization>`_
- for more information.
+ The steps a developer must take to work with :term:`gettext` :term:`message
+ catalog` files within a :app:`Pyramid` application are very similar to the
+ steps a :term:`Pylons` developer must take to do the same. See the
+ :ref:`Pylons Internationalization and Localization documentation
+ <pylonswebframework:i18n>` for more information.
-GNU gettext uses three types of files in the translation framework,
-``.pot`` files, ``.po`` files and ``.mo`` files.
+GNU gettext uses three types of files in the translation framework, ``.pot``
+files, ``.po`` files, and ``.mo`` files.
``.pot`` (Portable Object Template) files
- A ``.pot`` file is created by a program which searches through your
- project's source code and which picks out every :term:`message
- identifier` passed to one of the ``_()`` functions
- (eg. :term:`translation string` constructions). The list of all
- message identifiers is placed into a ``.pot`` file, which serves as
- a template for creating ``.po`` files.
+ A ``.pot`` file is created by a program which searches through your project's
+ source code and which picks out every :term:`message identifier` passed to
+ one of the ``_()`` functions (e.g., :term:`translation string`
+ constructions). The list of all message identifiers is placed into a ``.pot``
+ file, which serves as a template for creating ``.po`` files.
``.po`` (Portable Object) files
- The list of messages in a ``.pot`` file are translated by a human to
- a particular language; the result is saved as a ``.po`` file.
+ The list of messages in a ``.pot`` file are translated by a human to a
+ particular language; the result is saved as a ``.po`` file.
``.mo`` (Machine Object) files
- A ``.po`` file is turned into a machine-readable binary file, which
- is the ``.mo`` file. Compiling the translations to machine code
- makes the localized program start faster.
+ A ``.po`` file is turned into a machine-readable binary file, which is the
+ ``.mo`` file. Compiling the translations to machine code makes the
+ localized program start faster.
The tools for working with :term:`gettext` translation files related to a
-:app:`Pyramid` application are :term:`Lingua` and :term:`Gettext`. Lingua
-can scrape i18n references out of Python and Chameleon files and create
-the ``.pot`` file. Gettext includes ``msgmerge`` tool to update a ``.po`` file
-from an updated ``.pot`` file and ``msgfmt`` to compile ``.po`` files to
-``.mo`` files.
+:app:`Pyramid` application are :term:`Lingua` and :term:`Gettext`. Lingua can
+scrape i18n references out of Python and Chameleon files and create the
+``.pot`` file. Gettext includes ``msgmerge`` tool to update a ``.po`` file from
+an updated ``.pot`` file and ``msgfmt`` to compile ``.po`` files to ``.mo``
+files.
.. index::
single: Gettext
@@ -263,19 +252,18 @@ from an updated ``.pot`` file and ``msgfmt`` to compile ``.po`` files to
Installing Lingua and Gettext
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-In order for the commands related to working with ``gettext`` translation
-files to work properly, you will need to have :term:`Lingua` and
-:term:`Gettext` installed into the same environment in which :app:`Pyramid` is
-installed.
+In order for the commands related to working with ``gettext`` translation files
+to work properly, you will need to have :term:`Lingua` and :term:`Gettext`
+installed into the same environment in which :app:`Pyramid` is installed.
Installation on UNIX
++++++++++++++++++++
Gettext is often already installed on UNIX systems. You can check if it is
installed by testing if the ``msgfmt`` command is available. If it is not
-available you can install it through the packaging system from your OS;
-the package name is almost always ``gettext``. For example on a Debian or
-Ubuntu system run this command:
+available you can install it through the packaging system from your OS; the
+package name is almost always ``gettext``. For example on a Debian or Ubuntu
+system run this command:
.. code-block:: text
@@ -283,8 +271,7 @@ Ubuntu system run this command:
Installing Lingua is done with the Python packaging tools. If the
:term:`virtualenv` into which you've installed your :app:`Pyramid` application
-lives in ``/my/virtualenv``, you can install Lingua
-like so:
+lives in ``/my/virtualenv``, you can install Lingua like so:
.. code-block:: text
@@ -296,11 +283,10 @@ Installation on Windows
There are several ways to install Gettext on Windows: it is included in the
`Cygwin <http://www.cygwin.com/>`_ collection, or you can use the `installer
-from the GnuWin32 <http://gnuwin32.sourceforge.net/packages/gettext.htm>`_
-or compile it yourself. Make sure the installation path is added to your
+from the GnuWin32 <http://gnuwin32.sourceforge.net/packages/gettext.htm>`_, or
+compile it yourself. Make sure the installation path is added to your
``$PATH``.
-
Installing Lingua is done with the Python packaging tools. If the
:term:`virtualenv` into which you've installed your :app:`Pyramid` application
lives in ``C:\my\virtualenv``, you can install Lingua like so:
@@ -318,7 +304,7 @@ lives in ``C:\my\virtualenv``, you can install Lingua like so:
Extracting Messages from Code and Templates
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Once Lingua is installed you may extract a message catalog template from the
+Once Lingua is installed, you may extract a message catalog template from the
code and :term:`Chameleon` templates which reside in your :app:`Pyramid`
application. You run a ``pot-create`` command to extract the messages:
@@ -326,10 +312,9 @@ application. You run a ``pot-create`` command to extract the messages:
$ cd /place/where/myapplication/setup.py/lives
$ mkdir -p myapplication/locale
- $ $VENV/bin/pot-create src > myapplication/locale/myapplication.pot
-
-The message catalog ``.pot`` template will end up in:
+ $ $VENV/bin/pot-create -o myapplication/locale/myapplication.pot src
+The message catalog ``.pot`` template will end up in
``myapplication/locale/myapplication.pot``.
@@ -340,32 +325,28 @@ Initializing a Message Catalog File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Once you've extracted messages into a ``.pot`` file (see
-:ref:`extracting_messages`), to begin localizing the messages present
-in the ``.pot`` file, you need to generate at least one ``.po`` file.
-A ``.po`` file represents translations of a particular set of messages
-to a particular locale. Initialize a ``.po`` file for a specific
-locale from a pre-generated ``.pot`` template by using the ``msginit``
-command from Gettext:
+:ref:`extracting_messages`), to begin localizing the messages present in the
+``.pot`` file, you need to generate at least one ``.po`` file. A ``.po`` file
+represents translations of a particular set of messages to a particular locale.
+Initialize a ``.po`` file for a specific locale from a pre-generated ``.pot``
+template by using the ``msginit`` command from Gettext:
.. code-block:: text
$ cd /place/where/myapplication/setup.py/lives
$ cd myapplication/locale
$ mkdir -p es/LC_MESSAGES
- $ msginit -l es es/LC_MESSAGES/myapplication.po
-
-This will create a new the message catalog ``.po`` file will in:
+ $ msginit -l es -o es/LC_MESSAGES/myapplication.po
+This will create a new message catalog ``.po`` file in
``myapplication/locale/es/LC_MESSAGES/myapplication.po``.
-Once the file is there, it can be worked on by a human translator.
-One tool which may help with this is `Poedit
-<http://www.poedit.net/>`_.
+Once the file is there, it can be worked on by a human translator. One tool
+which may help with this is `Poedit <http://www.poedit.net/>`_.
-Note that :app:`Pyramid` itself ignores the existence of all
-``.po`` files. For a running application to have translations
-available, a ``.mo`` file must exist. See
-:ref:`compiling_message_catalog`.
+Note that :app:`Pyramid` itself ignores the existence of all ``.po`` files.
+For a running application to have translations available, a ``.mo`` file must
+exist. See :ref:`compiling_message_catalog`.
.. index::
pair: updating; message catalog
@@ -373,13 +354,13 @@ available, a ``.mo`` file must exist. See
Updating a Catalog File
~~~~~~~~~~~~~~~~~~~~~~~
-If more translation strings are added to your application, or
-translation strings change, you will need to update existing ``.po``
-files based on changes to the ``.pot`` file, so that the new and
-changed messages can also be translated or re-translated.
+If more translation strings are added to your application, or translation
+strings change, you will need to update existing ``.po`` files based on changes
+to the ``.pot`` file, so that the new and changed messages can also be
+translated or re-translated.
-First, regenerate the ``.pot`` file as per :ref:`extracting_messages`.
-Then use the ``msgmerge`` command from Gettext.
+First, regenerate the ``.pot`` file as per :ref:`extracting_messages`. Then use
+the ``msgmerge`` command from Gettext.
.. code-block:: text
@@ -395,19 +376,21 @@ Then use the ``msgmerge`` command from Gettext.
Compiling a Message Catalog File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Finally, to prepare an application for performing actual runtime
-translations, compile ``.po`` files to ``.mo`` files use the ``msgfmt``
-command from Gettext:
+Finally, to prepare an application for performing actual runtime translations,
+compile ``.po`` files to ``.mo`` files using the ``msgfmt`` command from
+Gettext:
.. code-block:: text
$ cd /place/where/myapplication/setup.py/lives
- $ msgfmt myapplication/locale/*/LC_MESSAGES/*.po
+ $ msgfmt -o myapplication/locale/es/LC_MESSAGES/myapplication.mo \
+ myapplication/locale/es/LC_MESSAGES/myapplication.po
-This will create a ``.mo`` file for each ``.po`` file in your
-application. As long as the :term:`translation directory` in which
-the ``.mo`` file ends up in is configured into your application, these
-translations will be available to :app:`Pyramid`.
+This will create a ``.mo`` file for each ``.po`` file in your application. As
+long as the :term:`translation directory` in which the ``.mo`` file ends up in
+is configured into your application (see
+:ref:`adding_a_translation_directory`), these translations will be available to
+:app:`Pyramid`.
.. index::
single: localizer
@@ -418,10 +401,10 @@ Using a Localizer
-----------------
A :term:`localizer` is an object that allows you to perform translation or
-pluralization "by hand" in an application. You may use the
-:attr:`pyramid.request.Request.localizer` attribute to obtain a
-:term:`localizer`. The localizer object will be configured to produce
-translations implied by the active :term:`locale negotiator` or a default
+pluralization "by hand" in an application. You may use the
+:attr:`pyramid.request.Request.localizer` attribute to obtain a
+:term:`localizer`. The localizer object will be configured to produce
+translations implied by the active :term:`locale negotiator`, or a default
localizer object if no explicit locale negotiator is registered.
.. code-block:: python
@@ -432,7 +415,7 @@ localizer object if no explicit locale negotiator is registered.
.. note::
- If you need to create a localizer for a locale use the
+ If you need to create a localizer for a locale, use the
:func:`pyramid.i18n.make_localizer` function.
.. index::
@@ -444,9 +427,9 @@ Performing a Translation
~~~~~~~~~~~~~~~~~~~~~~~~
A :term:`localizer` has a ``translate`` method which accepts either a
-:term:`translation string` or a Unicode string and which returns a
-Unicode object representing the translation. So, generating a
-translation in a view component of an application might look like so:
+:term:`translation string` or a Unicode string and which returns a Unicode
+object representing the translation. Generating a translation in a view
+component of an application might look like so:
.. code-block:: python
:linenos:
@@ -469,9 +452,8 @@ locale of the localizer.
.. note::
- If you're using :term:`Chameleon` templates, you don't need
- to pre-translate translation strings this way. See
- :ref:`chameleon_translation_strings`.
+ If you're using :term:`Chameleon` templates, you don't need to pre-translate
+ translation strings this way. See :ref:`chameleon_translation_strings`.
.. index::
single: pluralizing (i18n)
@@ -481,8 +463,7 @@ locale of the localizer.
Performing a Pluralization
~~~~~~~~~~~~~~~~~~~~~~~~~~
-A :term:`localizer` has a ``pluralize`` method with the following
-signature:
+A :term:`localizer` has a ``pluralize`` method with the following signature:
.. code-block:: python
:linenos:
@@ -491,7 +472,7 @@ signature:
...
The simplest case is the ``singular`` and ``plural`` arguments being passed as
-unicode literals. This returns the appropriate literal according to the locale
+Unicode literals. This returns the appropriate literal according to the locale
pluralization rules for the number ``n``, and interpolates ``mapping``.
.. code-block:: python
@@ -502,15 +483,14 @@ pluralization rules for the number ``n``, and interpolates ``mapping``.
translated = localizer.pluralize('Item', 'Items', 1, 'mydomain')
# ... use translated ...
-However, for support of other languages, the ``singular`` argument should
-be a Unicode value representing a :term:`message identifier`. In this
-case the ``plural`` value is ignored.
-``domain`` should be a :term:`translation domain`, and
-``mapping`` should be a dictionary that is used for *replacement
-value* interpolation of the translated string.
+However, for support of other languages, the ``singular`` argument should be a
+Unicode value representing a :term:`message identifier`. In this case the
+``plural`` value is ignored. ``domain`` should be a :term:`translation domain`,
+and ``mapping`` should be a dictionary that is used for *replacement value*
+interpolation of the translated string.
The value of ``n`` will be used to find the appropriate plural form for the
-current language and ``pluralize`` will return a Unicode translation for the
+current language, and ``pluralize`` will return a Unicode translation for the
message id ``singular``. The message file must have defined ``singular`` as a
translation with plural forms.
@@ -561,18 +541,17 @@ You can obtain the locale name related to a request by using the
def aview(request):
locale_name = request.locale_name
-The locale name of a request is dynamically computed; it will be the locale
-name negotiated by the currently active :term:`locale negotiator` or
-the :term:`default locale name` if the locale negotiator returns ``None``.
-You can change the default locale name by changing the
-``pyramid.default_locale_name`` setting; see :ref:`default_locale_name_setting`.
+The locale name of a request is dynamically computed; it will be the locale
+name negotiated by the currently active :term:`locale negotiator`, or the
+:term:`default locale name` if the locale negotiator returns ``None``. You can
+change the default locale name by changing the ``pyramid.default_locale_name``
+setting. See :ref:`default_locale_name_setting`.
-Once :func:`~pyramid.request.Request.locale_name` is first run, the locale
-name is stored on the request object. Subsequent calls to
-:func:`~pyramid.request.Request.locale_name` will return the stored locale
-name without invoking the :term:`locale negotiator`. To avoid this
-caching, you can use the :func:`pyramid.i18n.negotiate_locale_name`
-function:
+Once :func:`~pyramid.request.Request.locale_name` is first run, the locale name
+is stored on the request object. Subsequent calls to
+:func:`~pyramid.request.Request.locale_name` will return the stored locale name
+without invoking the :term:`locale negotiator`. To avoid this caching, you can
+use the :func:`pyramid.i18n.negotiate_locale_name` function:
.. code-block:: python
:linenos:
@@ -592,8 +571,8 @@ You can also obtain the locale name related to a request using the
localizer = request.localizer
locale_name = localizer.locale_name
-Obtaining the locale name as an attribute of a localizer is equivalent
-to obtaining a locale name by asking for the
+Obtaining the locale name as an attribute of a localizer is equivalent to
+obtaining a locale name by asking for the
:func:`~pyramid.request.Request.locale_name` attribute.
.. index::
@@ -603,20 +582,18 @@ to obtaining a locale name by asking for the
Performing Date Formatting and Currency Formatting
--------------------------------------------------
-:app:`Pyramid` does not itself perform date and currency formatting
-for different locales. However, :term:`Babel` can help you do this
-via the :class:`babel.core.Locale` class. The `Babel documentation
-for this class
-<http://babel.edgewall.org/wiki/ApiDocs/babel.core#babel.core:Locale>`_
-provides minimal information about how to perform date and currency
-related locale operations. See :ref:`installing_babel` for
-information about how to install Babel.
-
-The :class:`babel.core.Locale` class requires a :term:`locale name` as
-an argument to its constructor. You can use :app:`Pyramid` APIs to
-obtain the locale name for a request to pass to the
-:class:`babel.core.Locale` constructor; see
-:ref:`obtaining_the_locale_name`. For example:
+:app:`Pyramid` does not itself perform date and currency formatting for
+different locales. However, :term:`Babel` can help you do this via the
+:class:`babel.core.Locale` class. The `Babel documentation for this class
+<http://babel.pocoo.org/en/latest/api/core.html#basic-interface>`_ provides
+minimal information about how to perform date and currency related locale
+operations. See :ref:`installing_babel` for information about how to install
+Babel.
+
+The :class:`babel.core.Locale` class requires a :term:`locale name` as an
+argument to its constructor. You can use :app:`Pyramid` APIs to obtain the
+locale name for a request to pass to the :class:`babel.core.Locale`
+constructor. See :ref:`obtaining_the_locale_name`. For example:
.. code-block:: python
:linenos:
@@ -635,15 +612,14 @@ obtain the locale name for a request to pass to the
Chameleon Template Support for Translation Strings
--------------------------------------------------
-When a :term:`translation string` is used as the subject of textual
-rendering by a :term:`Chameleon` template renderer, it will
-automatically be translated to the requesting user's language if a
-suitable translation exists. This is true of both the ZPT and text
-variants of the Chameleon template renderers.
+When a :term:`translation string` is used as the subject of textual rendering
+by a :term:`Chameleon` template renderer, it will automatically be translated
+to the requesting user's language if a suitable translation exists. This is
+true of both the ZPT and text variants of the Chameleon template renderers.
-For example, in a Chameleon ZPT template, the translation string
-represented by "some_translation_string" in each example below will go
-through translation before being rendered:
+For example, in a Chameleon ZPT template, the translation string represented by
+"some_translation_string" in each example below will go through translation
+before being rendered:
.. code-block:: xml
:linenos:
@@ -668,32 +644,31 @@ through translation before being rendered:
.. XXX the last example above appears to not yet work as of Chameleon
.. 1.2.3
-The features represented by attributes of the ``i18n`` namespace of
-Chameleon will also consult the :app:`Pyramid` translations.
-See http://chameleon.readthedocs.org/en/latest/reference.html#id50.
+The features represented by attributes of the ``i18n`` namespace of Chameleon
+will also consult the :app:`Pyramid` translations. See
+http://chameleon.readthedocs.org/en/latest/reference.html#id50.
.. note::
- Unlike when Chameleon is used outside of :app:`Pyramid`, when it
- is used *within* :app:`Pyramid`, it does not support use of the
- ``zope.i18n`` translation framework. Applications which use
- :app:`Pyramid` should use the features documented in this
- chapter rather than ``zope.i18n``.
+ Unlike when Chameleon is used outside of :app:`Pyramid`, when it is used
+ *within* :app:`Pyramid`, it does not support use of the ``zope.i18n``
+ translation framework. Applications which use :app:`Pyramid` should use the
+ features documented in this chapter rather than ``zope.i18n``.
-Third party :app:`Pyramid` template renderers might not provide
-this support out of the box and may need special code to do an
-equivalent. For those, you can always use the more manual translation
-facility described in :ref:`performing_a_translation`.
+Third party :app:`Pyramid` template renderers might not provide this support
+out of the box and may need special code to do an equivalent. For those, you
+can always use the more manual translation facility described in
+:ref:`performing_a_translation`.
.. index::
single: Mako i18n
-Mako Pyramid I18N Support
+Mako Pyramid i18n Support
-------------------------
-There exists a recipe within the :term:`Pyramid Cookbook` named "Mako
-Internationalization" which explains how to add idiomatic I18N support to
-:term:`Mako` templates.
+There exists a recipe within the :term:`Pyramid Community Cookbook` named
+:ref:`Mako Internationalization <cookbook:mako_i18n>` which explains how to add
+idiomatic i18n support to :term:`Mako` templates.
.. index::
single: localization deployment settings
@@ -705,10 +680,9 @@ Localization-Related Deployment Settings
----------------------------------------
A :app:`Pyramid` application will have a ``pyramid.default_locale_name``
-setting. This value represents the :term:`default locale name` used
-when the :term:`locale negotiator` returns ``None``. Pass it to the
-:mod:`~pyramid.config.Configurator` constructor at startup
-time:
+setting. This value represents the :term:`default locale name` used when the
+:term:`locale negotiator` returns ``None``. Pass it to the
+:mod:`~pyramid.config.Configurator` constructor at startup time:
.. code-block:: python
:linenos:
@@ -729,11 +703,11 @@ application's ``.ini`` file:
pyramid.debug_notfound = false
pyramid.default_locale_name = de
-If this value is not supplied via the Configurator constructor or via a
-config file, it will default to ``en``.
+If this value is not supplied via the Configurator constructor or via a config
+file, it will default to ``en``.
-If this setting is supplied within the :app:`Pyramid` application
-``.ini`` file, it will be available as a settings key:
+If this setting is supplied within the :app:`Pyramid` application ``.ini``
+file, it will be available as a settings key:
.. code-block:: python
:linenos:
@@ -748,34 +722,32 @@ If this setting is supplied within the :app:`Pyramid` application
"Detecting" Available Languages
-------------------------------
-Other systems provide an API that returns the set of "available
-languages" as indicated by the union of all languages in all
-translation directories on disk at the time of the call to the API.
+Other systems provide an API that returns the set of "available languages" as
+indicated by the union of all languages in all translation directories on disk
+at the time of the call to the API.
-It is by design that :app:`Pyramid` doesn't supply such an API.
-Instead, the application itself is responsible for knowing the "available
-languages". The rationale is this: any particular application
-deployment must always know which languages it should be translatable
-to anyway, regardless of which translation files are on disk.
+It is by design that :app:`Pyramid` doesn't supply such an API. Instead the
+application itself is responsible for knowing the "available languages". The
+rationale is this: any particular application deployment must always know which
+languages it should be translatable to anyway, regardless of which translation
+files are on disk.
-Here's why: it's not a given that because translations exist in a
-particular language within the registered set of translation
-directories that this particular deployment wants to allow translation
-to that language. For example, some translations may exist but they
-may be incomplete or incorrect. Or there may be translations to a
-language but not for all translation domains.
+Here's why: it's not a given that because translations exist in a particular
+language within the registered set of translation directories that this
+particular deployment wants to allow translation to that language. For
+example, some translations may exist but they may be incomplete or incorrect.
+Or there may be translations to a language but not for all translation domains.
Any nontrivial application deployment will always need to be able to
-selectively choose to allow only some languages even if that set of
-languages is smaller than all those detected within registered
-translation directories. The easiest way to allow for this is to make
-the application entirely responsible for knowing which languages are
-allowed to be translated to instead of relying on the framework to
-divine this information from translation directory file info.
+selectively choose to allow only some languages even if that set of languages
+is smaller than all those detected within registered translation directories.
+The easiest way to allow for this is to make the application entirely
+responsible for knowing which languages are allowed to be translated to instead
+of relying on the framework to divine this information from translation
+directory file info.
-You can set up a system to allow a deployer to select available
-languages based on convention by using the :mod:`pyramid.settings`
-mechanism:
+You can set up a system to allow a deployer to select available languages based
+on convention by using the :mod:`pyramid.settings` mechanism.
Allow a deployer to modify your application's ``.ini`` file:
@@ -792,12 +764,14 @@ Then as a part of the code of a custom :term:`locale negotiator`:
.. code-block:: python
:linenos:
- from pyramid.threadlocal import get_current_registry
- settings = get_current_registry().settings
- languages = settings['available_languages'].split()
+ from pyramid.settings import aslist
+
+ def my_locale_negotiator(request):
+ languages = aslist(request.registry.settings['available_languages'])
+ # ...
-This is only a suggestion. You can create your own "available
-languages" configuration scheme as necessary.
+This is only a suggestion. You can create your own "available languages"
+configuration scheme as necessary.
.. index::
pair: translation; activating
@@ -812,8 +786,8 @@ languages" configuration scheme as necessary.
Activating Translation
----------------------
-By default, a :app:`Pyramid` application performs no translation.
-To turn translation on, you must:
+By default, a :app:`Pyramid` application performs no translation. To turn
+translation on you must:
- add at least one :term:`translation directory` to your application.
@@ -827,24 +801,23 @@ To turn translation on, you must:
Adding a Translation Directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-:term:`gettext` is the underlying machinery behind the
-:app:`Pyramid` translation machinery. A translation directory is a
-directory organized to be useful to :term:`gettext`. A translation
-directory usually includes a listing of language directories, each of
-which itself includes an ``LC_MESSAGES`` directory. Each
-``LC_MESSAGES`` directory should contain one or more ``.mo`` files.
-Each ``.mo`` file represents a :term:`message catalog`, which is used
-to provide translations to your application.
+:term:`gettext` is the underlying machinery behind the :app:`Pyramid`
+translation machinery. A translation directory is a directory organized to be
+useful to :term:`gettext`. A translation directory usually includes a listing
+of language directories, each of which itself includes an ``LC_MESSAGES``
+directory. Each ``LC_MESSAGES`` directory should contain one or more ``.mo``
+files. Each ``.mo`` file represents a :term:`message catalog`, which is used to
+provide translations to your application.
Adding a :term:`translation directory` registers all of its constituent
-:term:`message catalog` files within your :app:`Pyramid` application to
-be available to use for translation services. This includes all of the
-``.mo`` files found within all ``LC_MESSAGES`` directories within each
-locale directory in the translation directory.
+:term:`message catalog` files within your :app:`Pyramid` application to be
+available to use for translation services. This includes all of the ``.mo``
+files found within all ``LC_MESSAGES`` directories within each locale directory
+in the translation directory.
You can add a translation directory imperatively by using the
-:meth:`pyramid.config.Configurator.add_translation_dirs` during
-application startup. For example:
+:meth:`pyramid.config.Configurator.add_translation_dirs` during application
+startup. For example:
.. code-block:: python
:linenos:
@@ -854,10 +827,10 @@ application startup. For example:
'another.application:locale/')
A message catalog in a translation directory added via
-:meth:`~pyramid.config.Configurator.add_translation_dirs`
-will be merged into translations from a message catalog added earlier
-if both translation directories contain translations for the same
-locale and :term:`translation domain`.
+:meth:`~pyramid.config.Configurator.add_translation_dirs` will be merged into
+translations from a message catalog added earlier if both translation
+directories contain translations for the same locale and :term:`translation
+domain`.
.. index::
pair: setting; locale
@@ -865,32 +838,29 @@ locale and :term:`translation domain`.
Setting the Locale
~~~~~~~~~~~~~~~~~~
-When the *default locale negotiator* (see
-:ref:`default_locale_negotiator`) is in use, you can inform
-:app:`Pyramid` of the current locale name by doing any of these
-things before any translations need to be performed:
+When the *default locale negotiator* (see :ref:`default_locale_negotiator`) is
+in use, you can inform :app:`Pyramid` of the current locale name by doing any
+of these things before any translations need to be performed:
-- Set the ``_LOCALE_`` attribute of the request to a valid locale name
- (usually directly within view code). E.g. ``request._LOCALE_ =
- 'de'``.
+- Set the ``_LOCALE_`` attribute of the request to a valid locale name (usually
+ directly within view code), e.g., ``request._LOCALE_ = 'de'``.
-- Ensure that a valid locale name value is in the ``request.params``
- dictionary under the key named ``_LOCALE_``. This is usually the
- result of passing a ``_LOCALE_`` value in the query string or in the
- body of a form post associated with a request. For example,
- visiting ``http://my.application?_LOCALE_=de``.
+- Ensure that a valid locale name value is in the ``request.params`` dictionary
+ under the key named ``_LOCALE_``. This is usually the result of passing a
+ ``_LOCALE_`` value in the query string or in the body of a form post
+ associated with a request. For example, visiting
+ ``http://my.application?_LOCALE_=de``.
- Ensure that a valid locale name value is in the ``request.cookies``
- dictionary under the key named ``_LOCALE_``. This is usually the
- result of setting a ``_LOCALE_`` cookie in a prior response,
- e.g. ``response.set_cookie('_LOCALE_', 'de')``.
+ dictionary under the key named ``_LOCALE_``. This is usually the result of
+ setting a ``_LOCALE_`` cookie in a prior response, e.g.,
+ ``response.set_cookie('_LOCALE_', 'de')``.
.. note::
If this locale negotiation scheme is inappropriate for a particular
- application, you can configure a custom :term:`locale negotiator`
- function into that application as required. See
- :ref:`custom_locale_negotiator`.
+ application, you can configure a custom :term:`locale negotiator` function
+ into that application as required. See :ref:`custom_locale_negotiator`.
.. index::
single: locale negotiator
@@ -900,57 +870,55 @@ things before any translations need to be performed:
Locale Negotiators
------------------
-A :term:`locale negotiator` informs the operation of a
-:term:`localizer` by telling it what :term:`locale name` is related to
-a particular request. A locale negotiator is a bit of code which
-accepts a request and which returns a :term:`locale name`. It is
-consulted when :meth:`pyramid.i18n.Localizer.translate` or
-:meth:`pyramid.i18n.Localizer.pluralize` is invoked. It is also
-consulted when :func:`~pyramid.request.Request.locale_name` is accessed or
-when :func:`~pyramid.i18n.negotiate_locale_name` is invoked.
+A :term:`locale negotiator` informs the operation of a :term:`localizer` by
+telling it what :term:`locale name` is related to a particular request. A
+locale negotiator is a bit of code which accepts a request and which returns a
+:term:`locale name`. It is consulted when
+:meth:`pyramid.i18n.Localizer.translate` or
+:meth:`pyramid.i18n.Localizer.pluralize` is invoked. It is also consulted when
+:func:`~pyramid.request.Request.locale_name` is accessed or when
+:func:`~pyramid.i18n.negotiate_locale_name` is invoked.
.. _default_locale_negotiator:
The Default Locale Negotiator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Most applications can make use of the default locale negotiator, which
-requires no additional coding or configuration.
+Most applications can make use of the default locale negotiator, which 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 determine the locale name.
+:class:`~pyramid.i18n.default_locale_negotiator` uses the following 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
- for an :term:`event`).
+- First the negotiator looks for the ``_LOCALE_`` attribute of the request
+ object (possibly set directly by view code or by a listener for an
+ :term:`event`).
- Then it looks for the ``request.params['_LOCALE_']`` value.
- Then it looks for the ``request.cookies['_LOCALE_']`` value.
-- If no locale can be found via the request, it falls back to using
- the :term:`default locale name` (see
- :ref:`localization_deployment_settings`).
+- If no locale can be found via the request, it falls back to using the
+ :term:`default locale name` (see :ref:`localization_deployment_settings`).
-- Finally, if the default locale name is not explicitly set, it uses
- the locale name ``en``.
+- Finally if the default locale name is not explicitly set, it uses the locale
+ name ``en``.
.. _custom_locale_negotiator:
Using a Custom Locale Negotiator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Locale negotiation is sometimes policy-laden and complex. If the
-(simple) default locale negotiation scheme described in
-:ref:`activating_translation` is inappropriate for your application,
-you may create and a special :term:`locale negotiator`. Subsequently
-you may override the default locale negotiator by adding your newly
-created locale negotiator to your application's configuration.
+Locale negotiation is sometimes policy-laden and complex. If the (simple)
+default locale negotiation scheme described in :ref:`activating_translation` is
+inappropriate for your application, you may create a special :term:`locale
+negotiator`. Subsequently you may override the default locale negotiator by
+adding your newly created locale negotiator to your application's
+configuration.
-A locale negotiator is simply a callable which
-accepts a request and returns a single :term:`locale name` or ``None``
-if no locale can be determined.
+A locale negotiator is simply a callable which accepts a request and returns a
+single :term:`locale name` or ``None`` if no locale can be determined.
Here's an implementation of a simple locale negotiator:
@@ -961,16 +929,14 @@ Here's an implementation of a simple locale negotiator:
locale_name = request.params.get('my_locale')
return locale_name
-If a locale negotiator returns ``None``, it signifies to
-:app:`Pyramid` that the default application locale name should be
-used.
+If a locale negotiator returns ``None``, it signifies to :app:`Pyramid` that
+the default application locale name should be used.
You may add your newly created locale negotiator to your application's
configuration by passing an object which can act as the negotiator (or a
:term:`dotted Python name` referring to the object) as the
-``locale_negotiator`` argument of the
-:class:`~pyramid.config.Configurator` instance during application
-startup. For example:
+``locale_negotiator`` argument of the :class:`~pyramid.config.Configurator`
+instance during application startup. For example:
.. code-block:: python
:linenos:
@@ -978,9 +944,8 @@ startup. For example:
from pyramid.config import Configurator
config = Configurator(locale_negotiator=my_locale_negotiator)
-Alternately, use the
-:meth:`pyramid.config.Configurator.set_locale_negotiator`
-method.
+Alternatively, use the
+:meth:`pyramid.config.Configurator.set_locale_negotiator` method.
For example:
@@ -990,4 +955,3 @@ For example:
from pyramid.config import Configurator
config = Configurator()
config.set_locale_negotiator(my_locale_negotiator)
-
diff --git a/docs/narr/install.rst b/docs/narr/install.rst
index a825b61b9..767b16fc0 100644
--- a/docs/narr/install.rst
+++ b/docs/narr/install.rst
@@ -1,7 +1,7 @@
.. _installing_chapter:
Installing :app:`Pyramid`
-============================
+=========================
.. index::
single: install preparation
@@ -15,8 +15,8 @@ You will need `Python <http://python.org>`_ version 2.6 or better to run
.. sidebar:: Python Versions
As of this writing, :app:`Pyramid` has been tested under Python 2.6, Python
- 2.7, Python 3.2, Python 3.3, Python 3.4 and PyPy 2.2. :app:`Pyramid` does
- not run under any version of Python before 2.6.
+ 2.7, Python 3.3, Python 3.4, Python 3.5, PyPy, and PyPy3. :app:`Pyramid`
+ does not run under any version of Python before 2.6.
:app:`Pyramid` is known to run on all popular UNIX-like systems such as Linux,
Mac OS X, and FreeBSD as well as on Windows platforms. It is also known to run
@@ -32,12 +32,12 @@ dependency will fall back to using pure Python instead.
For Mac OS X Users
~~~~~~~~~~~~~~~~~~
-Python comes pre-installed on Mac OS X, but due to Apple's release cycle,
-it is often out of date. Unless you have a need for a specific earlier version,
-it is recommended to install the latest 2.x or 3.x version of Python.
+Python comes pre-installed on Mac OS X, but due to Apple's release cycle, it is
+often out of date. Unless you have a need for a specific earlier version, it is
+recommended to install the latest 2.x or 3.x version of Python.
You can install the latest verion of Python for Mac OS X from the binaries on
-`python.org <https://www.python.org/download/mac/>`_.
+`python.org <https://www.python.org/downloads/mac-osx/>`_.
Alternatively, you can use the `homebrew <http://brew.sh/>`_ package manager.
@@ -46,13 +46,13 @@ Alternatively, you can use the `homebrew <http://brew.sh/>`_ package manager.
# for python 2.7
$ brew install python
- # for python 3.4
+ # for python 3.5
$ brew install python3
If you use an installer for your Python, then you can skip to the section
:ref:`installing_unix`.
-If You Don't Yet Have A Python Interpreter (UNIX)
+If You Don't Yet Have a Python Interpreter (UNIX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If your system doesn't have a Python interpreter, and you're on UNIX, you can
@@ -90,12 +90,12 @@ Source Compile Method
It's useful to use a Python interpreter that *isn't* the "system" Python
interpreter to develop your software. The authors of :app:`Pyramid` tend not
-to use the system Python for development purposes; always a self-compiled one.
+to use the system Python for development purposes; always a self-compiled one.
Compiling Python is usually easy, and often the "system" Python is compiled
with options that aren't optimal for web development. For an explanation, see
https://github.com/Pylons/pyramid/issues/747.
-To compile software on your UNIX system, typically you need development tools.
+To compile software on your UNIX system, typically you need development tools.
Often these can be installed via the package manager. For example, this works
to do so on an Ubuntu Linux system:
@@ -128,7 +128,7 @@ Once these steps are performed, the Python interpreter will be invokable via
.. index::
pair: install; Python (from package, Windows)
-If You Don't Yet Have A Python Interpreter (Windows)
+If You Don't Yet Have a Python Interpreter (Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If your Windows system doesn't have a Python interpreter, you'll need to
@@ -153,7 +153,7 @@ also need to download and install the Python for Windows extensions.
.. _installing_unix:
Installing :app:`Pyramid` on a UNIX System
----------------------------------------------
+------------------------------------------
It is best practice to install :app:`Pyramid` into a "virtual" Python
environment in order to obtain isolation from any "system" packages you've got
@@ -204,7 +204,7 @@ it using the Python interpreter into which you want to install setuptools.
$ python ez_setup.py
-Once this command is invoked, setuptools should be installed on your system.
+Once this command is invoked, setuptools should be installed on your system.
If the command fails due to permission errors, you may need to be the
administrative user on your system to successfully invoke the script. To
remediate this, you may need to do:
@@ -285,14 +285,14 @@ it's an absolute path.
acceptable (and desirable) to create a virtualenv as a normal user.
-Installing :app:`Pyramid` Into the Virtual Python Environment
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Installing :app:`Pyramid` into the Virtual Python Environment
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
After you've got your virtualenv installed, you may install :app:`Pyramid`
itself using the following commands:
.. parsed-literal::
-
+
$ $VENV/bin/easy_install "pyramid==\ |release|\ "
The ``easy_install`` command will take longer than the previous ones to
@@ -301,9 +301,9 @@ complete, as it downloads and installs a number of dependencies.
.. note::
If you see any warnings and/or errors related to failing to compile the C
- extensions, in most cases you may safely ignore those errors. If you wish
- to use the C extensions, please verify that you have a functioning compiler
- and the Python header files installed.
+ extensions, in most cases you may safely ignore those errors. If you wish to
+ use the C extensions, please verify that you have a functioning compiler and
+ the Python header files installed.
.. index::
single: installing on Windows
@@ -311,7 +311,7 @@ complete, as it downloads and installs a number of dependencies.
.. _installing_windows:
Installing :app:`Pyramid` on a Windows System
--------------------------------------------------
+---------------------------------------------
You can use Pyramid on Windows under Python 2 or 3.
@@ -371,7 +371,7 @@ You can use Pyramid on Windows under Python 2 or 3.
installed:
.. parsed-literal::
-
+
c:\\env> %VENV%\\Scripts\\easy_install "pyramid==\ |release|\ "
What Gets Installed
@@ -382,4 +382,3 @@ WebOb, PasteDeploy, and others are installed.
Additionally, as chronicled in :ref:`project_narr`, scaffolds will be
registered, which make it easy to start a new :app:`Pyramid` project.
-
diff --git a/docs/narr/introduction.rst b/docs/narr/introduction.rst
index a37d74c9b..8db52dc21 100644
--- a/docs/narr/introduction.rst
+++ b/docs/narr/introduction.rst
@@ -7,7 +7,7 @@
single: framework
:app:`Pyramid` Introduction
-==============================
+===========================
:app:`Pyramid` is a general, open source, Python web application development
*framework*. Its primary goal is to make it easier for a Python developer to
@@ -15,40 +15,39 @@ create web applications.
.. sidebar:: Frameworks vs. Libraries
- A *framework* differs from a *library* in one very important way:
- library code is always *called* by code that you write, while a
- framework always *calls* code that you write. Using a set of
- libraries to create an application is usually easier than using a
- framework initially, because you can choose to cede control to
- library code you have not authored very selectively. But when you
- use a framework, you are required to cede a greater portion of
- control to code you have not authored: code that resides in the
- framework itself. You needn't use a framework at all to create a
- web application using Python. A rich set of libraries already
- exists for the platform. In practice, however, using a framework
- to create an application is often more practical than rolling your
- own via a set of libraries if the framework provides a set of
- facilities that fits your application requirements.
+ A *framework* differs from a *library* in one very important way: library
+ code is always *called* by code that you write, while a framework always
+ *calls* code that you write. Using a set of libraries to create an
+ application is usually easier than using a framework initially, because you
+ can choose to cede control to library code you have not authored very
+ selectively. But when you use a framework, you are required to cede a
+ greater portion of control to code you have not authored: code that resides
+ in the framework itself. You needn't use a framework at all to create a web
+ application using Python. A rich set of libraries already exists for the
+ platform. In practice, however, using a framework to create an application
+ is often more practical than rolling your own via a set of libraries if the
+ framework provides a set of facilities that fits your application
+ requirements.
Pyramid attempts to follow these design and engineering principles:
Simplicity
:app:`Pyramid` takes a *"pay only for what you eat"* approach. You can get
- results even if you have only a partial understanding of :app:`Pyramid`.
- It doesn’t force you to use any particular technology to produce an
- application, and we try to keep the core set of concepts that you need to
- understand to a minimum.
+ results even if you have only a partial understanding of :app:`Pyramid`. It
+ doesn't force you to use any particular technology to produce an application,
+ and we try to keep the core set of concepts that you need to understand to a
+ minimum.
Minimalism
- :app:`Pyramid` tries to solve only the fundamental problems of creating
- a web application: the mapping of URLs to code, templating, security and
- serving static assets. We consider these to be the core activities that are
- common to nearly all web applications.
+ :app:`Pyramid` tries to solve only the fundamental problems of creating a web
+ application: the mapping of URLs to code, templating, security, and serving
+ static assets. We consider these to be the core activities that are common to
+ nearly all web applications.
Documentation
- Pyramid's minimalism means that it is easier for us to maintain complete
- and up-to-date documentation. It is our goal that no aspect of Pyramid
- is undocumented.
+ Pyramid's minimalism means that it is easier for us to maintain complete and
+ up-to-date documentation. It is our goal that no aspect of Pyramid is
+ undocumented.
Speed
:app:`Pyramid` is designed to provide noticeably fast execution for common
@@ -56,68 +55,66 @@ Speed
Reliability
:app:`Pyramid` is developed conservatively and tested exhaustively. Where
- Pyramid source code is concerned, our motto is: "If it ain’t tested, it’s
+ Pyramid source code is concerned, our motto is: "If it ain't tested, it's
broke".
Openness
- As with Python, the Pyramid software is distributed under a `permissive
- open source license <http://repoze.org/license.html>`_.
+ As with Python, the Pyramid software is distributed under a `permissive open
+ source license <http://repoze.org/license.html>`_.
.. _what_makes_pyramid_unique:
-What Makes Pyramid Unique
+What makes Pyramid unique
-------------------------
Understandably, people don't usually want to hear about squishy engineering
-principles, they want to hear about concrete stuff that solves their
-problems. With that in mind, what would make someone want to use Pyramid
-instead of one of the many other web frameworks available today? What makes
-Pyramid unique?
-
-This is a hard question to answer, because there are lots of excellent
-choices, and it's actually quite hard to make a wrong choice, particularly in
-the Python web framework market. But one reasonable answer is this: you can
-write very small applications in Pyramid without needing to know a lot.
-"What?", you say, "that can't possibly be a unique feature, lots of other web
-frameworks let you do that!" Well, you're right. But unlike many other
-systems, you can also write very large applications in Pyramid if you learn a
-little more about it. Pyramid will allow you to become productive quickly,
-and will grow with you; it won't hold you back when your application is small
-and it won't get in your way when your application becomes large. "Well
-that's fine," you say, "lots of other frameworks let me write large apps
-too." Absolutely. But other Python web frameworks don't seamlessly let you
-do both. They seem to fall into two non-overlapping categories: frameworks
-for "small apps" and frameworks for "big apps". The "small app" frameworks
-typically sacrifice "big app" features, and vice versa.
+principles; they want to hear about concrete stuff that solves their problems.
+With that in mind, what would make someone want to use Pyramid instead of one
+of the many other web frameworks available today? What makes Pyramid unique?
+
+This is a hard question to answer because there are lots of excellent choices,
+and it's actually quite hard to make a wrong choice, particularly in the Python
+web framework market. But one reasonable answer is this: you can write very
+small applications in Pyramid without needing to know a lot. "What?" you say.
+"That can't possibly be a unique feature. Lots of other web frameworks let you
+do that!" Well, you're right. But unlike many other systems, you can also
+write very large applications in Pyramid if you learn a little more about it.
+Pyramid will allow you to become productive quickly, and will grow with you. It
+won't hold you back when your application is small, and it won't get in your
+way when your application becomes large. "Well that's fine," you say. "Lots of
+other frameworks let me write large apps, too." Absolutely. But other Python
+web frameworks don't seamlessly let you do both. They seem to fall into two
+non-overlapping categories: frameworks for "small apps" and frameworks for "big
+apps". The "small app" frameworks typically sacrifice "big app" features, and
+vice versa.
We don't think it's a universally reasonable suggestion to write "small apps"
in a "small framework" and "big apps" in a "big framework". You can't really
-know to what size every application will eventually grow. We don't really
-want to have to rewrite a previously small application in another framework
-when it gets "too big". We believe the current binary distinction between
-frameworks for small and large applications is just false; a well-designed
-framework should be able to be good at both. Pyramid strives to be that kind
-of framework.
-
-To this end, Pyramid provides a set of features that, combined, are unique
+know to what size every application will eventually grow. We don't really want
+to have to rewrite a previously small application in another framework when it
+gets "too big". We believe the current binary distinction between frameworks
+for small and large applications is just false. A well-designed framework
+should be able to be good at both. Pyramid strives to be that kind of
+framework.
+
+To this end, Pyramid provides a set of features that combined are unique
amongst Python web frameworks. Lots of other frameworks contain some
-combination of these features; Pyramid of course actually stole many of them
-from those other frameworks. But Pyramid is the only one that has all of
-them in one place, documented appropriately, and useful a la carte without
+combination of these features. Pyramid of course actually stole many of them
+from those other frameworks. But Pyramid is the only one that has all of them
+in one place, documented appropriately, and useful *à la carte* without
necessarily paying for the entire banquet. These are detailed below.
Single-file applications
~~~~~~~~~~~~~~~~~~~~~~~~
-You can write a Pyramid application that lives entirely in one Python file,
-not unlike existing Python microframeworks. This is beneficial for one-off
-prototyping, bug reproduction, and very small applications. These
-applications are easy to understand because all the information about the
-application lives in a single place, and you can deploy them without needing
-to understand much about Python distributions and packaging. Pyramid isn't
-really marketed as a microframework, but it allows you to do almost
-everything that frameworks that are marketed as micro offer in very similar
-ways.
+You can write a Pyramid application that lives entirely in one Python file, not
+unlike existing Python microframeworks. This is beneficial for one-off
+prototyping, bug reproduction, and very small applications. These applications
+are easy to understand because all the information about the application lives
+in a single place, and you can deploy them without needing to understand much
+about Python distributions and packaging. Pyramid isn't really marketed as a
+microframework, but it allows you to do almost everything that frameworks that
+are marketed as "micro" offer in very similar ways.
.. literalinclude:: helloworld.py
@@ -142,26 +139,25 @@ decorators to localize the configuration. For example:
def fred_view(request):
return Response('fred')
-However, unlike some other systems, using decorators for Pyramid
-configuration does not make your application difficult to extend, test or
-reuse. The :class:`~pyramid.view.view_config` decorator, for example, does
-not actually *change* the input or output of the function it decorates, so
-testing it is a "WYSIWYG" operation; you don't need to understand the
-framework to test your own code, you just behave as if the decorator is not
-there. You can also instruct Pyramid to ignore some decorators, or use
-completely imperative configuration instead of decorators to add views.
-Pyramid decorators are inert instead of eager: you detect and activate them
-with a :term:`scan`.
+However, unlike some other systems, using decorators for Pyramid configuration
+does not make your application difficult to extend, test, or reuse. The
+:class:`~pyramid.view.view_config` decorator, for example, does not actually
+*change* the input or output of the function it decorates, so testing it is a
+"WYSIWYG" operation. You don't need to understand the framework to test your
+own code. You just behave as if the decorator is not there. You can also
+instruct Pyramid to ignore some decorators, or use completely imperative
+configuration instead of decorators to add views. Pyramid decorators are inert
+instead of eager. You detect and activate them with a :term:`scan`.
Example: :ref:`mapping_views_using_a_decorator_section`.
URL generation
~~~~~~~~~~~~~~
-Pyramid is capable of generating URLs for resources, routes, and static
-assets. Its URL generation APIs are easy to use and flexible. If you use
-Pyramid's various APIs for generating URLs, you can change your configuration
-around arbitrarily without fear of breaking a link on one of your web pages.
+Pyramid is capable of generating URLs for resources, routes, and static assets.
+Its URL generation APIs are easy to use and flexible. If you use Pyramid's
+various APIs for generating URLs, you can change your configuration around
+arbitrarily without fear of breaking a link on one of your web pages.
Example: :ref:`generating_route_urls`.
@@ -169,30 +165,30 @@ Static file serving
~~~~~~~~~~~~~~~~~~~
Pyramid is perfectly willing to serve static files itself. It won't make you
-use some external web server to do that. You can even serve more than one
-set of static files in a single Pyramid web application (e.g. ``/static`` and
-``/static2``). You can also, optionally, place your files on an external web
-server and ask Pyramid to help you generate URLs to those files, so you can
-use Pyramid's internal fileserving while doing development, and a faster
-static file server in production without changing any code.
+use some external web server to do that. You can even serve more than one set
+of static files in a single Pyramid web application (e.g., ``/static`` and
+``/static2``). You can optionally place your files on an external web server
+and ask Pyramid to help you generate URLs to those files. This let's you use
+Pyramid's internal file serving while doing development, and a faster static
+file server in production, without changing any code.
Example: :ref:`static_assets_section`.
-Fully Interactive Development
+Fully interactive development
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When developing a Pyramid application, several interactive features are
available. Pyramid can automatically utilize changed templates when rendering
-pages and automatically restart the application to incorporate changed python
+pages and automatically restart the application to incorporate changed Python
code. Plain old ``print()`` calls used for debugging can display to a console.
Pyramid's debug toolbar comes activated when you use a Pyramid scaffold to
render a project. This toolbar overlays your application in the browser, and
-allows you access to framework data such as the routes configured, the last
-renderings performed, the current set of packages installed, SQLAlchemy
-queries run, logging data, and various other facts. When an exception
-occurs, you can use its interactive debugger to poke around right in your
-browser to try to determine the cause of the exception. It's handy.
+allows you access to framework data, such as the routes configured, the last
+renderings performed, the current set of packages installed, SQLAlchemy queries
+run, logging data, and various other facts. When an exception occurs, you can
+use its interactive debugger to poke around right in your browser to try to
+determine the cause of the exception. It's handy.
Example: :ref:`debug_toolbar`.
@@ -200,46 +196,46 @@ Debugging settings
~~~~~~~~~~~~~~~~~~
Pyramid has debugging settings that allow you to print Pyramid runtime
-information to the console when things aren't behaving as you're expecting.
-For example, you can turn on "debug_notfound", which prints an informative
-message to the console every time a URL does not match any view. You can
-turn on "debug_authorization", which lets you know why a view execution was
+information to the console when things aren't behaving as you're expecting. For
+example, you can turn on ``debug_notfound``, which prints an informative
+message to the console every time a URL does not match any view. You can turn
+on ``debug_authorization``, which lets you know why a view execution was
allowed or denied by printing a message to the console. These features are
useful for those WTF moments.
There are also a number of commands that you can invoke within a Pyramid
-environment that allow you to introspect the configuration of your system:
-``proutes`` shows all configured routes for an application in the order
-they'll be evaluated for matching; ``pviews`` shows all configured views for
-any given URL. These are also WTF-crushers in some circumstances.
+environment that allow you to introspect the configuration of your system.
+``proutes`` shows all configured routes for an application in the order they'll
+be evaluated for matching. ``pviews`` shows all configured views for any given
+URL. These are also WTF-crushers in some circumstances.
Examples: :ref:`debug_authorization_section` and :ref:`command_line_chapter`.
Add-ons
-~~~~~~~~
+~~~~~~~
Pyramid has an extensive set of add-ons held to the same quality standards as
-the Pyramid core itself. Add-ons are packages which provide functionality
-that the Pyramid core doesn't. Add-on packages already exist which let you
-easily send email, let you use the Jinja2 templating system, let you use
-XML-RPC or JSON-RPC, let you integrate with jQuery Mobile, etc.
-
-Examples: http://docs.pylonsproject.org/en/latest/docs/pyramid.html#pyramid-add-on-documentation
+the Pyramid core itself. Add-ons are packages which provide functionality that
+the Pyramid core doesn't. Add-on packages already exist which let you easily
+send email, let you use the Jinja2 templating system, let you use XML-RPC or
+JSON-RPC, let you integrate with jQuery Mobile, etc.
+Examples:
+http://docs.pylonsproject.org/en/latest/docs/pyramid.html#pyramid-add-on-documentation
Class-based and function-based views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Pyramid has a structured, unified concept of a :term:`view callable`.
-View callables can be functions, methods of classes, or even instances. When
-you add a new view callable, you can choose to make it a function or a method
-of a class; in either case, Pyramid treats it largely the same way. You can
-change your mind later, and move code between methods of classes and
-functions. A collection of similar view callables can be attached to a
-single class as methods, if that floats your boat, and they can share
-initialization code as necessary. All kinds of views are easy to understand
-and use and operate similarly. There is no phony distinction between them;
-they can be used for the same purposes.
+Pyramid has a structured, unified concept of a :term:`view callable`. View
+callables can be functions, methods of classes, or even instances. When you
+add a new view callable, you can choose to make it a function or a method of a
+class. In either case Pyramid treats it largely the same way. You can change
+your mind later and move code between methods of classes and functions. A
+collection of similar view callables can be attached to a single class as
+methods, if that floats your boat, and they can share initialization code as
+necessary. All kinds of views are easy to understand and use, and operate
+similarly. There is no phony distinction between them. They can be used for
+the same purposes.
Here's a view callable defined as a function:
@@ -282,22 +278,22 @@ Here's a few views defined as methods of a class instead:
Asset specifications
~~~~~~~~~~~~~~~~~~~~
-Asset specifications are strings that contain both a Python package name and
-a file or directory name, e.g. ``MyPackage:static/index.html``. Use of these
-specifications is omnipresent in Pyramid. An asset specification can refer
-to a template, a translation directory, or any other package-bound static
-resource. This makes a system built on Pyramid extensible, because you don't
+Asset specifications are strings that contain both a Python package name and a
+file or directory name, e.g., ``MyPackage:static/index.html``. Use of these
+specifications is omnipresent in Pyramid. An asset specification can refer to
+a template, a translation directory, or any other package-bound static
+resource. This makes a system built on Pyramid extensible because you don't
have to rely on globals ("*the* static directory") or lookup schemes ("*the*
ordered set of template directories") to address your files. You can move
files around as necessary, and include other packages that may not share your
system's templates or static files without encountering conflicts.
-Because asset specifications are used heavily in Pyramid, we've also provided
-a way to allow users to override assets. Say you love a system that someone
-else has created with Pyramid but you just need to change "that one template"
-to make it all better. No need to fork the application. Just override the
-asset specification for that template with your own inside a wrapper, and
-you're good to go.
+Because asset specifications are used heavily in Pyramid, we've also provided a
+way to allow users to override assets. Say you love a system that someone else
+has created with Pyramid but you just need to change "that one template" to
+make it all better. No need to fork the application. Just override the asset
+specification for that template with your own inside a wrapper, and you're good
+to go.
Examples: :ref:`asset_specifications` and :ref:`overriding_assets_section`.
@@ -309,12 +305,11 @@ Templating systems such as Mako, Genshi, Chameleon, and Jinja2 can be treated
as renderers. Renderer bindings for all of these templating systems already
exist for use in Pyramid. But if you'd rather use another, it's not a big
deal. Just copy the code from an existing renderer package, and plug in your
-favorite templating system. You'll then be able to use that templating
-system from within Pyramid just as you'd use one of the "built-in" templating
-systems.
+favorite templating system. You'll then be able to use that templating system
+from within Pyramid just as you'd use one of the "built-in" templating systems.
-Pyramid does not make you use a single templating system exclusively. You
-can use multiple templating systems, even in the same project.
+Pyramid does not make you use a single templating system exclusively. You can
+use multiple templating systems, even in the same project.
Example: :ref:`templates_used_directly`.
@@ -322,13 +317,12 @@ Rendered views can return dictionaries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you use a :term:`renderer`, you don't have to return a special kind of
-"webby" ``Response`` object from a view. Instead, you can return a
-dictionary, and Pyramid will take care of converting that dictionary
-to a Response using a template on your behalf. This makes the view easier to
-test, because you don't have to parse HTML in your tests; just make an
-assertion instead that the view returns "the right stuff" in the dictionary
-it returns. You can write "real" unit tests instead of functionally testing
-all of your views.
+"webby" ``Response`` object from a view. Instead you can return a dictionary,
+and Pyramid will take care of converting that dictionary to a Response using a
+template on your behalf. This makes the view easier to test, because you don't
+have to parse HTML in your tests. Instead just make an assertion that the view
+returns "the right stuff" in the dictionary. You can write "real" unit tests
+instead of functionally testing all of your views.
.. index::
pair: renderer; explicitly calling
@@ -364,7 +358,7 @@ be rendered to a response on your behalf. The string passed as ``renderer=``
above is an :term:`asset specification`. It is in the form
``packagename:directoryname/filename.ext``. In this case, it refers to the
``mytemplate.pt`` file in the ``templates`` directory within the ``myapp``
-Python package. Asset specifications are omnipresent in Pyramid: see
+Python package. Asset specifications are omnipresent in Pyramid. See
:ref:`intro_asset_specs` for more information.
Example: :ref:`renderers_chapter`.
@@ -373,9 +367,9 @@ Event system
~~~~~~~~~~~~
Pyramid emits *events* during its request processing lifecycle. You can
-subscribe any number of listeners to these events. For example, to be
-notified of a new request, you can subscribe to the ``NewRequest`` event. To
-be notified that a template is about to be rendered, you can subscribe to the
+subscribe any number of listeners to these events. For example, to be notified
+of a new request, you can subscribe to the ``NewRequest`` event. To be
+notified that a template is about to be rendered, you can subscribe to the
``BeforeRender`` event, and so forth. Using an event publishing system as a
framework notification feature instead of hardcoded hook points tends to make
systems based on that framework less brittle.
@@ -383,9 +377,9 @@ systems based on that framework less brittle.
You can also use Pyramid's event system to send your *own* events. For
example, if you'd like to create a system that is itself a framework, and may
want to notify subscribers that a document has just been indexed, you can
-create your own event type (``DocumentIndexed`` perhaps) and send the event
-via Pyramid. Users of this framework can then subscribe to your event like
-they'd subscribe to the events that are normally sent by Pyramid itself.
+create your own event type (``DocumentIndexed`` perhaps) and send the event via
+Pyramid. Users of this framework can then subscribe to your event like they'd
+subscribe to the events that are normally sent by Pyramid itself.
Example: :ref:`events_chapter` and :ref:`event_types`.
@@ -394,8 +388,8 @@ Built-in internationalization
Pyramid ships with internationalization-related features in its core:
localization, pluralization, and creating message catalogs from source files
-and templates. Pyramid allows for a plurality of message catalog via the use
-of translation domains: you can create a system that has its own translations
+and templates. Pyramid allows for a plurality of message catalogs via the use
+of translation domains. You can create a system that has its own translations
without conflict with other translations in other domains.
Example: :ref:`i18n_chapter`.
@@ -403,9 +397,9 @@ Example: :ref:`i18n_chapter`.
HTTP caching
~~~~~~~~~~~~
-Pyramid provides an easy way to associate views with HTTP caching policies.
-You can just tell Pyramid to configure your view with an ``http_cache``
-statement, and it will take care of the rest::
+Pyramid provides an easy way to associate views with HTTP caching policies. You
+can just tell Pyramid to configure your view with an ``http_cache`` statement,
+and it will take care of the rest::
@view_config(http_cache=3600) # 60 minutes
def myview(request): ....
@@ -413,8 +407,8 @@ statement, and it will take care of the rest::
Pyramid will add appropriate ``Cache-Control`` and ``Expires`` headers to
responses generated when this view is invoked.
-See the :meth:`~pyramid.config.Configurator.add_view` method's
-``http_cache`` documentation for more information.
+See the :meth:`~pyramid.config.Configurator.add_view` method's ``http_cache``
+documentation for more information.
Sessions
~~~~~~~~
@@ -423,9 +417,9 @@ Pyramid has built-in HTTP sessioning. This allows you to associate data with
otherwise anonymous users between requests. Lots of systems do this. But
Pyramid also allows you to plug in your own sessioning system by creating some
code that adheres to a documented interface. Currently there is a binding
-package for the third-party Redis sessioning system that does exactly this.
-But if you have a specialized need (perhaps you want to store your session data
-in MongoDB), you can. You can even switch between implementations without
+package for the third-party Redis sessioning system that does exactly this. But
+if you have a specialized need (perhaps you want to store your session data in
+MongoDB), you can. You can even switch between implementations without
changing your application code.
Example: :ref:`sessions_chapter`.
@@ -433,19 +427,18 @@ Example: :ref:`sessions_chapter`.
Speed
~~~~~
-The Pyramid core is, as far as we can tell, at least marginally faster than
-any other existing Python web framework. It has been engineered from the
-ground up for speed. It only does as much work as absolutely necessary when
-you ask it to get a job done. Extraneous function calls and suboptimal
-algorithms in its core codepaths are avoided. It is feasible to get, for
-example, between 3500 and 4000 requests per second from a simple Pyramid view
-on commodity dual-core laptop hardware and an appropriate WSGI server
-(mod_wsgi or gunicorn). In any case, performance statistics are largely
-useless without requirements and goals, but if you need speed, Pyramid will
-almost certainly never be your application's bottleneck; at least no more
-than Python will be a bottleneck.
+The Pyramid core is, as far as we can tell, at least marginally faster than any
+other existing Python web framework. It has been engineered from the ground up
+for speed. It only does as much work as absolutely necessary when you ask it
+to get a job done. Extraneous function calls and suboptimal algorithms in its
+core codepaths are avoided. It is feasible to get, for example, between 3500
+and 4000 requests per second from a simple Pyramid view on commodity dual-core
+laptop hardware and an appropriate WSGI server (mod_wsgi or gunicorn). In any
+case, performance statistics are largely useless without requirements and
+goals, but if you need speed, Pyramid will almost certainly never be your
+application's bottleneck; at least no more than Python will be a bottleneck.
-Example: http://blog.curiasolutions.com/the-great-web-framework-shootout/
+Example: http://blog.curiasolutions.com/pages/the-great-web-framework-shootout.html
Exception views
~~~~~~~~~~~~~~~
@@ -457,9 +450,9 @@ views, but they're only invoked when an exception "bubbles up" to Pyramid
itself. For example, you might register an exception view for the
:exc:`Exception` exception, which will catch *all* exceptions, and present a
pretty "well, this is embarrassing" page. Or you might choose to register an
-exception view for only specific kinds of application-specific exceptions,
-such as an exception that happens when a file is not found, or an exception
-that happens when an action cannot be performed because the user doesn't have
+exception view for only specific kinds of application-specific exceptions, such
+as an exception that happens when a file is not found, or an exception that
+happens when an action cannot be performed because the user doesn't have
permission to do something. In the former case, you can show a pretty "Not
Found" page; in the latter case you might show a login form.
@@ -469,61 +462,59 @@ No singletons
~~~~~~~~~~~~~
Pyramid is written in such a way that it requires your application to have
-exactly zero "singleton" data structures. Or, put another way, Pyramid
-doesn't require you to construct any "mutable globals". Or put even a
-different way, an import of a Pyramid application needn't have any
-"import-time side effects". This is esoteric-sounding, but if you've ever
-tried to cope with parameterizing a Django "settings.py" file for multiple
-installations of the same application, or if you've ever needed to
-monkey-patch some framework fixture so that it behaves properly for your use
-case, or if you've ever wanted to deploy your system using an asynchronous
-server, you'll end up appreciating this feature. It just won't be a problem.
-You can even run multiple copies of a similar but not identically configured
-Pyramid application within the same Python process. This is good for shared
-hosting environments, where RAM is at a premium.
+exactly zero "singleton" data structures. Or put another way, Pyramid doesn't
+require you to construct any "mutable globals". Or put even another different
+way, an import of a Pyramid application needn't have any "import-time side
+effects". This is esoteric-sounding, but if you've ever tried to cope with
+parameterizing a Django ``settings.py`` file for multiple installations of the
+same application, or if you've ever needed to monkey-patch some framework
+fixture so that it behaves properly for your use case, or if you've ever wanted
+to deploy your system using an asynchronous server, you'll end up appreciating
+this feature. It just won't be a problem. You can even run multiple copies of
+a similar but not identically configured Pyramid application within the same
+Python process. This is good for shared hosting environments, where RAM is at
+a premium.
View predicates and many views per route
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unlike many other systems, Pyramid allows you to associate more than one view
-per route. For example, you can create a route with the pattern ``/items``
-and when the route is matched, you can shuffle off the request to one view if
-the request method is GET, another view if the request method is POST, etc.
-A system known as "view predicates" allows for this. Request method matching
-is the most basic thing you can do with a view predicate. You can also
-associate views with other request parameters such as the elements in the
-query string, the Accept header, whether the request is an XHR request or
-not, and lots of other things. This feature allows you to keep your
-individual views "clean"; they won't need much conditional logic, so they'll
-be easier to test.
+per route. For example, you can create a route with the pattern ``/items`` and
+when the route is matched, you can shuffle off the request to one view if the
+request method is GET, another view if the request method is POST, etc. A
+system known as "view predicates" allows for this. Request method matching is
+the most basic thing you can do with a view predicate. You can also associate
+views with other request parameters, such as the elements in the query string,
+the Accept header, whether the request is an XHR request or not, and lots of
+other things. This feature allows you to keep your individual views clean.
+They won't need much conditional logic, so they'll be easier to test.
Example: :ref:`view_configuration_parameters`.
Transaction management
~~~~~~~~~~~~~~~~~~~~~~
-Pyramid's :term:`scaffold` system renders projects that include a
-*transaction management* system, stolen from Zope. When you use this
-transaction management system, you cease being responsible for committing
-your data anymore. Instead, Pyramid takes care of committing: it commits at
-the end of a request or aborts if there's an exception. Why is that a good
-thing? Having a centralized place for transaction management is a great
-thing. If, instead of managing your transactions in a centralized place, you
-sprinkle ``session.commit`` calls in your application logic itself, you can
-wind up in a bad place. Wherever you manually commit data to your database,
-it's likely that some of your other code is going to run *after* your commit.
-If that code goes on to do other important things after that commit, and an
-error happens in the later code, you can easily wind up with inconsistent
-data if you're not extremely careful. Some data will have been written to
-the database that probably should not have. Having a centralized commit
-point saves you from needing to think about this; it's great for lazy people
-who also care about data integrity. Either the request completes
-successfully, and all changes are committed, or it does not, and all changes
-are aborted.
-
-Also, Pyramid's transaction management system allows you to synchronize
-commits between multiple databases, and allows you to do things like
-conditionally send email if a transaction commits, but otherwise keep quiet.
+Pyramid's :term:`scaffold` system renders projects that include a *transaction
+management* system, stolen from Zope. When you use this transaction management
+system, you cease being responsible for committing your data anymore. Instead
+Pyramid takes care of committing: it commits at the end of a request or aborts
+if there's an exception. Why is that a good thing? Having a centralized place
+for transaction management is a great thing. If, instead of managing your
+transactions in a centralized place, you sprinkle ``session.commit`` calls in
+your application logic itself, you can wind up in a bad place. Wherever you
+manually commit data to your database, it's likely that some of your other code
+is going to run *after* your commit. If that code goes on to do other important
+things after that commit, and an error happens in the later code, you can
+easily wind up with inconsistent data if you're not extremely careful. Some
+data will have been written to the database that probably should not have.
+Having a centralized commit point saves you from needing to think about this;
+it's great for lazy people who also care about data integrity. Either the
+request completes successfully, and all changes are committed, or it does not,
+and all changes are aborted.
+
+Pyramid's transaction management system allows you to synchronize commits
+between multiple databases. It also allows you to do things like conditionally
+send email if a transaction commits, but otherwise keep quiet.
Example: :ref:`bfg_sql_wiki_tutorial` (note the lack of commit statements
anywhere in application code).
@@ -531,17 +522,18 @@ anywhere in application code).
Configuration conflict detection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When a system is small, it's reasonably easy to keep it all in your head.
-But when systems grow large, you may have hundreds or thousands of
-configuration statements which add a view, add a route, and so forth.
-Pyramid's configuration system keeps track of your configuration statements,
-and if you accidentally add two that are identical, or Pyramid can't make
-sense out of what it would mean to have both statements active at the same
-time, it will complain loudly at startup time. It's not dumb though: it will
-automatically resolve conflicting configuration statements on its own if you
-use the configuration :meth:`~pyramid.config.Configurator.include` system:
-"more local" statements are preferred over "less local" ones. This allows
-you to intelligently factor large systems into smaller ones.
+When a system is small, it's reasonably easy to keep it all in your head. But
+when systems grow large, you may have hundreds or thousands of configuration
+statements which add a view, add a route, and so forth.
+
+Pyramid's configuration system keeps track of your configuration statements. If
+you accidentally add two that are identical, or Pyramid can't make sense out of
+what it would mean to have both statements active at the same time, it will
+complain loudly at startup time. It's not dumb though. It will automatically
+resolve conflicting configuration statements on its own if you use the
+configuration :meth:`~pyramid.config.Configurator.include` system. "More local"
+statements are preferred over "less local" ones. This allows you to
+intelligently factor large systems into smaller ones.
Example: :ref:`conflict_detection`.
@@ -551,17 +543,17 @@ Configuration extensibility
Unlike other systems, Pyramid provides a structured "include" mechanism (see
:meth:`~pyramid.config.Configurator.include`) that allows you to combine
applications from multiple Python packages. All the configuration statements
-that can be performed in your "main" Pyramid application can also be
-performed by included packages including the addition of views, routes,
-subscribers, and even authentication and authorization policies. You can even
-extend or override an existing application by including another application's
-configuration in your own, overriding or adding new views and routes to
-it. This has the potential to allow you to create a big application out of
-many other smaller ones. For example, if you want to reuse an existing
-application that already has a bunch of routes, you can just use the
-``include`` statement with a ``route_prefix``; the new application will live
-within your application at a URL prefix. It's not a big deal, and requires
-little up-front engineering effort.
+that can be performed in your "main" Pyramid application can also be performed
+by included packages, including the addition of views, routes, subscribers, and
+even authentication and authorization policies. You can even extend or override
+an existing application by including another application's configuration in
+your own, overriding or adding new views and routes to it. This has the
+potential to allow you to create a big application out of many other smaller
+ones. For example, if you want to reuse an existing application that already
+has a bunch of routes, you can just use the ``include`` statement with a
+``route_prefix``. The new application will live within your application at an
+URL prefix. It's not a big deal, and requires little up-front engineering
+effort.
For example:
@@ -584,16 +576,15 @@ For example:
Flexible authentication and authorization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Pyramid includes a flexible, pluggable authentication and authorization
-system. No matter where your user data is stored, or what scheme you'd like
-to use to permit your users to access your data, you can use a predefined
-Pyramid plugpoint to plug in your custom authentication and authorization
-code. If you want to change these schemes later, you can just change it in
-one place rather than everywhere in your code. It also ships with prebuilt
-well-tested authentication and authorization schemes out of the box. But
-what if you don't want to use Pyramid's built-in system? You don't have to.
-You can just write your own bespoke security code as you would in any other
-system.
+Pyramid includes a flexible, pluggable authentication and authorization system.
+No matter where your user data is stored, or what scheme you'd like to use to
+permit your users to access your data, you can use a predefined Pyramid
+plugpoint to plug in your custom authentication and authorization code. If you
+want to change these schemes later, you can just change it in one place rather
+than everywhere in your code. It also ships with prebuilt well-tested
+authentication and authorization schemes out of the box. But what if you don't
+want to use Pyramid's built-in system? You don't have to. You can just write
+your own bespoke security code as you would in any other system.
Example: :ref:`enabling_authorization_policy`.
@@ -601,19 +592,19 @@ Traversal
~~~~~~~~~
:term:`Traversal` is a concept stolen from :term:`Zope`. It allows you to
-create a tree of resources, each of which can be addressed by one or more
-URLs. Each of those resources can have one or more *views* associated with
-it. If your data isn't naturally treelike (or you're unwilling to create a
-treelike representation of your data), you aren't going to find traversal
-very useful. However, traversal is absolutely fantastic for sites that need
-to be arbitrarily extensible: it's a lot easier to add a node to a tree than
-it is to shoehorn a route into an ordered list of other routes, or to create
-another entire instance of an application to service a department and glue
-code to allow disparate apps to share data. It's a great fit for sites that
-naturally lend themselves to changing departmental hierarchies, such as
-content management systems and document management systems. Traversal also
-lends itself well to systems that require very granular security ("Bob can
-edit *this* document" as opposed to "Bob can edit documents").
+create a tree of resources, each of which can be addressed by one or more URLs.
+Each of those resources can have one or more *views* associated with it. If
+your data isn't naturally treelike, or you're unwilling to create a treelike
+representation of your data, you aren't going to find traversal very useful.
+However, traversal is absolutely fantastic for sites that need to be
+arbitrarily extensible. It's a lot easier to add a node to a tree than it is to
+shoehorn a route into an ordered list of other routes, or to create another
+entire instance of an application to service a department and glue code to
+allow disparate apps to share data. It's a great fit for sites that naturally
+lend themselves to changing departmental hierarchies, such as content
+management systems and document management systems. Traversal also lends
+itself well to systems that require very granular security ("Bob can edit
+*this* document" as opposed to "Bob can edit documents").
Examples: :ref:`hello_traversal_chapter` and
:ref:`much_ado_about_traversal_chapter`.
@@ -635,7 +626,7 @@ View response adapters
A lot is made of the aesthetics of what *kinds* of objects you're allowed to
return from view callables in various frameworks. In a previous section in
-this document we showed you that, if you use a :term:`renderer`, you can
+this document, we showed you that, if you use a :term:`renderer`, you can
usually return a dictionary from a view callable instead of a full-on
:term:`Response` object. But some frameworks allow you to return strings or
tuples from view callables. When frameworks allow for this, code looks
@@ -662,12 +653,11 @@ The former is "prettier", right?
Out of the box, if you define the former view callable (the one that simply
returns a string) in Pyramid, when it is executed, Pyramid will raise an
-exception. This is because "explicit is better than implicit", in most
-cases, and by default, Pyramid wants you to return a :term:`Response` object
-from a view callable. This is because there's usually a heck of a lot more
-to a response object than just its body. But if you're the kind of person
-who values such aesthetics, we have an easy way to allow for this sort of
-thing:
+exception. This is because "explicit is better than implicit", in most cases,
+and by default Pyramid wants you to return a :term:`Response` object from a
+view callable. This is because there's usually a heck of a lot more to a
+response object than just its body. But if you're the kind of person who
+values such aesthetics, we have an easy way to allow for this sort of thing:
.. code-block:: python
:linenos:
@@ -733,9 +723,9 @@ Once this is done, both of these view callables will work:
def anotherview(request):
return (403, 'text/plain', "Forbidden")
-Pyramid defaults to explicit behavior, because it's the most generally
-useful, but provides hooks that allow you to adapt the framework to localized
-aesthetic desires.
+Pyramid defaults to explicit behavior, because it's the most generally useful,
+but provides hooks that allow you to adapt the framework to localized aesthetic
+desires.
.. seealso::
@@ -744,9 +734,9 @@ aesthetic desires.
"Global" response object
~~~~~~~~~~~~~~~~~~~~~~~~
-"Constructing these response objects in my view callables is such a chore!
-And I'm way too lazy to register a response adapter, as per the prior
-section," you say. Fine. Be that way:
+"Constructing these response objects in my view callables is such a chore! And
+I'm way too lazy to register a response adapter, as per the prior section," you
+say. Fine. Be that way:
.. code-block:: python
:linenos:
@@ -765,13 +755,13 @@ Automating repetitive configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Does Pyramid's configurator allow you to do something, but you're a little
-adventurous and just want it a little less verbose? Or you'd like to offer
-up some handy configuration feature to other Pyramid users without requiring
-that we change Pyramid? You can extend Pyramid's :term:`Configurator` with
-your own directives. For example, let's say you find yourself calling
+adventurous and just want it a little less verbose? Or you'd like to offer up
+some handy configuration feature to other Pyramid users without requiring that
+we change Pyramid? You can extend Pyramid's :term:`Configurator` with your own
+directives. For example, let's say you find yourself calling
:meth:`pyramid.config.Configurator.add_view` repetitively. Usually you can
-take the boring away by using existing shortcuts, but let's say that this is
-a case where there is no such shortcut:
+take the boring away by using existing shortcuts, but let's say that this is a
+case where there is no such shortcut:
.. code-block:: python
:linenos:
@@ -817,7 +807,7 @@ the Configurator object:
Your previously repetitive configuration lines have now morphed into one line.
-You can share your configuration code with others this way too by packaging
+You can share your configuration code with others this way, too, by packaging
it up and calling :meth:`~pyramid.config.Configurator.add_directive` from
within a function called when another user uses the
:meth:`~pyramid.config.Configurator.include` method against your code.
@@ -826,7 +816,7 @@ within a function called when another user uses the
See also :ref:`add_directive`.
-Programmatic Introspection
+Programmatic introspection
~~~~~~~~~~~~~~~~~~~~~~~~~~
If you're building a large system that other users may plug code into, it's
@@ -836,8 +826,7 @@ at the top of the screen based on an enumeration of views they registered.
This is possible using Pyramid's :term:`introspector`.
-Here's an example of using Pyramid's introspector from within a view
-callable:
+Here's an example of using Pyramid's introspector from within a view callable:
.. code-block:: python
:linenos:
@@ -856,13 +845,13 @@ callable:
See also :ref:`using_introspection`.
-Python 3 Compatibility
+Python 3 compatibility
~~~~~~~~~~~~~~~~~~~~~~
Pyramid and most of its add-ons are Python 3 compatible. If you develop a
Pyramid application today, you won't need to worry that five years from now
-you'll be backwatered because there are language features you'd like to use
-but your framework doesn't support newer Python versions.
+you'll be backwatered because there are language features you'd like to use but
+your framework doesn't support newer Python versions.
Testing
~~~~~~~
@@ -871,11 +860,11 @@ Every release of Pyramid has 100% statement coverage via unit and integration
tests, as measured by the ``coverage`` tool available on PyPI. It also has
greater than 95% decision/condition coverage as measured by the
``instrumental`` tool available on PyPI. It is automatically tested by the
-Jenkins tool on Python 2.6, Python 2.7, Python 3.2 and PyPy after each commit
-to its GitHub repository. Official Pyramid add-ons are held to a similar
-testing standard. We still find bugs in Pyramid and its official add-ons,
-but we've noticed we find a lot more of them while working on other projects
-that don't have a good testing regime.
+Jenkins tool on Python 2.6, Python 2.7, Python 3.3, Python 3.4, Python 3.5,
+PyPy, and PyPy3 after each commit to its GitHub repository. Official Pyramid
+add-ons are held to a similar testing standard. We still find bugs in Pyramid
+and its official add-ons, but we've noticed we find a lot more of them while
+working on other projects that don't have a good testing regime.
Example: http://jenkins.pylonsproject.org/
@@ -883,29 +872,27 @@ Support
~~~~~~~
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
+question on IRC, on the Pylons-discuss mailing list, 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 official support channels. We try to keep it well-lit
-and new-user-friendly.
+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
irc.freenode.net in an IRC client) or the pylons-discuss maillist at
-http://groups.google.com/group/pylons-discuss/ .
+http://groups.google.com/group/pylons-discuss/.
Documentation
~~~~~~~~~~~~~
-It's a constant struggle, but we try to maintain a balance between
-completeness and new-user-friendliness in the official narrative Pyramid
-documentation (concrete suggestions for improvement are always appreciated,
-by the way). We also maintain a "cookbook" of recipes, which are usually
-demonstrations of common integration scenarios, too specific to add to the
-official narrative docs. In any case, the Pyramid documentation is
-comprehensive.
+It's a constant struggle, but we try to maintain a balance between completeness
+and new-user-friendliness in the official narrative Pyramid documentation
+(concrete suggestions for improvement are always appreciated, by the way). We
+also maintain a "cookbook" of recipes, which are usually demonstrations of
+common integration scenarios too specific to add to the official narrative
+docs. In any case, the Pyramid documentation is comprehensive.
-Example: The rest of this documentation and the cookbook at
-http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/ .
+Example: The :ref:`Pyramid Community Cookbook <cookbook:pyramid-cookbook>`.
.. index::
single: Pylons Project
@@ -929,34 +916,34 @@ includes details about how :app:`Pyramid` relates to the Pylons Project.
------------------------------------------
The first release of Pyramid's predecessor (named :mod:`repoze.bfg`) was made
-in July of 2008. At the end of 2010, we changed the name of
-:mod:`repoze.bfg` to :app:`Pyramid`. It was merged into the Pylons project
-as :app:`Pyramid` in November of that year.
+in July of 2008. At the end of 2010, we changed the name of :mod:`repoze.bfg`
+to :app:`Pyramid`. It was merged into the Pylons project as :app:`Pyramid` in
+November of that year.
-:app:`Pyramid` was inspired by :term:`Zope`, :term:`Pylons` (version
-1.0) and :term:`Django`. As a result, :app:`Pyramid` borrows several
-concepts and features from each, combining them into a unique web
-framework.
+:app:`Pyramid` was inspired by :term:`Zope`, :term:`Pylons` (version 1.0), and
+:term:`Django`. As a result, :app:`Pyramid` borrows several concepts and
+features from each, combining them into a unique web framework.
-Many features of :app:`Pyramid` trace their origins back to :term:`Zope`.
-Like Zope applications, :app:`Pyramid` applications can be easily extended:
-if you obey certain constraints, the application you produce can be reused,
-modified, re-integrated, or extended by third-party developers without
-forking the original application. The concepts of :term:`traversal` and
-declarative security in :app:`Pyramid` were pioneered first in Zope.
+Many features of :app:`Pyramid` trace their origins back to :term:`Zope`. Like
+Zope applications, :app:`Pyramid` applications can be easily extended. If you
+obey certain constraints, the application you produce can be reused, modified,
+re-integrated, or extended by third-party developers without forking the
+original application. The concepts of :term:`traversal` and declarative
+security in :app:`Pyramid` were pioneered first in Zope.
The :app:`Pyramid` concept of :term:`URL dispatch` is inspired by the
-:term:`Routes` system used by :term:`Pylons` version 1.0. Like Pylons
-version 1.0, :app:`Pyramid` is mostly policy-free. It makes no
-assertions about which database you should use, and its built-in
-templating facilities are included only for convenience. In essence,
-it only supplies a mechanism to map URLs to :term:`view` code, along
-with a set of conventions for calling those views. You are free to
-use third-party components that fit your needs in your applications.
-
-The concept of :term:`view` is used by :app:`Pyramid` mostly as it would be
-by Django. :app:`Pyramid` has a documentation culture more like Django's
-than like Zope's.
+:term:`Routes` system used by :term:`Pylons` version 1.0. Like Pylons version
+1.0, :app:`Pyramid` is mostly policy-free. It makes no assertions about which
+database you should use. Pyramid no longer has built-in templating facilities
+as of version 1.5a2, but instead officially supports bindings for templating
+languages, including Chameleon, Jinja2, and Mako. In essence, it only supplies
+a mechanism to map URLs to :term:`view` code, along with a set of conventions
+for calling those views. You are free to use third-party components that fit
+your needs in your applications.
+
+The concept of :term:`view` is used by :app:`Pyramid` mostly as it would be by
+Django. :app:`Pyramid` has a documentation culture more like Django's than
+like Zope's.
Like :term:`Pylons` version 1.0, but unlike :term:`Zope`, a :app:`Pyramid`
application developer may use completely imperative code to perform common
@@ -964,34 +951,34 @@ framework configuration tasks such as adding a view or a route. In Zope,
:term:`ZCML` is typically required for similar purposes. In :term:`Grok`, a
Zope-based web framework, :term:`decorator` objects and class-level
declarations are used for this purpose. Out of the box, Pyramid supports
-imperative and decorator-based configuration; :term:`ZCML` may be used via an
+imperative and decorator-based configuration. :term:`ZCML` may be used via an
add-on package named ``pyramid_zcml``.
-Also unlike :term:`Zope` and unlike other "full-stack" frameworks such
-as :term:`Django`, :app:`Pyramid` makes no assumptions about which
-persistence mechanisms you should use to build an application. Zope
-applications are typically reliant on :term:`ZODB`; :app:`Pyramid`
-allows you to build :term:`ZODB` applications, but it has no reliance
-on the ZODB software. Likewise, :term:`Django` tends to assume that
-you want to store your application's data in a relational database.
-:app:`Pyramid` makes no such assumption; it allows you to use a
-relational database but doesn't encourage or discourage the decision.
-
-Other Python web frameworks advertise themselves as members of a class
-of web frameworks named `model-view-controller
-<http://en.wikipedia.org/wiki/Model–view–controller>`_ frameworks.
-Insofar as this term has been claimed to represent a class of web
-frameworks, :app:`Pyramid` also generally fits into this class.
-
-.. sidebar:: You Say :app:`Pyramid` is MVC, But Where's The Controller?
-
- The :app:`Pyramid` authors believe that the MVC pattern just doesn't
- really fit the web very well. In a :app:`Pyramid` application, there is a
- resource tree, which represents the site structure, and views, which tend
- to present the data stored in the resource tree and a user-defined "domain
- model". However, no facility provided *by the framework* actually
- necessarily maps to the concept of a "controller" or "model". So if you
- had to give it some acronym, I guess you'd say :app:`Pyramid` is actually
- an "RV" framework rather than an "MVC" framework. "MVC", however, is
- close enough as a general classification moniker for purposes of
- comparison with other web frameworks.
+Also unlike :term:`Zope` and other "full-stack" frameworks such as
+:term:`Django`, :app:`Pyramid` makes no assumptions about which persistence
+mechanisms you should use to build an application. Zope applications are
+typically reliant on :term:`ZODB`. :app:`Pyramid` allows you to build
+:term:`ZODB` applications, but it has no reliance on the ZODB software.
+Likewise, :term:`Django` tends to assume that you want to store your
+application's data in a relational database. :app:`Pyramid` makes no such
+assumption, allowing you to use a relational database, and neither encouraging
+nor discouraging the decision.
+
+Other Python web frameworks advertise themselves as members of a class of web
+frameworks named `model-view-controller
+<http://en.wikipedia.org/wiki/Model–view–controller>`_ frameworks. Insofar as
+this term has been claimed to represent a class of web frameworks,
+:app:`Pyramid` also generally fits into this class.
+
+.. sidebar:: You Say :app:`Pyramid` is MVC, but Where's the Controller?
+
+ The :app:`Pyramid` authors believe that the MVC pattern just doesn't really
+ fit the web very well. In a :app:`Pyramid` application, there is a resource
+ tree which represents the site structure, and views which tend to present
+ the data stored in the resource tree and a user-defined "domain model".
+ However, no facility provided *by the framework* actually necessarily maps
+ to the concept of a "controller" or "model". So if you had to give it some
+ acronym, I guess you'd say :app:`Pyramid` is actually an "RV" framework
+ rather than an "MVC" framework. "MVC", however, is close enough as a
+ general classification moniker for purposes of comparison with other web
+ frameworks.
diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst
index a7bde4cf7..98315ac9f 100644
--- a/docs/narr/introspector.rst
+++ b/docs/narr/introspector.rst
@@ -20,8 +20,7 @@ configuration settings.
Using the Introspector
----------------------
-Here's an example of using Pyramid's introspector from within a view
-callable:
+Here's an example of using Pyramid's introspector from within a view callable:
.. code-block:: python
:linenos:
@@ -36,10 +35,10 @@ callable:
route_intr = introspector.get('routes', route_name)
return Response(str(route_intr['pattern']))
-This view will return a response that contains the "pattern" argument
-provided to the ``add_route`` method of the route which matched when the view
-was called. It uses the :meth:`pyramid.interfaces.IIntrospector.get` method
-to return an introspectable in the category ``routes`` with a
+This view will return a response that contains the "pattern" argument provided
+to the ``add_route`` method of the route which matched when the view was
+called. It uses the :meth:`pyramid.interfaces.IIntrospector.get` method to
+return an introspectable in the category ``routes`` with a
:term:`discriminator` equal to the matched route name. It then uses the
returned introspectable to obtain a "pattern" value.
@@ -56,9 +55,9 @@ can be used to query for introspectables.
Introspectable Objects
----------------------
-Introspectable objects are returned from query methods of an introspector.
-Each introspectable object implements the attributes and methods
-documented at :class:`pyramid.interfaces.IIntrospectable`.
+Introspectable objects are returned from query methods of an introspector. Each
+introspectable object implements the attributes and methods documented at
+:class:`pyramid.interfaces.IIntrospectable`.
The important attributes shared by all introspectables are the following:
@@ -74,12 +73,12 @@ The important attributes shared by all introspectables are the following:
``discriminator``
- A hashable object representing the unique value of this introspectable
- within its category.
+ A hashable object representing the unique value of this introspectable within
+ its category.
``discriminator_hash``
- The integer hash of the discriminator (useful for using in HTML links).
+ The integer hash of the discriminator (useful in HTML links).
``type_name``
@@ -90,8 +89,8 @@ The important attributes shared by all introspectables are the following:
``action_info``
- An object describing the directive call site which caused this
- introspectable to be registered; contains attributes described in
+ An object describing the directive call site which caused this introspectable
+ to be registered. It contains attributes described in
:class:`pyramid.interfaces.IActionInfo`.
Besides having the attributes described above, an introspectable is a
@@ -116,12 +115,12 @@ introspectables in categories not described here.
Each introspectable in the ``subscribers`` category represents a call to
:meth:`pyramid.config.Configurator.add_subscriber` (or the decorator
- equivalent); each will have the following data.
+ equivalent). Each will have the following data.
``subscriber``
The subscriber callable object (the resolution of the ``subscriber``
- argument passed to ``add_susbcriber``).
+ argument passed to ``add_subscriber``).
``interfaces``
@@ -137,19 +136,19 @@ 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``
Each introspectable in the ``response adapters`` category represents a call
to :meth:`pyramid.config.Configurator.add_response_adapter` (or a decorator
- equivalent); each will have the following data.
+ equivalent). Each will have the following data.
``adapter``
@@ -158,15 +157,14 @@ introspectables in categories not described here.
``type``
- The resolved ``type_or_iface`` argument passed to
- ``add_response_adapter``.
+ The resolved ``type_or_iface`` argument passed to ``add_response_adapter``.
``root factories``
Each introspectable in the ``root factories`` category represents a call to
:meth:`pyramid.config.Configurator.set_root_factory` (or the Configurator
constructor equivalent) *or* a ``factory`` argument passed to
- :meth:`pyramid.config.Configurator.add_route`; each will have the following
+ :meth:`pyramid.config.Configurator.add_route`. Each will have the following
data.
``factory``
@@ -184,7 +182,7 @@ introspectables in categories not described here.
Only one introspectable will exist in the ``session factory`` category. It
represents a call to :meth:`pyramid.config.Configurator.set_session_factory`
- (or the Configurator constructor equivalent); it will have the following
+ (or the Configurator constructor equivalent). It will have the following
data.
``factory``
@@ -196,7 +194,7 @@ introspectables in categories not described here.
Only one introspectable will exist in the ``request factory`` category. It
represents a call to :meth:`pyramid.config.Configurator.set_request_factory`
- (or the Configurator constructor equivalent); it will have the following
+ (or the Configurator constructor equivalent). It will have the following
data.
``factory``
@@ -206,10 +204,10 @@ introspectables in categories not described here.
``locale negotiator``
- Only one introspectable will exist in the ``locale negotiator`` category.
- It represents a call to
+ Only one introspectable will exist in the ``locale negotiator`` category. It
+ represents a call to
:meth:`pyramid.config.Configurator.set_locale_negotiator` (or the
- Configurator constructor equivalent); it will have the following data.
+ Configurator constructor equivalent). It will have the following data.
``negotiator``
@@ -218,9 +216,9 @@ introspectables in categories not described here.
``renderer factories``
- Each introspectable in the ``renderer factories`` category represents a
- call to :meth:`pyramid.config.Configurator.add_renderer` (or the
- Configurator constructor equivalent); each will have the following data.
+ Each introspectable in the ``renderer factories`` category represents a call
+ to :meth:`pyramid.config.Configurator.add_renderer` (or the Configurator
+ constructor equivalent). Each will have the following data.
``name``
@@ -229,13 +227,12 @@ introspectables in categories not described here.
``factory``
- The factory object (the resolved ``factory`` argument to
- ``add_renderer``).
+ The factory object (the resolved ``factory`` argument to ``add_renderer``).
``routes``
Each introspectable in the ``routes`` category represents a call to
- :meth:`pyramid.config.Configurator.add_route`; each will have the following
+ :meth:`pyramid.config.Configurator.add_route`. Each will have the following
data.
``name``
@@ -310,7 +307,7 @@ introspectables in categories not described here.
There will be one and only one introspectable in the ``authentication
policy`` category. It represents a call to the
:meth:`pyramid.config.Configurator.set_authentication_policy` method (or
- its Configurator constructor equivalent); it will have the following data.
+ its Configurator constructor equivalent). It will have the following data.
``policy``
@@ -319,10 +316,10 @@ introspectables in categories not described here.
``authorization policy``
- There will be one and only one introspectable in the ``authorization
- policy`` category. It represents a call to the
+ There will be one and only one introspectable in the ``authorization policy``
+ category. It represents a call to the
:meth:`pyramid.config.Configurator.set_authorization_policy` method (or its
- Configurator constructor equivalent); it will have the following data.
+ Configurator constructor equivalent). It will have the following data.
``policy``
@@ -334,7 +331,7 @@ introspectables in categories not described here.
There will be one and only one introspectable in the ``default permission``
category. It represents a call to the
:meth:`pyramid.config.Configurator.set_default_permission` method (or its
- Configurator constructor equivalent); it will have the following data.
+ Configurator constructor equivalent). It will have the following data.
``value``
@@ -343,7 +340,7 @@ introspectables in categories not described here.
``views``
Each introspectable in the ``views`` category represents a call to
- :meth:`pyramid.config.Configurator.add_view`; each will have the following
+ :meth:`pyramid.config.Configurator.add_view`. Each will have the following
data.
``name``
@@ -423,8 +420,8 @@ introspectables in categories not described here.
Each introspectable in the ``permissions`` category represents a call to
:meth:`pyramid.config.Configurator.add_view` that has an explicit
- ``permission`` argument to *or* a call to
- :meth:`pyramid.config.Configurator.set_default_permission`; each will have
+ ``permission`` argument *or* a call to
+ :meth:`pyramid.config.Configurator.set_default_permission`. Each will have
the following data.
``value``
@@ -435,7 +432,7 @@ introspectables in categories not described here.
Each introspectable in the ``templates`` category represents a call to
:meth:`pyramid.config.Configurator.add_view` that has a ``renderer``
- argument which points to a template; each will have the following data.
+ argument which points to a template. Each will have the following data.
``name``
@@ -447,15 +444,15 @@ introspectables in categories not described here.
``renderer``
- The :class:`pyramid.interfaces.IRendererInfo` object which represents
- this template's renderer.
+ 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
- :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
+ Each introspectable in the ``view mappers`` category represents a call to
+ :meth:`pyramid.config.Configurator.add_view` that has an explicit ``mapper``
+ argument *or* a call to
+ :meth:`pyramid.config.Configurator.set_view_mapper`. Each will have
the following data.
``mapper``
@@ -465,14 +462,13 @@ introspectables in categories not described here.
``asset overrides``
- Each introspectable in the ``asset overrides`` category represents a call
- to :meth:`pyramid.config.Configurator.override_asset`; each will have the
+ Each introspectable in the ``asset overrides`` category represents a call to
+ :meth:`pyramid.config.Configurator.override_asset`. Each will have the
following data.
``to_override``
- The ``to_override`` argument (an asset spec) passed to
- ``override_asset``.
+ The ``to_override`` argument (an asset spec) passed to ``override_asset``.
``override_with``
@@ -481,10 +477,10 @@ introspectables in categories not described here.
``translation directories``
- Each introspectable in the ``asset overrides`` category represents an
+ 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.
+ :meth:`pyramid.config.Configurator.add_translation_dirs`. Each will have the
+ following data.
``directory``
@@ -497,13 +493,13 @@ introspectables in categories not described here.
``tweens``
Each introspectable in the ``tweens`` category represents a call to
- :meth:`pyramid.config.Configurator.add_tween`; each will have the following
+ :meth:`pyramid.config.Configurator.add_tween`. Each will have the following
data.
``name``
- The dotted name to the tween factory as a string (passed as
- the ``tween_factory`` argument to ``add_tween``).
+ The dotted name to the tween factory as a string (passed as the
+ ``tween_factory`` argument to ``add_tween``).
``factory``
@@ -511,7 +507,7 @@ introspectables in categories not described here.
``type``
- ``implict`` or ``explicit`` as a string.
+ ``implicit`` or ``explicit`` as a string.
``under``
@@ -524,7 +520,7 @@ introspectables in categories not described here.
``static views``
Each introspectable in the ``static views`` category represents a call to
- :meth:`pyramid.config.Configurator.add_static_view`; each will have the
+ :meth:`pyramid.config.Configurator.add_static_view`. Each will have the
following data.
``name``
@@ -539,13 +535,13 @@ introspectables in categories not described here.
``traversers``
Each introspectable in the ``traversers`` category represents a call to
- :meth:`pyramid.config.Configurator.add_traverser`; each will have the
+ :meth:`pyramid.config.Configurator.add_traverser`. Each will have the
following data.
``iface``
The (resolved) interface or class object that represents the return value
- of a root factory that this traverser will be used for.
+ of a root factory for which this traverser will be used.
``adapter``
@@ -554,7 +550,7 @@ introspectables in categories not described here.
``resource url adapters``
Each introspectable in the ``resource url adapters`` category represents a
- call to :meth:`pyramid.config.Configurator.add_resource_url_adapter`; each
+ call to :meth:`pyramid.config.Configurator.add_resource_url_adapter`. Each
will have the following data.
``adapter``
@@ -564,19 +560,20 @@ introspectables in categories not described here.
``resource_iface``
The (resolved) interface or class object that represents the resource
- interface that this url adapter is registered for.
+ interface for which this URL adapter is registered.
``request_iface``
The (resolved) interface or class object that represents the request
- interface that this url adapter is registered for.
+ interface for which this URL adapter is registered.
Introspection in the Toolbar
----------------------------
The Pyramid debug toolbar (part of the ``pyramid_debugtoolbar`` package)
provides a canned view of all registered introspectables and their
-relationships. It looks something like this:
+relationships. It is currently under the "Global" tab in the main navigation,
+and it looks something like this:
.. image:: tb_introspector.png
diff --git a/docs/narr/logging.rst b/docs/narr/logging.rst
index 75428d513..9c6e8a319 100644
--- a/docs/narr/logging.rst
+++ b/docs/narr/logging.rst
@@ -4,47 +4,51 @@ Logging
=======
:app:`Pyramid` allows you to make use of the Python standard library
-:mod:`logging` module. This chapter describes how to configure logging and
-how to send log messages to loggers that you've configured.
+:mod:`logging` module. This chapter describes how to configure logging and how
+to send log messages to loggers that you've configured.
.. warning::
- This chapter assumes you've used a :term:`scaffold` to create a
- project which contains ``development.ini`` and ``production.ini`` files
- which help configure logging. All of the scaffolds which ship along with
- :app:`Pyramid` do this. If you're not using a scaffold, or if you've used
- a third-party scaffold which does not create these files, the
- configuration information in this chapter may not be applicable.
+ This chapter assumes you've used a :term:`scaffold` to create a project
+ which contains ``development.ini`` and ``production.ini`` files which help
+ configure logging. All of the scaffolds which ship with :app:`Pyramid` do
+ this. If you're not using a scaffold, or if you've used a third-party
+ scaffold which does not create these files, the configuration information in
+ this chapter may not be applicable.
+
+.. index:
+ pair: settings; logging
+ pair: .ini; logging
+ pair: logging; configuration
.. _logging_config:
Logging Configuration
---------------------
-A :app:`Pyramid` project created from a :term:`scaffold` is configured to
-allow you to send messages to :mod:`Python standard library logging package
-<logging>` loggers from within your
-application. In particular, the :term:`PasteDeploy` ``development.ini`` and
-``production.ini`` files created when you use a scaffold include a basic
-configuration for the Python :mod:`logging` package.
+A :app:`Pyramid` project created from a :term:`scaffold` is configured to allow
+you to send messages to :mod:`Python standard library logging package
+<logging>` loggers from within your application. In particular, the
+:term:`PasteDeploy` ``development.ini`` and ``production.ini`` files created
+when you use a scaffold include a basic configuration for the Python
+:mod:`logging` package.
PasteDeploy ``.ini`` files use the Python standard library :mod:`ConfigParser
-format <ConfigParser>`; this is the same format used as the Python
+format <ConfigParser>`. This is the same format used as the Python
:ref:`logging module's Configuration file format <logging-config-fileformat>`.
The application-related and logging-related sections in the configuration file
can coexist peacefully, and the logging-related sections in the file are used
from when you run ``pserve``.
-The ``pserve`` command calls the :func:`pyramid.paster.setup_logging`
-function, a thin wrapper around the :func:`logging.config.fileConfig`
-using the specified ``.ini`` file if it contains a ``[loggers]`` section
-(all of the scaffold-generated ``.ini`` files do). ``setup_logging`` reads the
-logging configuration from the ini file upon which ``pserve`` was
-invoked.
+The ``pserve`` command calls the :func:`pyramid.paster.setup_logging` function,
+a thin wrapper around the :func:`logging.config.fileConfig` using the specified
+``.ini`` file, if it contains a ``[loggers]`` section (all of the
+scaffold-generated ``.ini`` files do). ``setup_logging`` reads the logging
+configuration from the ini file upon which ``pserve`` was invoked.
Default logging configuration is provided in both the default
-``development.ini`` and the ``production.ini`` file. The logging
-configuration in the ``development.ini`` file is as follows:
+``development.ini`` and the ``production.ini`` file. The logging configuration
+in the ``development.ini`` file is as follows:
.. code-block:: ini
:linenos:
@@ -130,46 +134,44 @@ The logging configuration will literally be:
In this logging configuration:
-- a logger named ``root`` is created that logs messages at a level above
- or equal to the ``INFO`` level to stderr, with the following format:
+- a logger named ``root`` is created that logs messages at a level above or
+ equal to the ``INFO`` level to stderr, with the following format:
- .. code-block:: text
+ .. code-block:: text
- 2007-08-17 15:04:08,704 INFO [packagename]
- Loading resource, id: 86
+ 2007-08-17 15:04:08,704 INFO [packagename] Loading resource, id: 86
- a logger named ``myapp`` is configured that logs messages sent at a level
- above or equal to ``DEBUG`` to stderr in the same format as the root
- logger.
+ above or equal to ``DEBUG`` to stderr in the same format as the root logger.
The ``root`` logger will be used by all applications in the Pyramid process
-that ask for a logger (via ``logging.getLogger``) that has a name which
-begins with anything except your project's package name (e.g. ``myapp``).
-The logger with the same name as your package name is reserved for your own
-usage in your Pyramid application. Its existence means that you can log to a
-known logging location from any Pyramid application generated via a scaffold.
-
-Pyramid and many other libraries (such as Beaker, SQLAlchemy, Paste) log a
-number of messages to the root logger for debugging purposes. Switching the
+that ask for a logger (via ``logging.getLogger``) that has a name which begins
+with anything except your project's package name (e.g., ``myapp``). The logger
+with the same name as your package name is reserved for your own usage in your
+:app:`Pyramid` application. Its existence means that you can log to a known
+logging location from any :app:`Pyramid` application generated via a scaffold.
+
+:app:`Pyramid` and many other libraries (such as Beaker, SQLAlchemy, Paste) log
+a number of messages to the root logger for debugging purposes. Switching the
root logger level to ``DEBUG`` reveals them:
-.. code-block:: ini
+.. code-block:: ini
- [logger_root]
- #level = INFO
- level = DEBUG
- handlers = console
+ [logger_root]
+ #level = INFO
+ level = DEBUG
+ handlers = console
-Some scaffolds configure additional loggers for additional subsystems they
-use (such as SQLALchemy). Take a look at the ``production.ini`` and
+Some scaffolds configure additional loggers for additional subsystems they use
+(such as SQLALchemy). Take a look at the ``production.ini`` and
``development.ini`` files rendered when you create a project from a scaffold.
Sending Logging Messages
------------------------
Python's special ``__name__`` variable refers to the current module's fully
-qualified name. From any module in a package named ``myapp``, the
-``__name__`` builtin variable will always be something like ``myapp``, or
+qualified name. From any module in a package named ``myapp``, the ``__name__``
+builtin variable will always be something like ``myapp``, or
``myapp.subpackage`` or ``myapp.package.subpackage`` if your project is named
``myapp``. Sending a message to this logger will send it to the ``myapp``
logger.
@@ -178,153 +180,163 @@ To log messages to the package-specific logger configured in your ``.ini``
file, simply create a logger object using the ``__name__`` builtin and call
methods on it.
-.. code-block:: python
+.. code-block:: python
:linenos:
- import logging
- log = logging.getLogger(__name__)
+ import logging
+ log = logging.getLogger(__name__)
def myview(request):
- content_type = 'text/plain'
- content = 'Hello World!'
- log.debug('Returning: %s (content-type: %s)', content, content_type)
- request.response.content_type = content_type
+ content_type = 'text/plain'
+ content = 'Hello World!'
+ log.debug('Returning: %s (content-type: %s)', content, content_type)
+ request.response.content_type = content_type
return request.response
-This will result in the following printed to the console, on ``stderr``:
+This will result in the following printed to the console, on ``stderr``:
-.. code-block:: text
+.. code-block:: text
16:20:20,440 DEBUG [myapp.views] Returning: Hello World!
- (content-type: text/plain)
+ (content-type: text/plain)
Filtering log messages
----------------------
-Often there's too much log output to sift through, such as when switching
-the root logger's level to ``DEBUG``.
+Often there's too much log output to sift through, such as when switching the
+root logger's level to ``DEBUG``.
-An example: you're diagnosing database connection issues in your application
+For example, you're diagnosing database connection issues in your application
and only want to see SQLAlchemy's ``DEBUG`` messages in relation to database
connection pooling. You can leave the root logger's level at the less verbose
``INFO`` level and set that particular SQLAlchemy logger to ``DEBUG`` on its
own, apart from the root logger:
-.. code-block:: ini
+.. code-block:: ini
- [logger_sqlalchemy.pool]
- level = DEBUG
- handlers =
- qualname = sqlalchemy.pool
+ [logger_sqlalchemy.pool]
+ level = DEBUG
+ handlers =
+ qualname = sqlalchemy.pool
-then add it to the list of loggers:
+then add it to the list of loggers:
-.. code-block:: ini
+.. code-block:: ini
- [loggers]
- keys = root, myapp, sqlalchemy.pool
+ [loggers]
+ keys = root, myapp, sqlalchemy.pool
-No handlers need to be configured for this logger as by default non root
-loggers will propagate their log records up to their parent logger's
-handlers. The root logger is the top level parent of all loggers.
+No handlers need to be configured for this logger as by default non-root
+loggers will propagate their log records up to their parent logger's handlers.
+The root logger is the top level parent of all loggers.
This technique is used in the default ``development.ini``. The root logger's
level is set to ``INFO``, whereas the application's log level is set to
``DEBUG``:
-.. code-block:: ini
+.. code-block:: ini
- # Begin logging configuration
+ # Begin logging configuration
- [loggers]
+ [loggers]
keys = root, myapp
- [logger_myapp]
- level = DEBUG
- handlers =
- qualname = helloworld
+ [logger_myapp]
+ level = DEBUG
+ handlers =
+ qualname = myapp
All of the child loggers of the ``myapp`` logger will inherit the ``DEBUG``
level unless they're explicitly set differently. Meaning the ``myapp.views``,
-``myapp.models`` (and all your app's modules') loggers by default have an
+``myapp.models``, and all your app's modules' loggers by default have an
effective level of ``DEBUG`` too.
-For more advanced filtering, the logging module provides a `Filter
-<http://docs.python.org/lib/node423.html>`_ object; however it cannot be used
-directly from the configuration file.
+For more advanced filtering, the logging module provides a
+:class:`logging.Filter` object; however it cannot be used directly from the
+configuration file.
-Advanced Configuration
+Advanced Configuration
----------------------
-To capture log output to a separate file, use a `FileHandler
-<http://docs.python.org/lib/node412.html>`_ (or a `RotatingFileHandler
-<http://docs.python.org/lib/node413.html>`_):
+To capture log output to a separate file, use :class:`logging.FileHandler` (or
+:class:`logging.handlers.RotatingFileHandler`):
-.. code-block:: ini
+.. code-block:: ini
- [handler_filelog]
- class = FileHandler
- args = ('%(here)s/myapp.log','a')
- level = INFO
- formatter = generic
+ [handler_filelog]
+ class = FileHandler
+ args = ('%(here)s/myapp.log','a')
+ level = INFO
+ formatter = generic
-Before it's recognized, it needs to be added to the list of handlers:
+Before it's recognized, it needs to be added to the list of handlers:
-.. code-block:: ini
+.. code-block:: ini
- [handlers]
+ [handlers]
keys = console, myapp, filelog
-and finally utilized by a logger.
+and finally utilized by a logger.
-.. code-block:: ini
+.. code-block:: ini
- [logger_root]
- level = INFO
+ [logger_root]
+ level = INFO
handlers = console, filelog
-These final 3 lines of configuration directs all of the root logger's output
+These final three lines of configuration direct all of the root logger's output
to the ``myapp.log`` as well as the console.
Logging Exceptions
------------------
-To log (or email) exceptions generated by your :app:`Pyramid` application,
-use the :term:`pyramid_exclog` package. Details about its configuration are
-in its `documentation
-<http://docs.pylonsproject.org/projects/pyramid_exclog/dev/>`_.
+To log or email exceptions generated by your :app:`Pyramid` application, use
+the :term:`pyramid_exclog` package. Details about its configuration are in its
+`documentation <http://docs.pylonsproject.org/projects/pyramid_exclog/dev/>`_.
+
+.. index::
+ single: TransLogger
+ single: middleware; TransLogger
+ pair: configuration; middleware
+ single: settings; middleware
+ pair: .ini; middleware
-Request Logging with Paste's TransLogger
+.. _request_logging_with_pastes_translogger:
+
+Request Logging with Paste's TransLogger
----------------------------------------
-Paste provides the `TransLogger
-<http://pythonpaste.org/modules/translogger.html>`_ :term:`middleware` for
-logging requests using the `Apache Combined Log Format
-<http://httpd.apache.org/docs/2.2/logs.html#combined>`_. TransLogger combined
-with a FileHandler can be used to create an ``access.log`` file similar to
-Apache's.
+The :term:`WSGI` design is modular. Waitress logs error conditions, debugging
+output, etc., but not web traffic. For web traffic logging, Paste provides the
+`TransLogger <http://pythonpaste.org/modules/translogger.html>`_
+:term:`middleware`. TransLogger produces logs in the `Apache Combined Log
+Format <http://httpd.apache.org/docs/2.2/logs.html#combined>`_. But
+TransLogger does not write to files; the Python logging system must be
+configured to do this. The Python :class:`logging.FileHandler` logging handler
+can be used alongside TransLogger to create an ``access.log`` file similar to
+Apache's.
Like any standard :term:`middleware` with a Paste entry point, TransLogger can
-be configured to wrap your application using ``.ini`` file syntax. First,
+be configured to wrap your application using ``.ini`` file syntax. First
rename your Pyramid ``.ini`` file's ``[app:main]`` section to
-``[app:mypyramidapp]``, then add a ``[filter:translogger]`` section, then use
-a ``[pipeline:main]`` section file to form a WSGI pipeline with both the
+``[app:mypyramidapp]``, then add a ``[filter:translogger]`` section, then use a
+``[pipeline:main]`` section file to form a WSGI pipeline with both the
translogger and your application in it. For instance, change from this:
-.. code-block:: ini
+.. code-block:: ini
[app:main]
use = egg:MyProject
To this:
-.. code-block:: ini
+.. code-block:: ini
[app:mypyramidapp]
use = egg:MyProject
- [filter:translogger]
- use = egg:Paste#translogger
+ [filter:translogger]
+ use = egg:Paste#translogger
setup_console_handler = False
[pipeline:main]
@@ -335,39 +347,40 @@ Using PasteDeploy this way to form and serve a pipeline is equivalent to
wrapping your app in a TransLogger instance via the bottom of the ``main``
function of your project's ``__init__`` file:
-.. code-block:: python
+.. code-block:: python
...
app = config.make_wsgi_app()
- from paste.translogger import TransLogger
- app = TransLogger(app, setup_console_handler=False)
- return app
+ from paste.translogger import TransLogger
+ app = TransLogger(app, setup_console_handler=False)
+ return app
-TransLogger will automatically setup a logging handler to the console when
-called with no arguments, so it 'just works' in environments that don't
-configure logging. Since we've configured our own logging handlers, we need
-to disable that option via ``setup_console_handler = False``.
+.. note::
+ TransLogger will automatically setup a logging handler to the console when
+ called with no arguments, so it "just works" in environments that don't
+ configure logging. Since our logging handlers are configured, we disable
+ the automation via ``setup_console_handler = False``.
With the filter in place, TransLogger's logger (named the ``wsgi`` logger) will
-propagate its log messages to the parent logger (the root logger), sending
-its output to the console when we request a page:
+propagate its log messages to the parent logger (the root logger), sending its
+output to the console when we request a page:
-.. code-block:: text
+.. code-block:: text
00:50:53,694 INFO [myapp.views] Returning: Hello World!
- (content-type: text/plain)
+ (content-type: text/plain)
00:50:53,695 INFO [wsgi] 192.168.1.111 - - [11/Aug/2011:20:09:33 -0700] "GET /hello
- HTTP/1.1" 404 - "-"
+ HTTP/1.1" 404 - "-"
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725
- Firefox/2.0.0.6"
+ Firefox/2.0.0.6"
-To direct TransLogger to an ``access.log`` FileHandler, we need to add that
-FileHandler to the list of handlers (named ``accesslog``), and ensure that the
-``wsgi`` logger is configured and uses this handler accordingly:
+To direct TransLogger to an ``access.log`` FileHandler, we need the following
+to add a FileHandler (named ``accesslog``) to the list of handlers, and ensure
+that the ``wsgi`` logger is configured and uses this handler accordingly:
-.. code-block:: ini
+.. code-block:: ini
- # Begin logging configuration
+ # Begin logging configuration
[loggers]
keys = root, myapp, wsgi
@@ -375,42 +388,43 @@ FileHandler to the list of handlers (named ``accesslog``), and ensure that the
[handlers]
keys = console, accesslog
- [logger_wsgi]
- level = INFO
- handlers = handler_accesslog
- qualname = wsgi
- propagate = 0
-
- [handler_accesslog]
- class = FileHandler
- args = ('%(here)s/access.log','a')
- level = INFO
- formatter = generic
-
-As mentioned above, non-root loggers by default propagate their log records
-to the root logger's handlers (currently the console handler). Setting
-``propagate`` to ``0`` (``False``) here disables this; so the ``wsgi`` logger
+ [logger_wsgi]
+ level = INFO
+ handlers = accesslog
+ qualname = wsgi
+ propagate = 0
+
+ [handler_accesslog]
+ class = FileHandler
+ args = ('%(here)s/access.log','a')
+ level = INFO
+ formatter = generic
+
+As mentioned above, non-root loggers by default propagate their log records to
+the root logger's handlers (currently the console handler). Setting
+``propagate`` to ``0`` (``False``) here disables this; so the ``wsgi`` logger
directs its records only to the ``accesslog`` handler.
Finally, there's no need to use the ``generic`` formatter with TransLogger as
-TransLogger itself provides all the information we need. We'll use a
-formatter that passes-through the log messages as is. Add a new formatter
-called ``accesslog`` by include the following in your configuration file:
+TransLogger itself provides all the information we need. We'll use a formatter
+that passes through the log messages as is. Add a new formatter called
+``accesslog`` by including the following in your configuration file:
-.. code-block:: ini
+.. code-block:: ini
- [formatters]
- keys = generic, accesslog
+ [formatters]
+ keys = generic, accesslog
- [formatter_accesslog]
- format = %(message)s
+ [formatter_accesslog]
+ format = %(message)s
-Then wire this new ``accesslog`` formatter into the FileHandler:
+Finally alter the existing configuration to wire this new ``accesslog``
+formatter into the FileHandler:
-.. code-block:: ini
+.. code-block:: ini
- [handler_accesslog]
- class = FileHandler
- args = ('%(here)s/access.log','a')
- level = INFO
- formatter = accesslog
+ [handler_accesslog]
+ class = FileHandler
+ args = ('%(here)s/access.log','a')
+ level = INFO
+ formatter = accesslog
diff --git a/docs/narr/muchadoabouttraversal.rst b/docs/narr/muchadoabouttraversal.rst
index 483b1bb16..3e00a295a 100644
--- a/docs/narr/muchadoabouttraversal.rst
+++ b/docs/narr/muchadoabouttraversal.rst
@@ -4,44 +4,44 @@
Much Ado About Traversal
========================
-(Or, why you should care about it)
+(Or, why you should care about it.)
.. note::
- This chapter was adapted, with permission, from a blog post by `Rob
- Miller <http://blog.nonsequitarian.org/>`_, originally published at
- http://blog.nonsequitarian.org/2010/much-ado-about-traversal/ .
+ This chapter was adapted, with permission, from a blog post by `Rob Miller
+ <http://blog.nonsequitarian.org/>`_, originally published at
+ http://blog.nonsequitarian.org/2010/much-ado-about-traversal/.
-Traversal is an alternative to :term:`URL dispatch` which allows
-:app:`Pyramid` applications to map URLs to code.
+Traversal is an alternative to :term:`URL dispatch` which allows :app:`Pyramid`
+applications to map URLs to code.
.. note::
Ex-Zope users who are already familiar with traversal and view lookup
conceptually may want to skip directly to the :ref:`traversal_chapter`
- chapter, which discusses technical details. This chapter is mostly aimed
- at people who have previous :term:`Pylons` experience or experience in
- another framework which does not provide traversal, and need an
- introduction to the "why" of traversal.
+ chapter, which discusses technical details. This chapter is mostly aimed at
+ people who have previous :term:`Pylons` experience or experience in another
+ framework which does not provide traversal, and need an introduction to the
+ "why" of traversal.
Some folks who have been using Pylons and its Routes-based URL matching for a
long time are being exposed for the first time, via :app:`Pyramid`, to new
ideas such as ":term:`traversal`" and ":term:`view lookup`" as a way to route
incoming HTTP requests to callable code. Some of the same folks believe that
-traversal is hard to understand. Others question its usefulness; URL
-matching has worked for them so far, why should they even consider dealing
-with another approach, one which doesn't fit their brain and which doesn't
-provide any immediately obvious value?
+traversal is hard to understand. Others question its usefulness; URL matching
+has worked for them so far, so why should they even consider dealing with
+another approach, one which doesn't fit their brain and which doesn't provide
+any immediately obvious value?
You can be assured that if you don't want to understand traversal, you don't
have to. You can happily build :app:`Pyramid` applications with only
-:term:`URL dispatch`. However, there are some straightforward, real-world
-use cases that are much more easily served by a traversal-based approach than
-by a pattern-matching mechanism. Even if you haven't yet hit one of these
-use cases yourself, understanding these new ideas is worth the effort for any
-web developer so you know when you might want to use them. :term:`Traversal`
-is actually a straightforward metaphor easily comprehended by anyone who's
-ever used a run-of-the-mill file system with folders and files.
+:term:`URL dispatch`. However, there are some straightforward, real-world use
+cases that are much more easily served by a traversal-based approach than by a
+pattern-matching mechanism. Even if you haven't yet hit one of these use cases
+yourself, understanding these new ideas is worth the effort for any web
+developer so you know when you might want to use them. :term:`Traversal` is
+actually a straightforward metaphor easily comprehended by anyone who's ever
+used a run-of-the-mill file system with folders and files.
.. index::
single: URL dispatch
@@ -49,34 +49,33 @@ ever used a run-of-the-mill file system with folders and files.
URL Dispatch
------------
-Let's step back and consider the problem we're trying to solve. An
-HTTP request for a particular path has been routed to our web
-application. The requested path will possibly invoke a specific
-:term:`view callable` function defined somewhere in our app. We're
-trying to determine *which* callable function, if any, should be
-invoked for a given requested URL.
+Let's step back and consider the problem we're trying to solve. An HTTP
+request for a particular path has been routed to our web application. The
+requested path will possibly invoke a specific :term:`view callable` function
+defined somewhere in our app. We're trying to determine *which* callable
+function, if any, should be invoked for a given requested URL.
Many systems, including Pyramid, offer a simple solution. They offer the
-concept of "URL matching". URL matching approaches this problem by parsing
-the URL path and comparing the results to a set of registered "patterns",
-defined by a set of regular expressions, or some other URL path templating
-syntax. Each pattern is mapped to a callable function somewhere; if the
-request path matches a specific pattern, the associated function is called.
-If the request path matches more than one pattern, some conflict resolution
-scheme is used, usually a simple order precedence so that the first match
-will take priority over any subsequent matches. If a request path doesn't
-match any of the defined patterns, a "404 Not Found" response is returned.
-
-In Pyramid, we offer an implementation of URL matching which we call
-:term:`URL dispatch`. Using :app:`Pyramid` syntax, we might have a match
-pattern such as ``/{userid}/photos/{photoid}``, mapped to a ``photo_view()``
-function defined somewhere in our code. Then a request for a path such as
+concept of "URL matching". URL matching approaches this problem by parsing the
+URL path and comparing the results to a set of registered "patterns", defined
+by a set of regular expressions or some other URL path templating syntax. Each
+pattern is mapped to a callable function somewhere; if the request path matches
+a specific pattern, the associated function is called. If the request path
+matches more than one pattern, some conflict resolution scheme is used, usually
+a simple order precedence so that the first match will take priority over any
+subsequent matches. If a request path doesn't match any of the defined
+patterns, a "404 Not Found" response is returned.
+
+In Pyramid, we offer an implementation of URL matching which we call :term:`URL
+dispatch`. Using :app:`Pyramid` syntax, we might have a match pattern such as
+``/{userid}/photos/{photoid}``, mapped to a ``photo_view()`` function defined
+somewhere in our code. Then a request for a path such as
``/joeschmoe/photos/photo1`` would be a match, and the ``photo_view()``
function would be invoked to handle the request. Similarly,
-``/{userid}/blog/{year}/{month}/{postid}`` might map to a
-``blog_post_view()`` function, so ``/joeschmoe/blog/2010/12/urlmatching``
-would trigger the function, which presumably would know how to find and
-render the ``urlmatching`` blog post.
+``/{userid}/blog/{year}/{month}/{postid}`` might map to a ``blog_post_view()``
+function, so ``/joeschmoe/blog/2010/12/urlmatching`` would trigger the
+function, which presumably would know how to find and render the
+``urlmatching`` blog post.
Historical Refresher
--------------------
@@ -88,65 +87,64 @@ time when we didn't have fancy web frameworks like :term:`Pylons` and
:app:`Pyramid`. Instead, we had general purpose HTTP servers that primarily
served files off of a file system. The "root" of a given site mapped to a
particular folder somewhere on the file system. Each segment of the request
-URL path represented a subdirectory. The final path segment would be either
-a directory or a file, and once the server found the right file it would
-package it up in an HTTP response and send it back to the client. So serving
-up a request for ``/joeschmoe/photos/photo1`` literally meant that there was
-a ``joeschmoe`` folder somewhere, which contained a ``photos`` folder, which
-in turn contained a ``photo1`` file. If at any point along the way we find
-that there is not a folder or file matching the requested path, we return a
-404 response.
+URL path represented a subdirectory. The final path segment would be either a
+directory or a file, and once the server found the right file it would package
+it up in an HTTP response and send it back to the client. So serving up a
+request for ``/joeschmoe/photos/photo1`` literally meant that there was a
+``joeschmoe`` folder somewhere, which contained a ``photos`` folder, which in
+turn contained a ``photo1`` file. If at any point along the way we find that
+there is not a folder or file matching the requested path, we return a 404
+response.
As the web grew more dynamic, however, a little bit of extra complexity was
-added. Technologies such as CGI and HTTP server modules were developed.
-Files were still looked up on the file system, but if the file ended with
-(for example) ``.cgi`` or ``.php``, or if it lived in a special folder,
-instead of simply sending the file to the client the server would read the
-file, execute it using an interpreter of some sort, and then send the output
-from this process to the client as the final result. The server
-configuration specified which files would trigger some dynamic code, with the
-default case being to just serve the static file.
+added. Technologies such as CGI and HTTP server modules were developed. Files
+were still looked up on the file system, but if the file ended with (for
+example) ``.cgi`` or ``.php``, or if it lived in a special folder, instead of
+simply sending the file to the client the server would read the file, execute
+it using an interpreter of some sort, and then send the output from this
+process to the client as the final result. The server configuration specified
+which files would trigger some dynamic code, with the default case being to
+just serve the static file.
.. index::
single: traversal
-Traversal (aka Resource Location)
----------------------------------
+Traversal (a.k.a., Resource Location)
+-------------------------------------
Believe it or not, if you understand how serving files from a file system
works, you understand traversal. And if you understand that a server might do
-something different based on what type of file a given request specifies,
-then you understand view lookup.
+something different based on what type of file a given request specifies, then
+you understand view lookup.
The major difference between file system lookup and traversal is that a file
-system lookup steps through nested directories and files in a file system
-tree, while traversal steps through nested dictionary-type objects in a
-:term:`resource tree`. Let's take a detailed look at one of our example
-paths, so we can see what I mean:
-
-The path ``/joeschmoe/photos/photo1``, has four segments: ``/``,
-``joeschmoe``, ``photos`` and ``photo1``. With file system lookup we might
-have a root folder (``/``) containing a nested folder (``joeschmoe``), which
-contains another nested folder (``photos``), which finally contains a JPG
-file (``photo1``). With traversal, we instead have a dictionary-like root
-object. Asking for the ``joeschmoe`` key gives us another dictionary-like
-object. Asking this in turn for the ``photos`` key gives us yet another
-mapping object, which finally (hopefully) contains the resource that we're
-looking for within its values, referenced by the ``photo1`` key.
-
-In pure Python terms, then, the traversal or "resource location"
-portion of satisfying the ``/joeschmoe/photos/photo1`` request
-will look something like this pseudocode::
+system lookup steps through nested directories and files in a file system tree,
+while traversal steps through nested dictionary-type objects in a
+:term:`resource tree`. Let's take a detailed look at one of our example paths,
+so we can see what I mean.
+
+The path ``/joeschmoe/photos/photo1``, has four segments: ``/``, ``joeschmoe``,
+``photos`` and ``photo1``. With file system lookup we might have a root folder
+(``/``) containing a nested folder (``joeschmoe``), which contains another
+nested folder (``photos``), which finally contains a JPG file (``photo1``).
+With traversal, we instead have a dictionary-like root object. Asking for the
+``joeschmoe`` key gives us another dictionary-like object. Asking in turn for
+the ``photos`` key gives us yet another mapping object, which finally
+(hopefully) contains the resource that we're looking for within its values,
+referenced by the ``photo1`` key.
+
+In pure Python terms, then, the traversal or "resource location" portion of
+satisfying the ``/joeschmoe/photos/photo1`` request will look something like
+this pseudocode::
get_root()['joeschmoe']['photos']['photo1']
-``get_root()`` is some function that returns a root traversal
-:term:`resource`. If all of the specified keys exist, then the returned
-object will be the resource that is being requested, analogous to the JPG
-file that was retrieved in the file system example. If a :exc:`KeyError` is
-generated anywhere along the way, :app:`Pyramid` will return 404. (This
-isn't precisely true, as you'll see when we learn about view lookup below,
-but the basic idea holds.)
+``get_root()`` is some function that returns a root traversal :term:`resource`.
+If all of the specified keys exist, then the returned object will be the
+resource that is being requested, analogous to the JPG file that was retrieved
+in the file system example. If a :exc:`KeyError` is generated anywhere along
+the way, :app:`Pyramid` will return 404. (This isn't precisely true, as you'll
+see when we learn about view lookup below, but the basic idea holds.)
.. index::
single: resource
@@ -159,10 +157,10 @@ nested dictionary things? Where do these objects, these 'resources', live?
What *are* they?"
Since :app:`Pyramid` is not a highly opinionated framework, it makes no
-restriction on how a :term:`resource` is implemented; a developer can
-implement them as he wishes. One common pattern used is to persist all of
-the resources, including the root, in a database as a graph. The root object
-is a dictionary-like object. Dictionary-like objects in Python supply a
+restriction on how a :term:`resource` is implemented; a developer can implement
+them as they wish. One common pattern used is to persist all of the resources,
+including the root, in a database as a graph. The root object is a
+dictionary-like object. Dictionary-like objects in Python supply a
``__getitem__`` method which is called when key lookup is done. Under the
hood, when ``adict`` is a dictionary-like object, Python translates
``adict['a']`` to ``adict.__getitem__('a')``. Try doing this in a Python
@@ -175,25 +173,24 @@ interpreter prompt if you don't believe us:
>>> adict.__getitem__('a')
1
-
The dictionary-like root object stores the ids of all of its subresources as
keys, and provides a ``__getitem__`` implementation that fetches them. So
``get_root()`` fetches the unique root object, while
``get_root()['joeschmoe']`` returns a different object, also stored in the
database, which in turn has its own subresources and ``__getitem__``
-implementation, etc. These resources might be persisted in a relational
+implementation, and so on. These resources might be persisted in a relational
database, one of the many "NoSQL" solutions that are becoming popular these
-days, or anywhere else, it doesn't matter. As long as the returned objects
-provide the dictionary-like API (i.e. as long as they have an appropriately
-implemented ``__getitem__`` method) then traversal will work.
-
-In fact, you don't need a "database" at all. You could use plain
-dictionaries, with your site's URL structure hard-coded directly in
-the Python source. Or you could trivially implement a set of objects
-with ``__getitem__`` methods that search for files in specific
-directories, and thus precisely recreate the traditional mechanism of
-having the URL path mapped directly to a folder structure on the file
-system. Traversal is in fact a superset of file system lookup.
+days, or anywhere else; it doesn't matter. As long as the returned objects
+provide the dictionary-like API (i.e., as long as they have an appropriately
+implemented ``__getitem__`` method), then traversal will work.
+
+In fact, you don't need a "database" at all. You could use plain dictionaries,
+with your site's URL structure hard-coded directly in the Python source. Or
+you could trivially implement a set of objects with ``__getitem__`` methods
+that search for files in specific directories, and thus precisely recreate the
+traditional mechanism of having the URL path mapped directly to a folder
+structure on the file system. Traversal is in fact a superset of file system
+lookup.
.. note:: See the chapter entitled :ref:`resources_chapter` for a more
technical overview of resources.
@@ -208,34 +205,33 @@ At this point we're nearly there. We've covered traversal, which is the
process by which a specific resource is retrieved according to a specific URL
path. But what is "view lookup"?
-The need for view lookup is simple: there is more than one possible action
-that you might want to take after finding a :term:`resource`. With our photo
+The need for view lookup is simple: there is more than one possible action that
+you might want to take after finding a :term:`resource`. With our photo
example, for instance, you might want to view the photo in a page, but you
might also want to provide a way for the user to edit the photo and any
associated metadata. We'll call the former the ``view`` view, and the latter
will be the ``edit`` view. (Original, I know.) :app:`Pyramid` has a
centralized view :term:`application registry` where named views can be
-associated with specific resource types. So in our example, we'll assume
-that we've registered ``view`` and ``edit`` views for photo objects, and that
-we've specified the ``view`` view as the default, so that
+associated with specific resource types. So in our example, we'll assume that
+we've registered ``view`` and ``edit`` views for photo objects, and that we've
+specified the ``view`` view as the default, so that
``/joeschmoe/photos/photo1/view`` and ``/joeschmoe/photos/photo1`` are
equivalent. The edit view would sensibly be provided by a request for
``/joeschmoe/photos/photo1/edit``.
Hopefully it's clear that the first portion of the edit view's URL path is
-going to resolve to the same resource as the non-edit version, specifically
-the resource returned by ``get_root()['joeschmoe']['photos']['photo1']``.
-But traveral ends there; the ``photo1`` resource doesn't have an ``edit``
-key. In fact, it might not even be a dictionary-like object, in which case
+going to resolve to the same resource as the non-edit version, specifically the
+resource returned by ``get_root()['joeschmoe']['photos']['photo1']``. But
+traversal ends there; the ``photo1`` resource doesn't have an ``edit`` key. In
+fact, it might not even be a dictionary-like object, in which case
``photo1['edit']`` would be meaningless. When the :app:`Pyramid` resource
location has been resolved to a *leaf* resource, but the entire request path
has not yet been expended, the *very next* path segment is treated as a
-:term:`view name`. The registry is then checked to see if a view of the
-given name has been specified for a resource of the given type. If so, the
-view callable is invoked, with the resource passed in as the related
-``context`` object (also available as ``request.context``). If a view
-callable could not be found, :app:`Pyramid` will return a "404 Not Found"
-response.
+:term:`view name`. The registry is then checked to see if a view of the given
+name has been specified for a resource of the given type. If so, the view
+callable is invoked, with the resource passed in as the related ``context``
+object (also available as ``request.context``). If a view callable could not
+be found, :app:`Pyramid` will return a "404 Not Found" response.
You might conceptualize a request for ``/joeschmoe/photos/photo1/edit`` as
ultimately converted into the following piece of Pythonic pseudocode::
@@ -246,8 +242,8 @@ ultimately converted into the following piece of Pythonic pseudocode::
view_callable(request)
The ``get_root`` and ``get_view`` functions don't really exist. Internally,
-:app:`Pyramid` does something more complicated. But the example above
-is a reasonable approximation of the view lookup algorithm in pseudocode.
+:app:`Pyramid` does something more complicated. But the example above is a
+reasonable approximation of the view lookup algorithm in pseudocode.
Use Cases
---------
@@ -261,58 +257,57 @@ like this::
/{userid}/{typename}/{objectid}[/{view_name}]
-In all of the examples thus far, we've hard coded the typename value,
-assuming that we'd know at development time what names were going to be used
-("photos", "blog", etc.). But what if we don't know what these names will
-be? Or, worse yet, what if we don't know *anything* about the structure of
-the URLs inside a user's folder? We could be writing a CMS where we want the
-end user to be able to arbitrarily add content and other folders inside his
-folder. He might decide to nest folders dozens of layers deep. How will you
-construct matching patterns that could account for every possible combination
-of paths that might develop?
-
-It might be possible, but it certainly won't be easy. The matching
-patterns are going to become complex quickly as you try to handle all
-of the edge cases.
-
-With traversal, however, it's straightforward. Twenty layers of nesting
-would be no problem. :app:`Pyramid` will happily call ``__getitem__`` as
-many times as it needs to, until it runs out of path segments or until a
-resource raises a :exc:`KeyError`. Each resource only needs to know how to
-fetch its immediate children, the traversal algorithm takes care of the rest.
-Also, since the structure of the resource tree can live in the database and
-not in the code, it's simple to let users modify the tree at runtime to set
-up their own personalized "directory" structures.
-
-Another use case in which traversal shines is when there is a need to support
-a context-dependent security policy. One example might be a document
-management infrastructure for a large corporation, where members of different
-departments have varying access levels to the various other departments'
-files. Reasonably, even specific files might need to be made available to
-specific individuals. Traversal does well here if your resources actually
-represent the data objects related to your documents, because the idea of a
-resource authorization is baked right into the code resolution and calling
-process. Resource objects can store ACLs, which can be inherited and/or
-overridden by the subresources.
-
-If each resource can thus generate a context-based ACL, then whenever view
-code is attempting to perform a sensitive action, it can check against that
-ACL to see whether the current user should be allowed to perform the action.
-In this way you achieve so called "instance based" or "row level" security
-which is considerably harder to model using a traditional tabular approach.
+In all of the examples thus far, we've hard coded the typename value, assuming
+that we'd know at development time what names were going to be used ("photos",
+"blog", etc.). But what if we don't know what these names will be? Or, worse
+yet, what if we don't know *anything* about the structure of the URLs inside a
+user's folder? We could be writing a CMS where we want the end user to be able
+to arbitrarily add content and other folders inside his folder. He might
+decide to nest folders dozens of layers deep. How will you construct matching
+patterns that could account for every possible combination of paths that might
+develop?
+
+It might be possible, but it certainly won't be easy. The matching patterns
+are going to become complex quickly as you try to handle all of the edge cases.
+
+With traversal, however, it's straightforward. Twenty layers of nesting would
+be no problem. :app:`Pyramid` will happily call ``__getitem__`` as many times
+as it needs to, until it runs out of path segments or until a resource raises a
+:exc:`KeyError`. Each resource only needs to know how to fetch its immediate
+children, and the traversal algorithm takes care of the rest. Also, since the
+structure of the resource tree can live in the database and not in the code,
+it's simple to let users modify the tree at runtime to set up their own
+personalized "directory" structures.
+
+Another use case in which traversal shines is when there is a need to support a
+context-dependent security policy. One example might be a document management
+infrastructure for a large corporation, where members of different departments
+have varying access levels to the various other departments' files.
+Reasonably, even specific files might need to be made available to specific
+individuals. Traversal does well here if your resources actually represent the
+data objects related to your documents, because the idea of a resource
+authorization is baked right into the code resolution and calling process.
+Resource objects can store ACLs, which can be inherited and/or overridden by
+the subresources.
+
+If each resource can thus generate a context-based ACL, then whenever view code
+is attempting to perform a sensitive action, it can check against that ACL to
+see whether the current user should be allowed to perform the action. In this
+way you achieve so called "instance based" or "row level" security which is
+considerably harder to model using a traditional tabular approach.
:app:`Pyramid` actively supports such a scheme, and in fact if you register
-your views with guard permissions and use an authorization policy,
-:app:`Pyramid` can check against a resource's ACL when deciding whether or
-not the view itself is available to the current user.
+your views with guarded permissions and use an authorization policy,
+:app:`Pyramid` can check against a resource's ACL when deciding whether or not
+the view itself is available to the current user.
-In summary, there are entire classes of problems that are more easily served
-by traversal and view lookup than by :term:`URL dispatch`. If your problems
-don't require it, great: stick with :term:`URL dispatch`. But if you're
-using :app:`Pyramid` and you ever find that you *do* need to support one of
-these use cases, you'll be glad you have traversal in your toolkit.
+In summary, there are entire classes of problems that are more easily served by
+traversal and view lookup than by :term:`URL dispatch`. If your problems don't
+require it, great, stick with :term:`URL dispatch`. But if you're using
+:app:`Pyramid` and you ever find that you *do* need to support one of these use
+cases, you'll be glad you have traversal in your toolkit.
.. note::
- It is even possible to mix and match :term:`traversal` with
- :term:`URL dispatch` in the same :app:`Pyramid` application. See the
+ It is even possible to mix and match :term:`traversal` with :term:`URL
+ dispatch` in the same :app:`Pyramid` application. See the
:ref:`hybrid_chapter` chapter for details.
diff --git a/docs/narr/paste.rst b/docs/narr/paste.rst
index f1fb70869..0a217e6e3 100644
--- a/docs/narr/paste.rst
+++ b/docs/narr/paste.rst
@@ -7,54 +7,54 @@ Packages generated via a :term:`scaffold` make use of a system created by Ian
Bicking named :term:`PasteDeploy`. PasteDeploy defines a way to declare
:term:`WSGI` application configuration in an ``.ini`` file.
-Pyramid uses this configuration file format in input to its :term:`WSGI`
-server runner ``pserve``, as well as other commands such as ``pviews``,
-``pshell``, ``proutes``, and ``ptweens``.
+Pyramid uses this configuration file format as input to its :term:`WSGI` server
+runner ``pserve``, as well as other commands such as ``pviews``, ``pshell``,
+``proutes``, and ``ptweens``.
PasteDeploy is not a particularly integral part of Pyramid. It's possible to
-create a Pyramid application which does not use PasteDeploy at all. We show
-a Pyramid application that doesn't use PasteDeploy in
-:ref:`firstapp_chapter`. However, all Pyramid scaffolds render PasteDeploy
-configuration files, to provide new developers with a standardized way of
-setting deployment values, and to provide new users with a standardized way
-of starting, stopping, and debugging an application.
-
-This chapter is not a replacement for documentation about PasteDeploy; it
-only contextualizes the use of PasteDeploy within Pyramid. For detailed
+create a Pyramid application which does not use PasteDeploy at all. We show a
+Pyramid application that doesn't use PasteDeploy in :ref:`firstapp_chapter`.
+However, all Pyramid scaffolds render PasteDeploy configuration files, to
+provide new developers with a standardized way of setting deployment values,
+and to provide new users with a standardized way of starting, stopping, and
+debugging an application.
+
+This chapter is not a replacement for documentation about PasteDeploy; it only
+contextualizes the use of PasteDeploy within Pyramid. For detailed
documentation, see http://pythonpaste.org/deploy/.
PasteDeploy
-----------
-:term:`PasteDeploy` is the system that Pyramid uses to allow
-:term:`deployment settings` to be spelled using an ``.ini`` configuration
-file format. It also allows the ``pserve`` command to work. Its
-configuration format provides a convenient place to define application
-:term:`deployment settings` and WSGI server settings, and its server runner
-allows you to stop and start a Pyramid application easily.
+:term:`PasteDeploy` is the system that Pyramid uses to allow :term:`deployment
+settings` to be specified using an ``.ini`` configuration file format. It also
+allows the ``pserve`` command to work. Its configuration format provides a
+convenient place to define application :term:`deployment settings` and WSGI
+server settings, and its server runner allows you to stop and start a Pyramid
+application easily.
.. _pastedeploy_entry_points:
Entry Points and PasteDeploy ``.ini`` Files
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the :ref:`project_narr` chapter, we breezed over the meaning of a
configuration line in the ``deployment.ini`` file. This was the ``use =
-egg:MyProject`` line in the ``[app:main]`` section. We breezed over it
-because it's pretty confusing and "too much information" for an introduction
-to the system. We'll try to give it a bit of attention here. Let's see the
-config file again:
+egg:MyProject`` line in the ``[app:main]`` section. We breezed over it because
+it's pretty confusing and "too much information" for an introduction to the
+system. We'll try to give it a bit of attention here. Let's see the config
+file again:
.. literalinclude:: MyProject/development.ini
:language: ini
:linenos:
-The line in ``[app:main]`` above that says ``use = egg:MyProject`` is
-actually shorthand for a longer spelling: ``use = egg:MyProject#main``. The
-``#main`` part is omitted for brevity, as ``#main`` is a default defined by
-PasteDeploy. ``egg:MyProject#main`` is a string which has meaning to
-PasteDeploy. It points at a :term:`setuptools` :term:`entry point` named
-``main`` defined in the ``MyProject`` project.
+The line in ``[app:main]`` above that says ``use = egg:MyProject`` is actually
+shorthand for a longer spelling: ``use = egg:MyProject#main``. The ``#main``
+part is omitted for brevity, as ``#main`` is a default defined by PasteDeploy.
+``egg:MyProject#main`` is a string which has meaning to PasteDeploy. It points
+at a :term:`setuptools` :term:`entry point` named ``main`` defined in the
+``MyProject`` project.
Take a look at the generated ``setup.py`` file for this project.
@@ -62,19 +62,19 @@ Take a look at the generated ``setup.py`` file for this project.
:language: python
:linenos:
-Note that ``entry_points`` is assigned a string which
-looks a lot like an ``.ini`` file. This string representation of an ``.ini``
-file has a section named ``[paste.app_factory]``. Within this section, there
-is a key named ``main`` (the entry point name) which has a value
-``myproject:main``. The *key* ``main`` is what our ``egg:MyProject#main``
-value of the ``use`` section in our config file is pointing at, although it
-is actually shortened to ``egg:MyProject`` there. The value represents a
-:term:`dotted Python name` path, which refers to a callable in our
-``myproject`` package's ``__init__.py`` module.
+Note that ``entry_points`` is assigned a string which looks a lot like an
+``.ini`` file. This string representation of an ``.ini`` file has a section
+named ``[paste.app_factory]``. Within this section, there is a key named
+``main`` (the entry point name) which has a value ``myproject:main``. The
+*key* ``main`` is what our ``egg:MyProject#main`` value of the ``use`` section
+in our config file is pointing at, although it is actually shortened to
+``egg:MyProject`` there. The value represents a :term:`dotted Python name`
+path, which refers to a callable in our ``myproject`` package's ``__init__.py``
+module.
-The ``egg:`` prefix in ``egg:MyProject`` indicates that this is an entry
-point *URI* specifier, where the "scheme" is "egg". An "egg" is created when
-you run ``setup.py install`` or ``setup.py develop`` within your project.
+The ``egg:`` prefix in ``egg:MyProject`` indicates that this is an entry point
+*URI* specifier, where the "scheme" is "egg". An "egg" is created when you run
+``setup.py install`` or ``setup.py develop`` within your project.
In English, this entry point can thus be referred to as a "PasteDeploy
application factory in the ``MyProject`` project which has the entry point
@@ -88,13 +88,11 @@ configuration object and *returns* an instance of our application.
.. _defaults_section_of_pastedeploy_file:
``[DEFAULT]`` Section of a PasteDeploy ``.ini`` File
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-You can add a ``[DEFAULT]`` section to your PasteDeploy ``.ini`` file. Such
-a section should consists of global parameters that are shared by all the
-applications, servers and :term:`middleware` defined within the configuration
+You can add a ``[DEFAULT]`` section to your PasteDeploy ``.ini`` file. Such a
+section should consist of global parameters that are shared by all the
+applications, servers, and :term:`middleware` defined within the configuration
file. The values in a ``[DEFAULT]`` section will be passed to your
-application's ``main`` function as ``global_config`` (see the reference to
-the ``main`` function in :ref:`init_py`).
-
-
+application's ``main`` function as ``global_config`` (see the reference to the
+``main`` function in :ref:`init_py`).
diff --git a/docs/narr/project-debug.png b/docs/narr/project-debug.png
index 4f8e441ef..0a703dead 100644
--- a/docs/narr/project-debug.png
+++ b/docs/narr/project-debug.png
Binary files differ
diff --git a/docs/narr/project-show-toolbar.png b/docs/narr/project-show-toolbar.png
new file mode 100644
index 000000000..89b838f64
--- /dev/null
+++ b/docs/narr/project-show-toolbar.png
Binary files differ
diff --git a/docs/narr/project.png b/docs/narr/project.png
index 5d46df0dd..e1afd97d4 100644
--- a/docs/narr/project.png
+++ b/docs/narr/project.png
Binary files differ
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 0ada1a379..923fde436 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -1,27 +1,26 @@
.. _project_narr:
Creating a :app:`Pyramid` Project
-====================================
+=================================
-As we saw in :ref:`firstapp_chapter`, it's possible to create a
-:app:`Pyramid` application completely manually. However, it's usually more
-convenient to use a :term:`scaffold` to generate a basic :app:`Pyramid`
-:term:`project`.
+As we saw in :ref:`firstapp_chapter`, it's possible to create a :app:`Pyramid`
+application completely manually. However, it's usually more convenient to use
+a :term:`scaffold` to generate a basic :app:`Pyramid` :term:`project`.
A project is a directory that contains at least one Python :term:`package`.
You'll use a scaffold to create a project, and you'll create your application
-logic within a package that lives inside the project. Even if your
-application is extremely simple, it is useful to place code that drives the
-application within a package, because: 1) a package is more easily extended
-with new code and 2) an application that lives inside a package can also be
-distributed more easily than one which does not live within a package.
+logic within a package that lives inside the project. Even if your application
+is extremely simple, it is useful to place code that drives the application
+within a package, because (1) a package is more easily extended with new code,
+and (2) an application that lives inside a package can also be distributed more
+easily than one which does not live within a package.
-:app:`Pyramid` comes with a variety of scaffolds that you can use to generate
-a project. Each scaffold makes different configuration assumptions about
-what type of application you're trying to construct.
+:app:`Pyramid` comes with a variety of scaffolds that you can use to generate a
+project. Each scaffold makes different configuration assumptions about what
+type of application you're trying to construct.
-These scaffolds are rendered using the ``pcreate`` command that is installed
-as part of Pyramid.
+These scaffolds are rendered using the ``pcreate`` command that is installed as
+part of Pyramid.
.. index::
single: scaffolds
@@ -32,45 +31,48 @@ as part of Pyramid.
.. _additional_paster_scaffolds:
Scaffolds Included with :app:`Pyramid`
-------------------------------------------------
+--------------------------------------
-The convenience scaffolds included with :app:`Pyramid` differ from
-each other on a number of axes:
+The convenience scaffolds included with :app:`Pyramid` differ from each other
+on a number of axes:
-- the persistence mechanism they offer (no persistence mechanism,
- :term:`ZODB`, or :term:`SQLAlchemy`).
+- the persistence mechanism they offer (no persistence mechanism, :term:`ZODB`,
+ or :term:`SQLAlchemy`)
- the mechanism they use to map URLs to code (:term:`traversal` or :term:`URL
- dispatch`).
+ dispatch`)
The included scaffolds are these:
``starter``
- URL mapping via :term:`URL dispatch` and no persistence mechanism.
+ URL mapping via :term:`URL dispatch` and no persistence mechanism
``zodb``
- URL mapping via :term:`traversal` and persistence via :term:`ZODB`.
+ URL mapping via :term:`traversal` and persistence via :term:`ZODB`
``alchemy``
- URL mapping via :term:`URL dispatch` and persistence via
- :term:`SQLAlchemy`
+ URL mapping via :term:`URL dispatch` and persistence via :term:`SQLAlchemy`
+
.. index::
single: creating a project
single: project
+ single: pcreate
.. _creating_a_project:
Creating the Project
--------------------
-In :ref:`installing_chapter`, you created a virtual Python environment via
-the ``virtualenv`` command. To start a :app:`Pyramid` :term:`project`, use
-the ``pcreate`` command installed within the virtualenv. We'll choose the
+.. seealso:: See also the output of :ref:`pcreate --help <pcreate_script>`.
+
+In :ref:`installing_chapter`, you created a virtual Python environment via the
+``virtualenv`` command. To start a :app:`Pyramid` :term:`project`, use the
+``pcreate`` command installed within the virtualenv. We'll choose the
``starter`` scaffold for this purpose. When we invoke ``pcreate``, it will
create a directory that represents our project.
-In :ref:`installing_chapter` we called the virtualenv directory ``env``; the
+In :ref:`installing_chapter` we called the virtualenv directory ``env``. The
following commands assume that our current working directory is the ``env``
directory.
@@ -79,7 +81,7 @@ The below example uses the ``pcreate`` command to create a project with the
On UNIX:
-.. code-block:: text
+.. code-block:: bash
$ $VENV/bin/pcreate -s starter MyProject
@@ -89,11 +91,10 @@ Or on Windows:
> %VENV%\Scripts\pcreate -s starter MyProject
-
Here's sample output from a run of ``pcreate`` on UNIX for a project we name
``MyProject``:
-.. code-block:: text
+.. code-block:: bash
$ $VENV/bin/pcreate -s starter MyProject
Creating template pyramid
@@ -102,14 +103,14 @@ Here's sample output from a run of ``pcreate`` on UNIX for a project we name
Running /Users/chrism/projects/pyramid/bin/python setup.py egg_info
As a result of invoking the ``pcreate`` command, a directory named
-``MyProject`` is created. That directory is a :term:`project` directory.
-The ``setup.py`` file in that directory can be used to distribute your
-application, or install your application for deployment or development.
+``MyProject`` is created. That directory is a :term:`project` directory. The
+``setup.py`` file in that directory can be used to distribute your application,
+or install your application for deployment or development.
A ``.ini`` file named ``development.ini`` will be created in the project
-directory. You will use this ``.ini`` file to configure a server, to run
-your application, and to debug your application. It contains configuration
-that enables an interactive debugger and settings optimized for development.
+directory. You will use this ``.ini`` file to configure a server, to run your
+application, and to debug your application. It contains configuration that
+enables an interactive debugger and settings optimized for development.
Another ``.ini`` file named ``production.ini`` will also be created in the
project directory. It contains configuration that disables any interactive
@@ -118,28 +119,28 @@ number of debugging settings. You can use this file to put your application
into production.
The ``MyProject`` project directory contains an additional subdirectory named
-``myproject`` (note the case difference) representing a Python
-:term:`package` which holds very simple :app:`Pyramid` sample code. This is
-where you'll edit your application's Python code and templates.
-
-We created this project within an ``env`` virtualenv directory. However,
-note that this is not mandatory. The project directory can go more or less
-anywhere on your filesystem. You don't need to put it in a special "web
-server" directory, and you don't need to put it within a virtualenv
-directory. The author uses Linux mainly, and tends to put project
-directories which he creates within his ``~/projects`` directory. On
-Windows, it's a good idea to put project directories within a directory that
-contains no space characters, so it's wise to *avoid* a path that contains
-i.e. ``My Documents``. As a result, the author, when he uses Windows, just
-puts his projects in ``C:\projects``.
+``myproject`` (note the case difference) representing a Python :term:`package`
+which holds very simple :app:`Pyramid` sample code. This is where you'll edit
+your application's Python code and templates.
+
+We created this project within an ``env`` virtualenv directory. However, note
+that this is not mandatory. The project directory can go more or less anywhere
+on your filesystem. You don't need to put it in a special "web server"
+directory, and you don't need to put it within a virtualenv directory. The
+author uses Linux mainly, and tends to put project directories which he creates
+within his ``~/projects`` directory. On Windows, it's a good idea to put
+project directories within a directory that contains no space characters, so
+it's wise to *avoid* a path that contains, i.e., ``My Documents``. As a
+result, the author, when he uses Windows, just puts his projects in
+``C:\projects``.
.. warning::
You'll need to avoid using ``pcreate`` to create a project with the same
name as a Python standard library component. In particular, this means you
- should avoid using the names ``site`` or ``test``, both of which
- conflict with Python standard library packages. You should also avoid
- using the name ``pyramid``, which will conflict with Pyramid itself.
+ should avoid using the names ``site`` or ``test``, both of which conflict
+ with Python standard library packages. You should also avoid using the name
+ ``pyramid``, which will conflict with Pyramid itself.
.. index::
single: setup.py develop
@@ -154,14 +155,14 @@ newly created project directory and use the Python interpreter from the
command ``python setup.py develop``
The file named ``setup.py`` will be in the root of the pcreate-generated
-project directory. The ``python`` you're invoking should be the one that
-lives in the ``bin`` (or ``Scripts`` on Windows) directory of your virtual
-Python environment. Your terminal's current working directory *must* be the
-newly created project directory.
+project directory. The ``python`` you're invoking should be the one that lives
+in the ``bin`` (or ``Scripts`` on Windows) directory of your virtual Python
+environment. Your terminal's current working directory *must* be the newly
+created project directory.
On UNIX:
-.. code-block:: text
+.. code-block:: bash
$ cd MyProject
$ $VENV/bin/python setup.py develop
@@ -175,33 +176,33 @@ Or on Windows:
Elided output from a run of this command on UNIX is shown below:
-.. code-block:: text
+.. code-block:: bash
$ cd MyProject
$ $VENV/bin/python setup.py develop
...
Finished processing dependencies for MyProject==0.0
-This will install a :term:`distribution` representing your project
-into the virtual environment interpreter's library set so it can be
-found by ``import`` statements and by other console scripts such as
-``pserve``, ``pshell``, ``proutes`` and ``pviews``.
+This will install a :term:`distribution` representing your project into the
+virtual environment interpreter's library set so it can be found by ``import``
+statements and by other console scripts such as ``pserve``, ``pshell``,
+``proutes``, and ``pviews``.
.. index::
single: running tests
single: tests (running)
-Running The Tests For Your Application
+Running the Tests for Your Application
--------------------------------------
-To run unit tests for your application, you should invoke them using the
-Python interpreter from the :term:`virtualenv` you created during
+To run unit tests for your application, you should invoke them using the Python
+interpreter from the :term:`virtualenv` you created during
:ref:`installing_chapter` (the ``python`` command that lives in the ``bin``
directory of your virtualenv).
On UNIX:
-.. code-block:: text
+.. code-block:: bash
$ $VENV/bin/python setup.py test -q
@@ -213,7 +214,7 @@ Or on Windows:
Here's sample output from a test run on UNIX:
-.. code-block:: text
+.. code-block:: bash
$ $VENV/bin/python setup.py test -q
running test
@@ -224,11 +225,23 @@ Here's sample output from a test run on UNIX:
writing dependency_links to MyProject.egg-info/dependency_links.txt
writing entry points to MyProject.egg-info/entry_points.txt
reading manifest file 'MyProject.egg-info/SOURCES.txt'
+ reading manifest template 'MANIFEST.in'
+ warning: no files found matching '*.cfg'
+ warning: no files found matching '*.rst'
+ warning: no files found matching '*.ico' under directory 'myproject'
+ warning: no files found matching '*.gif' under directory 'myproject'
+ warning: no files found matching '*.jpg' under directory 'myproject'
+ warning: no files found matching '*.txt' under directory 'myproject'
+ warning: no files found matching '*.mak' under directory 'myproject'
+ warning: no files found matching '*.mako' under directory 'myproject'
+ warning: no files found matching '*.js' under directory 'myproject'
+ warning: no files found matching '*.html' under directory 'myproject'
+ warning: no files found matching '*.xml' under directory 'myproject'
writing manifest file 'MyProject.egg-info/SOURCES.txt'
running build_ext
- ..
+ .
----------------------------------------------------------------------
- Ran 1 test in 0.108s
+ Ran 1 test in 0.008s
OK
@@ -250,16 +263,18 @@ single sample test exists.
.. _running_the_project_application:
-Running The Project Application
+Running the Project Application
-------------------------------
+.. seealso:: See also the output of :ref:`pserve --help <pserve_script>`.
+
Once a project is installed for development, you can run the application it
represents using the ``pserve`` command against the generated configuration
file. In our case, this file is named ``development.ini``.
On UNIX:
-.. code-block:: text
+.. code-block:: bash
$ $VENV/bin/pserve development.ini
@@ -271,62 +286,61 @@ On Windows:
Here's sample output from a run of ``pserve`` on UNIX:
-.. code-block:: text
+.. code-block:: bash
$ $VENV/bin/pserve development.ini
- Starting server in PID 16601.
- serving on http://0.0.0.0:6543
-
-When you use ``pserve`` to start the application implied by the default
-rendering of a scaffold, it will respond to requests on *all* IP addresses
-possessed by your system, not just requests to ``localhost``. This is what
-the ``0.0.0.0`` in ``serving on http://0.0.0.0:6543`` means. The server will
-respond to requests made to ``127.0.0.1`` and on any external IP address.
-For example, your system might be configured to have an external IP address
-``192.168.1.50``. If that's the case, if you use a browser running on the
-same system as Pyramid, it will be able to access the application via
-``http://127.0.0.1:6543/`` as well as via
-``http://192.168.1.50:6543/``. However, *other people* on other computers on
-the same network will also be able to visit your Pyramid application in their
-browser by visiting ``http://192.168.1.50:6543/``.
+ Starting server in PID 16208.
+ serving on http://127.0.0.1:6543
-If you want to restrict access such that only a browser running on the same
-machine as Pyramid will be able to access your Pyramid application, edit the
+Access is restricted such that only a browser running on the same machine as
+Pyramid will be able to access your Pyramid application. However, if you want
+to open access to other machines on the same network, then edit the
``development.ini`` file, and replace the ``host`` value in the
-``[server:main]`` section. Change it from ``0.0.0.0`` to ``127.0.0.1``. For
+``[server:main]`` section, changing it from ``127.0.0.1`` to ``0.0.0.0``. For
example:
.. code-block:: ini
[server:main]
use = egg:waitress#main
- host = 127.0.0.1
+ host = 0.0.0.0
port = 6543
+Now when you use ``pserve`` to start the application, it will respond to
+requests on *all* IP addresses possessed by your system, not just requests to
+``localhost``. This is what the ``0.0.0.0`` in
+``serving on http://0.0.0.0:6543`` means. The server will respond to requests
+made to ``127.0.0.1`` and on any external IP address. For example, your system
+might be configured to have an external IP address ``192.168.1.50``. If that's
+the case, if you use a browser running on the same system as Pyramid, it will
+be able to access the application via ``http://127.0.0.1:6543/`` as well as via
+``http://192.168.1.50:6543/``. However, *other people* on other computers on
+the same network will also be able to visit your Pyramid application in their
+browser by visiting ``http://192.168.1.50:6543/``.
+
You can change the port on which the server runs on by changing the same
portion of the ``development.ini`` file. For example, you can change the
``port = 6543`` line in the ``development.ini`` file's ``[server:main]``
-section to ``port = 8080`` to run the server on port 8080 instead of
-port 6543.
+section to ``port = 8080`` to run the server on port 8080 instead of port 6543.
-You can shut down a server started this way by pressing ``Ctrl-C``.
+You can shut down a server started this way by pressing ``Ctrl-C`` (or
+``Ctrl-Break`` on Windows).
The default server used to run your Pyramid application when a project is
-created from a scaffold is named :term:`Waitress`. This server is what
-prints the ``serving on...`` line when you run ``pserve``. It's a good idea
-to use this server during development, because it's very simple. It can also
-be used for light production. Setting your application up under a different
-server is not advised until you've done some development work under the
-default server, particularly if you're not yet experienced with Python web
-development. Python web server setup can be complex, and you should get some
-confidence that your application works in a default environment before trying
-to optimize it or make it "more like production". It's awfully easy to get
-sidetracked trying to set up a nondefault server for hours without actually
-starting to do any development. One of the nice things about Python web
-servers is that they're largely interchangeable, so if your application works
-under the default server, it will almost certainly work under any other
-server in production if you eventually choose to use a different one. Don't
-worry about it right now.
+created from a scaffold is named :term:`Waitress`. This server is what prints
+the ``serving on...`` line when you run ``pserve``. It's a good idea to use
+this server during development because it's very simple. It can also be used
+for light production. Setting your application up under a different server is
+not advised until you've done some development work under the default server,
+particularly if you're not yet experienced with Python web development. Python
+web server setup can be complex, and you should get some confidence that your
+application works in a default environment before trying to optimize it or make
+it "more like production". It's awfully easy to get sidetracked trying to set
+up a non-default server for hours without actually starting to do any
+development. One of the nice things about Python web servers is that they're
+largely interchangeable, so if your application works under the default server,
+it will almost certainly work under any other server in production if you
+eventually choose to use a different one. Don't worry about it right now.
For more detailed information about the startup process, see
:ref:`startup_chapter`. For more information about environment variables and
@@ -338,10 +352,10 @@ configuration file settings that influence startup and runtime behavior, see
Reloading Code
~~~~~~~~~~~~~~
-During development, it's often useful to run ``pserve`` using its
-``--reload`` option. When ``--reload`` is passed to ``pserve``, changes to
-any Python module your project uses will cause the server to restart. This
-typically makes development easier, as changes to Python code made within a
+During development, it's often useful to run ``pserve`` using its ``--reload``
+option. When ``--reload`` is passed to ``pserve``, changes to any Python
+module your project uses will cause the server to restart. This typically
+makes development easier, as changes to Python code made within a
:app:`Pyramid` application is not put into effect until the server restarts.
For example, on UNIX:
@@ -351,7 +365,7 @@ For example, on UNIX:
$ $VENV/bin/pserve development.ini --reload
Starting subprocess with file monitor
Starting server in PID 16601.
- serving on http://0.0.0.0:6543
+ serving on http://127.0.0.1:6543
Now if you make a change to any of your project's ``.py`` files or ``.ini``
files, you'll see the server restart automatically:
@@ -361,13 +375,13 @@ files, you'll see the server restart automatically:
development.ini changed; reloading...
-------------------- Restarting --------------------
Starting server in PID 16602.
- serving on http://0.0.0.0:6543
+ serving on http://127.0.0.1:6543
Changes to template files (such as ``.pt`` or ``.mak`` files) won't cause the
-server to restart. Changes to template files don't require a server restart
-as long as the ``pyramid.reload_templates`` setting in the
-``development.ini`` file is ``true``. Changes made to template files when
-this setting is true will take effect immediately without a server restart.
+server to restart. Changes to template files don't require a server restart as
+long as the ``pyramid.reload_templates`` setting in the ``development.ini``
+file is ``true``. Changes made to template files when this setting is true
+will take effect immediately without a server restart.
.. index::
single: WSGI
@@ -392,25 +406,25 @@ generated ``starter`` application in a browser.
The Debug Toolbar
~~~~~~~~~~~~~~~~~
-If you click on the image shown at the right hand top of the page ("^DT"),
-you'll be presented with a debug toolbar that provides various niceties while
-you're developing. This image will float above every HTML page served by
-:app:`Pyramid` while you develop an application, and allows you show the
-toolbar as necessary. Click on ``Hide`` to hide the toolbar and show the
-image again.
+.. image:: project-show-toolbar.png
+
+If you click on the :app:`Pyramid` logo at the top right of the page, a new
+target window will open to present a debug toolbar that provides various
+niceties while you're developing. This logo will float above every HTML page
+served by :app:`Pyramid` while you develop an application, and allows you to
+show the toolbar as necessary.
.. image:: project-debug.png
-If you don't see the debug toolbar image on the right hand top of the page,
-it means you're browsing from a system that does not have debugging access.
-By default, for security reasons, only a browser originating from
-``localhost`` (``127.0.0.1``) can see the debug toolbar. To allow your
-browser on a remote system to access the server, add a line within the
-``[app:main]`` section of the ``development.ini`` file in the form
-``debugtoolbar.hosts = X.X.X.X``. For example, if your Pyramid application
-is running on a remote system, and you're browsing from a host with the IP
-address ``192.168.1.1``, you'd add something like this to enable the toolbar
-when your system contacts Pyramid:
+If you don't see the Pyramid logo on the top right of the page, it means you're
+browsing from a system that does not have debugging access. By default, for
+security reasons, only a browser originating from ``localhost`` (``127.0.0.1``)
+can see the debug toolbar. To allow your browser on a remote system to access
+the server, add a line within the ``[app:main]`` section of the
+``development.ini`` file in the form ``debugtoolbar.hosts = X .X.X.X``. For
+example, if your Pyramid application is running on a remote system, and you're
+browsing from a host with the IP address ``192.168.1.1``, you'd add something
+like this to enable the toolbar when your system contacts Pyramid:
.. code-block:: ini
@@ -422,9 +436,9 @@ For more information about what the debug toolbar allows you to do, see `the
documentation for pyramid_debugtoolbar
<http://docs.pylonsproject.org/projects/pyramid_debugtoolbar/en/latest/>`_.
-The debug toolbar will not be shown (and all debugging will be turned off)
-when you use the ``production.ini`` file instead of the ``development.ini``
-ini file to run the application.
+The debug toolbar will not be shown (and all debugging will be turned off) when
+you use the ``production.ini`` file instead of the ``development.ini`` ini file
+to run the application.
You can also turn the debug toolbar off by editing ``development.ini`` and
commenting out a line. For example, instead of:
@@ -433,7 +447,7 @@ commenting out a line. For example, instead of:
:linenos:
[app:main]
- ...
+ # ... elided configuration
pyramid.includes =
pyramid_debugtoolbar
@@ -443,16 +457,16 @@ Put a hash mark at the beginning of the ``pyramid_debugtoolbar`` line:
:linenos:
[app:main]
- ...
+ # ... elided configuration
pyramid.includes =
# pyramid_debugtoolbar
Then restart the application to see that the toolbar has been turned off.
Note that if you comment out the ``pyramid_debugtoolbar`` line, the ``#``
-*must* be in the first column. If you put it anywhere else,
-and then attempt to restart the application,
-you'll receive an error that ends something like this:
+*must* be in the first column. If you put it anywhere else, and then attempt
+to restart the application, you'll receive an error that ends something like
+this:
.. code-block:: text
@@ -469,9 +483,8 @@ which contains a Python :term:`package`. The package is *also* named
``myproject``, but it's lowercased; the scaffold generates a project which
contains a package that shares its name except for case.
-All :app:`Pyramid` ``pcreate`` -generated projects share a similar structure.
-The ``MyProject`` project we've generated has the following directory
-structure:
+All :app:`Pyramid` ``pcreate``-generated projects share a similar structure.
+The ``MyProject`` project we've generated has the following directory structure:
.. code-block:: text
@@ -497,29 +510,29 @@ structure:
The ``MyProject`` :term:`Project`
---------------------------------
-The ``MyProject`` :term:`project` directory is the distribution and
-deployment wrapper for your application. It contains both the ``myproject``
+The ``MyProject`` :term:`project` directory is the distribution and deployment
+wrapper for your application. It contains both the ``myproject``
:term:`package` representing your application as well as files used to
describe, run, and test your application.
-#. ``CHANGES.txt`` describes the changes you've made to the application. It
- is conventionally written in :term:`ReStructuredText` format.
+#. ``CHANGES.txt`` describes the changes you've made to the application. It is
+ conventionally written in :term:`ReStructuredText` format.
#. ``README.txt`` describes the application in general. It is conventionally
written in :term:`ReStructuredText` format.
-#. ``development.ini`` is a :term:`PasteDeploy` configuration file that can
- be used to execute your application during development.
+#. ``development.ini`` is a :term:`PasteDeploy` configuration file that can be
+ used to execute your application during development.
-#. ``production.ini`` is a :term:`PasteDeploy` configuration file that can
- be used to execute your application in a production configuration.
+#. ``production.ini`` is a :term:`PasteDeploy` configuration file that can be
+ used to execute your application in a production configuration.
#. ``MANIFEST.in`` is a :term:`distutils` "manifest" file, naming which files
should be included in a source distribution of the package when ``python
setup.py sdist`` is run.
-#. ``setup.py`` is the file you'll use to test and distribute your
- application. It is a standard :term:`setuptools` ``setup.py`` file.
+#. ``setup.py`` is the file you'll use to test and distribute your application.
+ It is a standard :term:`setuptools` ``setup.py`` file.
.. index::
single: PasteDeploy
@@ -530,9 +543,9 @@ describe, run, and test your application.
``development.ini``
~~~~~~~~~~~~~~~~~~~
-The ``development.ini`` file is a :term:`PasteDeploy` configuration file.
-Its purpose is to specify an application to run when you invoke ``pserve``,
-as well as the deployment settings provided to that application.
+The ``development.ini`` file is a :term:`PasteDeploy` configuration file. Its
+purpose is to specify an application to run when you invoke ``pserve``, as well
+as the deployment settings provided to that application.
The generated ``development.ini`` file looks like so:
@@ -541,91 +554,87 @@ The generated ``development.ini`` file looks like so:
:linenos:
This file contains several sections including ``[app:main]``,
-``[server:main]`` and several other sections related to logging
-configuration.
+``[server:main]``, and several other sections related to logging configuration.
The ``[app:main]`` section represents configuration for your :app:`Pyramid`
-application. The ``use`` setting is the only setting required to be present
-in the ``[app:main]`` section. Its default value, ``egg:MyProject``,
-indicates that our MyProject project contains the application that should be
-served. Other settings added to this section are passed as keyword arguments
-to the function named ``main`` in our package's ``__init__.py`` module. You
-can provide startup-time configuration parameters to your application by
-adding more settings to this section.
-
-.. note:: See :ref:`pastedeploy_entry_points` for more information about the
+application. The ``use`` setting is the only setting required to be present in
+the ``[app:main]`` section. Its default value, ``egg:MyProject``, indicates
+that our MyProject project contains the application that should be served.
+Other settings added to this section are passed as keyword arguments to the
+function named ``main`` in our package's ``__init__.py`` module. You can
+provide startup-time configuration parameters to your application by adding
+more settings to this section.
+
+.. seealso:: See :ref:`pastedeploy_entry_points` for more information about the
meaning of the ``use = egg:MyProject`` value in this section.
The ``pyramid.reload_templates`` setting in the ``[app:main]`` section is a
-:app:`Pyramid` -specific setting which is passed into the framework. If it
-exists, and its value is ``true``, supported template changes will not
-require an application restart to be detected. See
-:ref:`reload_templates_section` for more information.
+:app:`Pyramid`-specific setting which is passed into the framework. If it
+exists, and its value is ``true``, supported template changes will not require
+an application restart to be detected. See :ref:`reload_templates_section` for
+more information.
.. warning:: The ``pyramid.reload_templates`` option should be turned off for
production applications, as template rendering is slowed when it is turned
on.
-The ``pyramid.includes`` setting in the ``[app:main]`` section tells Pyramid
-to "include" configuration from another package. In this case, the line
+The ``pyramid.includes`` setting in the ``[app:main]`` section tells Pyramid to
+"include" configuration from another package. In this case, the line
``pyramid.includes = pyramid_debugtoolbar`` tells Pyramid to include
configuration from the ``pyramid_debugtoolbar`` package. This turns on a
-debugging panel in development mode which will be shown on the right hand
-side of the screen. Including the debug toolbar will also make it possible
-to interactively debug exceptions when an error occurs.
+debugging panel in development mode which can be opened by clicking on the
+:app:`Pyramid` logo on the top right of the screen. Including the debug
+toolbar will also make it possible to interactively debug exceptions when an
+error occurs.
-Various other settings may exist in this section having to do with debugging
-or influencing runtime behavior of a :app:`Pyramid` application. See
+Various other settings may exist in this section having to do with debugging or
+influencing runtime behavior of a :app:`Pyramid` application. See
:ref:`environment_chapter` for more information about these settings.
The name ``main`` in ``[app:main]`` signifies that this is the default
application run by ``pserve`` when it is invoked against this configuration
-file. The name ``main`` is a convention used by PasteDeploy signifying that
-it is the default application.
+file. The name ``main`` is a convention used by PasteDeploy signifying that it
+is the default application.
The ``[server:main]`` section of the configuration file configures a WSGI
-server which listens on TCP port 6543. It is configured to listen on all
-interfaces (``0.0.0.0``). This means that any remote system which has TCP
-access to your system can see your Pyramid application.
+server which listens on TCP port 6543. It is configured to listen on localhost
+only (``127.0.0.1``).
.. _MyProject_ini_logging:
-The sections that live between the markers ``# Begin logging configuration``
-and ``# End logging configuration`` represent Python's standard library
-:mod:`logging` module configuration for your application. The sections
-between these two markers are passed to the `logging module's config file
-configuration engine
+The sections after ``# logging configuration`` represent Python's standard
+library :mod:`logging` module configuration for your application. These
+sections are passed to the `logging module's config file configuration engine
<http://docs.python.org/howto/logging.html#configuring-logging>`_ when the
-``pserve`` or ``pshell`` commands are executed. The default
-configuration sends application logging output to the standard error output
-of your terminal. For more information about logging configuration, see
-:ref:`logging_chapter`.
+``pserve`` or ``pshell`` commands are executed. The default configuration
+sends application logging output to the standard error output of your terminal.
+For more information about logging configuration, see :ref:`logging_chapter`.
See the :term:`PasteDeploy` documentation for more information about other
types of things you can put into this ``.ini`` file, such as other
-applications, :term:`middleware` and alternate :term:`WSGI` server
+applications, :term:`middleware`, and alternate :term:`WSGI` server
implementations.
.. index::
single: production.ini
``production.ini``
-~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~
-The ``production.ini`` file is a :term:`PasteDeploy` configuration file with
-a purpose much like that of ``development.ini``. However, it disables the
-debug toolbar, and filters all log messages except those above the WARN
-level. It also turns off template development options such that templates
-are not automatically reloaded when changed, and turns off all debugging
-options. This file is appropriate to use instead of ``development.ini`` when
-you put your application into production.
+The ``production.ini`` file is a :term:`PasteDeploy` configuration file with a
+purpose much like that of ``development.ini``. However, it disables the debug
+toolbar, and filters all log messages except those above the WARN level. It
+also turns off template development options such that templates are not
+automatically reloaded when changed, and turns off all debugging options. This
+file is appropriate to use instead of ``development.ini`` when you put your
+application into production.
It's important to use ``production.ini`` (and *not* ``development.ini``) to
benchmark your application and put it into production. ``development.ini``
configures your system with a debug toolbar that helps development, but the
inclusion of this toolbar slows down page rendering times by over an order of
-magnitude. The debug toolbar is also a potential security risk if you have
-it configured incorrectly.
+magnitude. The debug toolbar is also a potential security risk if you have it
+configured incorrectly.
.. index::
single: MANIFEST.in
@@ -637,42 +646,40 @@ The ``MANIFEST.in`` file is a :term:`distutils` configuration file which
specifies the non-Python files that should be included when a
:term:`distribution` of your Pyramid project is created when you run ``python
setup.py sdist``. Due to the information contained in the default
-``MANIFEST.in``, an sdist of your Pyramid project will include ``.txt``
-files, ``.ini`` files, ``.rst`` files, graphics files, and template files, as
-well as ``.py`` files. See
+``MANIFEST.in``, an sdist of your Pyramid project will include ``.txt`` files,
+``.ini`` files, ``.rst`` files, graphics files, and template files, as well as
+``.py`` files. See
http://docs.python.org/distutils/sourcedist.html#the-manifest-in-template for
more information about the syntax and usage of ``MANIFEST.in``.
-Without the presence of a ``MANIFEST.in`` file or without checking your
-source code into a version control repository, ``setup.py sdist`` places only
-*Python source files* (files ending with a ``.py`` extension) into tarballs
-generated by ``python setup.py sdist``. This means, for example, if your
-project was not checked into a setuptools-compatible source control system,
-and your project directory didn't contain a ``MANIFEST.in`` file that told
-the ``sdist`` machinery to include ``*.pt`` files, the
-``myproject/templates/mytemplate.pt`` file would not be included in the
-generated tarball.
-
-Projects generated by Pyramid scaffolds include a default ``MANIFEST.in``
-file. The ``MANIFEST.in`` file contains declarations which tell it to
-include files like ``*.pt``, ``*.css`` and ``*.js`` in the generated tarball.
-If you include files with extensions other than the files named in the
-project's ``MANIFEST.in`` and you don't make use of a setuptools-compatible
-version control system, you'll need to edit the ``MANIFEST.in`` file and
-include the statements necessary to include your new files. See
-http://docs.python.org/distutils/sourcedist.html#principle for more
-information about how to do this.
-
-You can also delete ``MANIFEST.in`` from your project and rely on a
-setuptools feature which simply causes all files checked into a version
-control system to be put into the generated tarball. To allow this to
-happen, check all the files that you'd like to be distributed along with your
-application's Python files into Subversion. After you do this, when you
-rerun ``setup.py sdist``, all files checked into the version control system
-will be included in the tarball. If you don't use Subversion, and instead
-use a different version control system, you may need to install a setuptools
-add-on such as ``setuptools-git`` or ``setuptools-hg`` for this behavior to
-work properly.
+Without the presence of a ``MANIFEST.in`` file or without checking your source
+code into a version control repository, ``setup.py sdist`` places only *Python
+source files* (files ending with a ``.py`` extension) into tarballs generated
+by ``python setup.py sdist``. This means, for example, if your project was not
+checked into a setuptools-compatible source control system, and your project
+directory didn't contain a ``MANIFEST.in`` file that told the ``sdist``
+machinery to include ``*.pt`` files, the ``myproject/templates/mytemplate.pt``
+file would not be included in the generated tarball.
+
+Projects generated by Pyramid scaffolds include a default ``MANIFEST.in`` file.
+The ``MANIFEST.in`` file contains declarations which tell it to include files
+like ``*.pt``, ``*.css`` and ``*.js`` in the generated tarball. If you include
+files with extensions other than the files named in the project's
+``MANIFEST.in`` and you don't make use of a setuptools-compatible version
+control system, you'll need to edit the ``MANIFEST.in`` file and include the
+statements necessary to include your new files. See
+http://docs.python.org/distutils/sourcedist.html#principle for more information
+about how to do this.
+
+You can also delete ``MANIFEST.in`` from your project and rely on a setuptools
+feature which simply causes all files checked into a version control system to
+be put into the generated tarball. To allow this to happen, check all the
+files that you'd like to be distributed along with your application's Python
+files into Subversion. After you do this, when you rerun ``setup.py sdist``,
+all files checked into the version control system will be included in the
+tarball. If you don't use Subversion, and instead use a different version
+control system, you may need to install a setuptools add-on such as
+``setuptools-git`` or ``setuptools-hg`` for this behavior to work properly.
.. index::
single: setup.py
@@ -686,11 +693,11 @@ testing, packaging, and distributing your application.
.. note::
- ``setup.py`` is the de facto standard which Python developers use to
- distribute their reusable code. You can read more about ``setup.py`` files
- and their usage in the `Setuptools documentation
- <http://peak.telecommunity.com/DevCenter/setuptools>`_ and `The
- Hitchhiker's Guide to Packaging <http://guide.python-distribute.org/>`_.
+ ``setup.py`` is the de facto standard which Python developers use to
+ distribute their reusable code. You can read more about ``setup.py`` files
+ and their usage in the `Setuptools documentation
+ <http://peak.telecommunity.com/DevCenter/setuptools>`_ and `Python Packaging
+ User Guide <https://packaging.python.org/en/latest/>`_.
Our generated ``setup.py`` looks like this:
@@ -699,47 +706,47 @@ Our generated ``setup.py`` looks like this:
:linenos:
The ``setup.py`` file calls the setuptools ``setup`` function, which does
-various things depending on the arguments passed to ``setup.py`` on the
-command line.
+various things depending on the arguments passed to ``setup.py`` on the command
+line.
-Within the arguments to this function call, information about your
-application is kept. While it's beyond the scope of this documentation to
-explain everything about setuptools setup files, we'll provide a whirlwind
-tour of what exists in this file in this section.
+Within the arguments to this function call, information about your application
+is kept. While it's beyond the scope of this documentation to explain
+everything about setuptools setup files, we'll provide a whirlwind tour of what
+exists in this file in this section.
Your application's name can be any string; it is specified in the ``name``
field. The version number is specified in the ``version`` value. A short
-description is provided in the ``description`` field. The
-``long_description`` is conventionally the content of the README and CHANGES
-file appended together. The ``classifiers`` field is a list of `Trove
+description is provided in the ``description`` field. The ``long_description``
+is conventionally the content of the README and CHANGES file appended together.
+The ``classifiers`` field is a list of `Trove
<http://pypi.python.org/pypi?%3Aaction=list_classifiers>`_ classifiers
describing your application. ``author`` and ``author_email`` are text fields
which probably don't need any description. ``url`` is a field that should
-point at your application project's URL (if any).
-``packages=find_packages()`` causes all packages within the project to be
-found when packaging the application. ``include_package_data`` will include
-non-Python files when the application is packaged if those files are checked
-into version control. ``zip_safe`` indicates that this package is not safe
-to use as a zipped egg; instead it will always unpack as a directory, which
-is more convenient. ``install_requires`` and ``tests_require`` indicate that
-this package depends on the ``pyramid`` package. ``test_suite`` points at
-the package for our application, which means all tests found in the package
-will be run when ``setup.py test`` is invoked. We examined ``entry_points``
-in our discussion of the ``development.ini`` file; this file defines the
-``main`` entry point that represents our project's application.
-
-Usually you only need to think about the contents of the ``setup.py`` file
-when distributing your application to other people, when adding Python
-package dependencies, or when versioning your application for your own use.
-For fun, you can try this command now:
+point at your application project's URL (if any). ``packages=find_packages()``
+causes all packages within the project to be found when packaging the
+application. ``include_package_data`` will include non-Python files when the
+application is packaged if those files are checked into version control.
+``zip_safe`` indicates that this package is not safe to use as a zipped egg;
+instead it will always unpack as a directory, which is more convenient.
+``install_requires`` and ``tests_require`` indicate that this package depends
+on the ``pyramid`` package. ``test_suite`` points at the package for our
+application, which means all tests found in the package will be run when
+``setup.py test`` is invoked. We examined ``entry_points`` in our discussion
+of the ``development.ini`` file; this file defines the ``main`` entry point
+that represents our project's application.
+
+Usually you only need to think about the contents of the ``setup.py`` file when
+distributing your application to other people, when adding Python package
+dependencies, or when versioning your application for your own use. For fun,
+you can try this command now:
.. code-block:: text
- $ python setup.py sdist
+ $ $VENV/bin/python setup.py sdist
-This will create a tarball of your application in a ``dist`` subdirectory
-named ``MyProject-0.1.tar.gz``. You can send this tarball to other people
-who want to install and use your application.
+This will create a tarball of your application in a ``dist`` subdirectory named
+``MyProject-0.1.tar.gz``. You can send this tarball to other people who want
+to install and use your application.
.. index::
single: package
@@ -750,25 +757,22 @@ The ``myproject`` :term:`Package`
The ``myproject`` :term:`package` lives inside the ``MyProject``
:term:`project`. It contains:
-#. An ``__init__.py`` file signifies that this is a Python :term:`package`.
- It also contains code that helps users run the application, including a
+#. An ``__init__.py`` file signifies that this is a Python :term:`package`. It
+ also contains code that helps users run the application, including a
``main`` function which is used as a entry point for commands such as
``pserve``, ``pshell``, ``pviews``, and others.
-#. A ``templates`` directory, which contains :term:`Chameleon` (or
- other types of) templates.
+#. A ``templates`` directory, which contains :term:`Chameleon` (or other types
+ of) templates.
-#. A ``tests.py`` module, which contains unit test code for the
- application.
+#. A ``tests.py`` module, which contains unit test code for the application.
-#. A ``views.py`` module, which contains view code for the
- application.
+#. A ``views.py`` module, which contains view code for the application.
-These are purely conventions established by the scaffold:
-:app:`Pyramid` doesn't insist that you name things in any particular way.
-However, it's generally a good idea to follow Pyramid standards for naming,
-so that other Pyramid developers can get up to speed quickly on your code
-when you need help.
+These are purely conventions established by the scaffold. :app:`Pyramid`
+doesn't insist that you name things in any particular way. However, it's
+generally a good idea to follow Pyramid standards for naming, so that other
+Pyramid developers can get up to speed quickly on your code when you need help.
.. index::
single: __init__.py
@@ -802,11 +806,11 @@ also informs Python that the directory which contains it is a *package*.
specify renderers with the ``.pt`` extension.
Line 9 registers a static view, which will serve up the files from the
- ``myproject:static`` :term:`asset specification` (the ``static``
- directory of the ``myproject`` package).
+ ``myproject:static`` :term:`asset specification` (the ``static`` directory
+ of the ``myproject`` package).
- Line 10 adds a :term:`route` to the configuration. This route is later
- used by a view in the ``views`` module.
+ Line 10 adds a :term:`route` to the configuration. This route is later used
+ by a view in the ``views`` module.
Line 11 calls ``config.scan()``, which picks up view registrations declared
elsewhere in the package (in this case, in the ``views.py`` module).
@@ -822,64 +826,63 @@ also informs Python that the directory which contains it is a *package*.
Much of the heavy lifting in a :app:`Pyramid` application is done by *view
callables*. A :term:`view callable` is the main tool of a :app:`Pyramid` web
-application developer; it is a bit of code which accepts a :term:`request`
-and which returns a :term:`response`.
+application developer; it is a bit of code which accepts a :term:`request` and
+which returns a :term:`response`.
.. literalinclude:: MyProject/myproject/views.py
:language: python
:linenos:
Lines 4-6 define and register a :term:`view callable` named ``my_view``. The
-function named ``my_view`` is decorated with a ``view_config`` decorator
-(which is processed by the ``config.scan()`` line in our ``__init__.py``).
-The view_config decorator asserts that this view be found when a
-:term:`route` named ``home`` is matched. In our case, because our
-``__init__.py`` maps the route named ``home`` to the URL pattern ``/``, this
-route will match when a visitor visits the root URL. The view_config
-decorator also names a ``renderer``, which in this case is a template that
-will be used to render the result of the view callable. This particular view
-declaration points at ``templates/mytemplate.pt``, which is a :term:`asset
-specification` that specifies the ``mytemplate.pt`` file within the
-``templates`` directory of the ``myproject`` package. The asset
-specification could have also been specified as
-``myproject:templates/mytemplate.pt``; the leading package name and colon is
-optional. The template file pointed to is a :term:`Chameleon` ZPT
-template file (``templates/my_template.pt``).
+function named ``my_view`` is decorated with a ``view_config`` decorator (which
+is processed by the ``config.scan()`` line in our ``__init__.py``). The
+view_config decorator asserts that this view be found when a :term:`route`
+named ``home`` is matched. In our case, because our ``__init__.py`` maps the
+route named ``home`` to the URL pattern ``/``, this route will match when a
+visitor visits the root URL. The view_config decorator also names a
+``renderer``, which in this case is a template that will be used to render the
+result of the view callable. This particular view declaration points at
+``templates/mytemplate.pt``, which is an :term:`asset specification` that
+specifies the ``mytemplate.pt`` file within the ``templates`` directory of the
+``myproject`` package. The asset specification could have also been specified
+as ``myproject:templates/mytemplate.pt``; the leading package name and colon is
+optional. The template file pointed to is a :term:`Chameleon` ZPT template
+file (``templates/my_template.pt``).
This view callable function is handed a single piece of information: the
-:term:`request`. The *request* is an instance of the :term:`WebOb`
-``Request`` class representing the browser's request to our server.
+:term:`request`. The *request* is an instance of the :term:`WebOb` ``Request``
+class representing the browser's request to our server.
This view is configured to invoke a :term:`renderer` on a template. The
dictionary the view returns (on line 6) provides the value the renderer
-substitutes into the template when generating HTML. The renderer then
-returns the HTML in a :term:`response`.
+substitutes into the template when generating HTML. The renderer then returns
+the HTML in a :term:`response`.
.. note:: Dictionaries provide values to :term:`template`\s.
.. note:: When the application is run with the scaffold's :ref:`default
- development.ini <MyProject_ini>` configuration :ref:`logging is set up
+ development.ini <MyProject_ini>` configuration, :ref:`logging is set up
<MyProject_ini_logging>` to aid debugging. If an exception is raised,
uncaught tracebacks are displayed after the startup messages on :ref:`the
console running the server <running_the_project_application>`. Also
- ``print()`` statements may be inserted into the application for debugging
- to send output to this console.
+ ``print()`` statements may be inserted into the application for debugging to
+ send output to this console.
.. note:: ``development.ini`` has a setting that controls how templates are
reloaded, ``pyramid.reload_templates``.
- - When set to ``True`` (as in the scaffold ``development.ini``) changed
+ - When set to ``True`` (as in the scaffold ``development.ini``), changed
templates automatically reload without a server restart. This is
convenient while developing, but slows template rendering speed.
- - When set to ``False`` (the default value), changing templates requires
- a server restart to reload them. Production applications should use
+ - When set to ``False`` (the default value), changing templates requires a
+ server restart to reload them. Production applications should use
``pyramid.reload_templates = False``.
.. seealso::
- See also :ref:`views_which_use_a_renderer` for more information
- about how views, renderers, and templates relate and cooperate.
+ See also :ref:`views_which_use_a_renderer` for more information about how
+ views, renderers, and templates relate and cooperate.
.. seealso::
@@ -905,10 +908,10 @@ template. It includes CSS and images.
``templates/mytemplate.pt``
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The single :term:`Chameleon` template that exists in the project. Its
+This is the single :term:`Chameleon` template that exists in the project. Its
contents are too long to show here, but it displays a default page when
-rendered. It is referenced by the call to ``@view_config`` as the
-``renderer`` of the ``my_view`` view callable in the ``views.py`` file. See
+rendered. It is referenced by the call to ``@view_config`` as the ``renderer``
+of the ``my_view`` view callable in the ``views.py`` file. See
:ref:`views_which_use_a_renderer` for more information about renderers.
Templates are accessed and used by view configurations and sometimes by view
@@ -925,13 +928,13 @@ The ``tests.py`` module includes unit tests for your application.
.. literalinclude:: MyProject/myproject/tests.py
:language: python
+ :lines: 1-17
:linenos:
This sample ``tests.py`` file has a single unit test defined within it. This
-test is executed when you run ``python setup.py test``. You may add more
-tests here as you build your application. You are not required to write
-tests to use :app:`Pyramid`, this file is simply provided as convenience and
-example.
+test is executed when you run ``python setup.py test``. You may add more tests
+here as you build your application. You are not required to write tests to use
+:app:`Pyramid`. This file is simply provided for convenience and example.
See :ref:`testing_chapter` for more information about writing :app:`Pyramid`
unit tests.
@@ -942,30 +945,30 @@ unit tests.
.. _modifying_package_structure:
Modifying Package Structure
-----------------------------
+---------------------------
It is best practice for your application's code layout to not stray too much
-from accepted Pyramid scaffold defaults. If you refrain from changing
-things very much, other Pyramid coders will be able to more quickly
-understand your application. However, the code layout choices made for you
-by a scaffold are in no way magical or required. Despite the choices
-made for you by any scaffold, you can decide to lay your code out any
-way you see fit.
+from accepted Pyramid scaffold defaults. If you refrain from changing things
+very much, other Pyramid coders will be able to more quickly understand your
+application. However, the code layout choices made for you by a scaffold are
+in no way magical or required. Despite the choices made for you by any
+scaffold, you can decide to lay your code out any way you see fit.
For example, the configuration method named
:meth:`~pyramid.config.Configurator.add_view` requires you to pass a
:term:`dotted Python name` or a direct object reference as the class or
-function to be used as a view. By default, the ``starter`` scaffold would
-have you add view functions to the ``views.py`` module in your package.
-However, you might be more comfortable creating a ``views`` *directory*, and
-adding a single file for each view.
+function to be used as a view. By default, the ``starter`` scaffold would have
+you add view functions to the ``views.py`` module in your package. However, you
+might be more comfortable creating a ``views`` *directory*, and adding a single
+file for each view.
If your project package name was ``myproject`` and you wanted to arrange all
your views in a Python subpackage within the ``myproject`` :term:`package`
-named ``views`` instead of within a single ``views.py`` file, you might:
+named ``views`` instead of within a single ``views.py`` file, you might do the
+following.
-- Create a ``views`` directory inside your ``myproject`` package directory
- (the same directory which holds ``views.py``).
+- Create a ``views`` directory inside your ``myproject`` package directory (the
+ same directory which holds ``views.py``).
- Create a file within the new ``views`` directory named ``__init__.py``. (It
can be empty. This just tells Python that the ``views`` directory is a
@@ -977,72 +980,70 @@ named ``views`` instead of within a single ``views.py`` file, you might:
specification` values in ``blog.py`` must now be fully qualified with the
project's package name (``myproject:templates/blog.pt``).
-You can then continue to add view callable functions to the ``blog.py``
-module, but you can also add other ``.py`` files which contain view callable
-functions to the ``views`` directory. As long as you use the
-``@view_config`` directive to register views in conjunction with
-``config.scan()`` they will be picked up automatically when the application
-is restarted.
+You can then continue to add view callable functions to the ``blog.py`` module,
+but you can also add other ``.py`` files which contain view callable functions
+to the ``views`` directory. As long as you use the ``@view_config`` directive
+to register views in conjunction with ``config.scan()``, they will be picked up
+automatically when the application is restarted.
Using the Interactive Shell
---------------------------
It is possible to use the ``pshell`` command to load a Python interpreter
-prompt with a similar configuration as would be loaded if you were running
-your Pyramid application via ``pserve``. This can be a useful debugging tool.
-See :ref:`interactive_shell` for more details.
+prompt with a similar configuration as would be loaded if you were running your
+Pyramid application via ``pserve``. This can be a useful debugging tool. See
+:ref:`interactive_shell` for more details.
.. _what_is_this_pserve_thing:
What Is This ``pserve`` Thing
-----------------------------
-The code generated by an :app:`Pyramid` scaffold assumes that you will be
-using the ``pserve`` command to start your application while you do
-development. ``pserve`` is a command that reads a :term:`PasteDeploy`
-``.ini`` file (e.g. ``development.ini``) and configures a server to serve a
-Pyramid application based on the data in the file.
+The code generated by a :app:`Pyramid` scaffold assumes that you will be using
+the ``pserve`` command to start your application while you do development.
+``pserve`` is a command that reads a :term:`PasteDeploy` ``.ini`` file (e.g.,
+``development.ini``), and configures a server to serve a :app:`Pyramid`
+application based on the data in the file.
``pserve`` is by no means the only way to start up and serve a :app:`Pyramid`
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 ``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.
+run a :app:`Pyramid` application is purely conventional based on the output 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:
Using an Alternate WSGI Server
------------------------------
-Pyramid scaffolds generate projects which use the :term:`Waitress` WSGI
-server. Waitress is a server that is suited for development and light
-production usage. It's not the fastest nor the most featureful WSGI server.
-Instead, its main feature is that it works on all platforms that Pyramid
-needs to run on, making it a good choice as a default server from the
-perspective of Pyramid's developers.
+Pyramid scaffolds generate projects which use the :term:`Waitress` WSGI server.
+Waitress is a server that is suited for development and light production
+usage. It's not the fastest nor the most featureful WSGI server. Instead, its
+main feature is that it works on all platforms that Pyramid needs to run on,
+making it a good choice as a default server from the perspective of Pyramid's
+developers.
Any WSGI server is capable of running a :app:`Pyramid` application. But we
-suggest you stick with the default server for development, and that you wait
-to investigate other server options until you're ready to deploy your
-application to production. Unless for some reason you need to develop on a
-non-local system, investigating alternate server options is usually a
-distraction until you're ready to deploy. But we recommend developing using
-the default configuration on a local system that you have complete control
-over; it will provide the best development experience.
+suggest you stick with the default server for development, and that you wait to
+investigate other server options until you're ready to deploy your application
+to production. Unless for some reason you need to develop on a non-local
+system, investigating alternate server options is usually a distraction until
+you're ready to deploy. But we recommend developing using the default
+configuration on a local system that you have complete control over; it will
+provide the best development experience.
One popular production alternative to the default Waitress server is
-:term:`mod_wsgi`. You can use mod_wsgi to serve your :app:`Pyramid`
-application using the Apache web server rather than any "pure-Python" server
-like Waitress. It is fast and featureful. See :ref:`modwsgi_tutorial` for
-details.
+:term:`mod_wsgi`. You can use mod_wsgi to serve your :app:`Pyramid` application
+using the Apache web server rather than any "pure-Python" server like Waitress.
+It is fast and featureful. See :ref:`modwsgi_tutorial` for details.
Another good production alternative is :term:`Green Unicorn` (aka
-``gunicorn``). It's faster than Waitress and slightly easier to configure
-than mod_wsgi, although it depends, in its default configuration, on having a
-buffering HTTP proxy in front of it. It does not, as of this writing, work
-on Windows.
+``gunicorn``). It's faster than Waitress and slightly easier to configure than
+mod_wsgi, although it depends, in its default configuration, on having a
+buffering HTTP proxy in front of it. It does not, as of this writing, work on
+Windows.
diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst
index 4f8c4bf77..50e85813a 100644
--- a/docs/narr/renderers.rst
+++ b/docs/narr/renderers.rst
@@ -5,8 +5,8 @@ Renderers
A view callable needn't *always* return a :term:`Response` object. If a view
happens to return something which does not implement the Pyramid Response
-interface, :app:`Pyramid` will attempt to use a :term:`renderer` to construct
-a response. For example:
+interface, :app:`Pyramid` will attempt to use a :term:`renderer` to construct a
+response. For example:
.. code-block:: python
:linenos:
@@ -17,27 +17,26 @@ a response. For example:
def hello_world(request):
return {'content':'Hello!'}
-The above example returns a *dictionary* from the view callable. A
-dictionary does not implement the Pyramid response interface, so you might
-believe that this example would fail. However, since a ``renderer`` is
-associated with the view callable through its :term:`view configuration` (in
-this case, using a ``renderer`` argument passed to
-:func:`~pyramid.view.view_config`), if the view does *not* return a Response
-object, the renderer will attempt to convert the result of the view to a
-response on the developer's behalf.
+The above example returns a *dictionary* from the view callable. A dictionary
+does not implement the Pyramid response interface, so you might believe that
+this example would fail. However, since a ``renderer`` is associated with the
+view callable through its :term:`view configuration` (in this case, using a
+``renderer`` argument passed to :func:`~pyramid.view.view_config`), if the view
+does *not* return a Response object, the renderer will attempt to convert the
+result of the view to a response on the developer's behalf.
-Of course, if no renderer is associated with a view's configuration,
-returning anything except an object which implements the Response interface
-will result in an error. And, if a renderer *is* used, whatever is returned
-by the view must be compatible with the particular kind of renderer used, or
-an error may occur during view invocation.
+Of course, if no renderer is associated with a view's configuration, returning
+anything except an object which implements the Response interface will result
+in an error. And, if a renderer *is* used, whatever is returned by the view
+must be compatible with the particular kind of renderer used, or an error may
+occur during view invocation.
-One exception exists: it is *always* OK to return a Response object, even
-when a ``renderer`` is configured. In such cases, the renderer is
-bypassed entirely.
+One exception exists: it is *always* OK to return a Response object, even when
+a ``renderer`` is configured. In such cases, the renderer is bypassed
+entirely.
-Various types of renderers exist, including serialization renderers
-and renderers which use templating systems.
+Various types of renderers exist, including serialization renderers and
+renderers which use templating systems.
.. index::
single: renderer
@@ -49,19 +48,19 @@ Writing View Callables Which Use a Renderer
-------------------------------------------
As we've seen, a view callable needn't always return a Response object.
-Instead, it may return an arbitrary Python object, with the expectation that
-a :term:`renderer` will convert that object into a response instance on your
-behalf. Some renderers use a templating system; other renderers use object
-serialization techniques. In practice, renderers obtain application data
-values from Python dictionaries so, in practice, view callables which use
+Instead, it may return an arbitrary Python object, with the expectation that a
+:term:`renderer` will convert that object into a response instance on your
+behalf. Some renderers use a templating system, while other renderers use
+object serialization techniques. In practice, renderers obtain application
+data values from Python dictionaries so, in practice, view callables which use
renderers return Python dictionaries.
View callables can :ref:`explicitly call <example_render_to_response_call>`
renderers, but typically don't. Instead view configuration declares the
renderer used to render a view callable's results. This is done with the
``renderer`` attribute. For example, this call to
-:meth:`~pyramid.config.Configurator.add_view` associates the ``json``
-renderer with a view callable:
+:meth:`~pyramid.config.Configurator.add_view` associates the ``json`` renderer
+with a view callable:
.. code-block:: python
@@ -71,19 +70,19 @@ When this configuration is added to an application, the
``myproject.views.my_view`` view callable will now use a ``json`` renderer,
which renders view return values to a :term:`JSON` response serialization.
-Pyramid defines several :ref:`built_in_renderers`, and additional renderers
-can be added by developers to the system as necessary.
-See :ref:`adding_and_overriding_renderers`.
+Pyramid defines several :ref:`built_in_renderers`, and additional renderers can
+be added by developers to the system as necessary. See
+:ref:`adding_and_overriding_renderers`.
Views which use a renderer and return a non-Response value can vary non-body
response attributes (such as headers and the HTTP status code) by attaching a
-property to the ``request.response`` attribute.
-See :ref:`request_response_attr`.
+property to the ``request.response`` attribute. See
+:ref:`request_response_attr`.
As already mentioned, if the :term:`view callable` associated with a
-:term:`view configuration` returns a Response object (or its instance),
-any renderer associated with the view configuration is ignored,
-and the response is passed back to :app:`Pyramid` unchanged. For example:
+:term:`view configuration` returns a Response object (or its instance), any
+renderer associated with the view configuration is ignored, and the response is
+passed back to :app:`Pyramid` unchanged. For example:
.. code-block:: python
:linenos:
@@ -126,7 +125,7 @@ avoid rendering:
.. _built_in_renderers:
-Built-In Renderers
+Built-in Renderers
------------------
Several built-in renderers exist in :app:`Pyramid`. These renderers can be
@@ -134,8 +133,8 @@ used in the ``renderer`` attribute of view configurations.
.. note::
- Bindings for officially supported templating languages can be found
- at :ref:`available_template_system_bindings`.
+ Bindings for officially supported templating languages can be found at
+ :ref:`available_template_system_bindings`.
.. index::
pair: renderer; string
@@ -143,17 +142,15 @@ used in the ``renderer`` attribute of view configurations.
``string``: String Renderer
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The ``string`` renderer renders a view callable result to
-a string. If a view callable returns a non-Response object, and the
-``string`` renderer is associated in that view's configuration, the result
-will be to run the object through the Python ``str`` function to generate a
-string. Note that if a Unicode object is returned by the view callable, it
-is not ``str()`` -ified.
+The ``string`` renderer renders a view callable result to a string. If a view
+callable returns a non-Response object, and the ``string`` renderer is
+associated in that view's configuration, the result will be to run the object
+through the Python ``str`` function to generate a string. Note that if a
+Unicode object is returned by the view callable, it is not ``str()``-ified.
Here's an example of a view that returns a dictionary. If the ``string``
-renderer is specified in the configuration for this view, the view will
-render the returned dictionary to the ``str()`` representation of the
-dictionary:
+renderer is specified in the configuration for this view, the view will render
+the returned dictionary to the ``str()`` representation of the dictionary:
.. code-block:: python
:linenos:
@@ -164,8 +161,8 @@ dictionary:
def hello_world(request):
return {'content':'Hello!'}
-The body of the response returned by such a view will be a string
-representing the ``str()`` serialization of the return value:
+The body of the response returned by such a view will be a string representing
+the ``str()`` serialization of the return value:
.. code-block:: python
@@ -184,13 +181,13 @@ JSON Renderer
~~~~~~~~~~~~~
The ``json`` renderer renders view callable results to :term:`JSON`. By
-default, it passes the return value through the ``json.dumps`` standard
-library function, and wraps the result in a response object. It also sets
-the response content-type to ``application/json``.
+default, it passes the return value through the ``json.dumps`` standard library
+function, and wraps the result in a response object. It also sets the response
+content-type to ``application/json``.
Here's an example of a view that returns a dictionary. Since the ``json``
-renderer is specified in the configuration for this view, the view will
-render the returned dictionary to a JSON serialization:
+renderer is specified in the configuration for this view, the view will render
+the returned dictionary to a JSON serialization:
.. code-block:: python
:linenos:
@@ -201,8 +198,8 @@ render the returned dictionary to a JSON serialization:
def hello_world(request):
return {'content':'Hello!'}
-The body of the response returned by such a view will be a string
-representing the JSON serialization of the return value:
+The body of the response returned by such a view will be a string representing
+the JSON serialization of the return value:
.. code-block:: python
@@ -211,8 +208,8 @@ representing the JSON serialization of the return value:
The return value needn't be a dictionary, but the return value must contain
values serializable by the configured serializer (by default ``json.dumps``).
-You can configure a view to use the JSON renderer by naming``json`` as the
-``renderer`` argument of a view configuration, e.g. by using
+You can configure a view to use the JSON renderer by naming ``json`` as the
+``renderer`` argument of a view configuration, e.g., by using
:meth:`~pyramid.config.Configurator.add_view`:
.. code-block:: python
@@ -224,7 +221,7 @@ You can configure a view to use the JSON renderer by naming``json`` as the
renderer='json')
Views which use the JSON renderer can vary non-body response attributes by
-using the api of the ``request.response`` attribute. See
+using the API of the ``request.response`` attribute. See
:ref:`request_response_attr`.
.. _json_serializing_custom_objects:
@@ -232,23 +229,23 @@ using the api of the ``request.response`` attribute. See
Serializing Custom Objects
++++++++++++++++++++++++++
-Some objects are not, by default, JSON-serializable (such as datetimes and
-other arbitrary Python objects). You can, however, register code that makes
+Some objects are not, by default, JSON-serializable (such as datetimes and
+other arbitrary Python objects). You can, however, register code that makes
non-serializable objects serializable in two ways:
-- By defining a ``__json__`` method on objects in your application.
+- Define a ``__json__`` method on objects in your application.
-- For objects you don't "own", you can register JSON renderer that knows about
- an *adapter* for that kind of object.
+- For objects you don't "own", you can register a JSON renderer that knows
+ about an *adapter* for that kind of object.
Using a Custom ``__json__`` Method
**********************************
Custom objects can be made easily JSON-serializable in Pyramid by defining a
``__json__`` method on the object's class. This method should return values
-natively JSON-serializable (such as ints, lists, dictionaries, strings, and
-so forth). It should accept a single additional argument, ``request``, which
-will be the active request object at render time.
+natively JSON-serializable (such as ints, lists, dictionaries, strings, and so
+forth). It should accept a single additional argument, ``request``, which will
+be the active request object at render time.
.. code-block:: python
:linenos:
@@ -272,14 +269,14 @@ will be the active request object at render time.
Using the ``add_adapter`` Method of a Custom JSON Renderer
**********************************************************
-If you aren't the author of the objects being serialized, it won't be
-possible (or at least not reasonable) to add a custom ``__json__`` method
-to their classes in order to influence serialization. If the object passed
-to the renderer is not a serializable type, and has no ``__json__`` method,
-usually a :exc:`TypeError` will be raised during serialization. You can
-change this behavior by creating a custom JSON renderer and adding adapters
-to handle custom types. The renderer will attempt to adapt non-serializable
-objects using the registered adapters. A short example follows:
+If you aren't the author of the objects being serialized, it won't be possible
+(or at least not reasonable) to add a custom ``__json__`` method to their
+classes in order to influence serialization. If the object passed to the
+renderer is not a serializable type and has no ``__json__`` method, usually a
+:exc:`TypeError` will be raised during serialization. You can change this
+behavior by creating a custom JSON renderer and adding adapters to handle
+custom types. The renderer will attempt to adapt non-serializable objects using
+the registered adapters. A short example follows:
.. code-block:: python
:linenos:
@@ -294,16 +291,17 @@ objects using the registered adapters. A short example follows:
json_renderer.add_adapter(datetime.datetime, datetime_adapter)
config.add_renderer('json', json_renderer)
-The ``add_adapter`` method should accept two arguments: the *class* of the object that you want this adapter to run for (in the example above,
+The ``add_adapter`` method should accept two arguments: the *class* of the
+object that you want this adapter to run for (in the example above,
``datetime.datetime``), and the adapter itself.
-The adapter should be a callable. It should accept two arguments: the object
-needing to be serialized and ``request``, which will be the current request
-object at render time. The adapter should raise a :exc:`TypeError`
-if it can't determine what to do with the object.
+The adapter should be a callable. It should accept two arguments: the object
+needing to be serialized and ``request``, which will be the current request
+object at render time. The adapter should raise a :exc:`TypeError` if it can't
+determine what to do with the object.
-See :class:`pyramid.renderers.JSON` and
-:ref:`adding_and_overriding_renderers` for more information.
+See :class:`pyramid.renderers.JSON` and :ref:`adding_and_overriding_renderers`
+for more information.
.. versionadded:: 1.4
Serializing custom objects.
@@ -319,12 +317,12 @@ JSONP Renderer
.. versionadded:: 1.1
:class:`pyramid.renderers.JSONP` is a `JSONP
-<http://en.wikipedia.org/wiki/JSONP>`_ renderer factory helper which
-implements a hybrid json/jsonp renderer. JSONP is useful for making
-cross-domain AJAX requests.
+<http://en.wikipedia.org/wiki/JSONP>`_ renderer factory helper which implements
+a hybrid JSON/JSONP renderer. JSONP is useful for making cross-domain AJAX
+requests.
-Unlike other renderers, a JSONP renderer needs to be configured at startup
-time "by hand". Configure a JSONP renderer using the
+Unlike other renderers, a JSONP renderer needs to be configured at startup time
+"by hand". Configure a JSONP renderer using the
:meth:`pyramid.config.Configurator.add_renderer` method:
.. code-block:: python
@@ -355,8 +353,8 @@ When a view is called that uses a JSONP renderer:
renderer (by default, ``callback``), the renderer will return a JSONP
response.
-- If there is no callback parameter in the request's query string, the
- renderer will return a 'plain' JSON response.
+- If there is no callback parameter in the request's query string, the renderer
+ will return a "plain" JSON response.
Javscript library AJAX functionality will help you make JSONP requests.
For example, JQuery has a `getJSON function
@@ -364,7 +362,7 @@ For example, JQuery has a `getJSON function
complicated) functionality in its `ajax function
<http://api.jquery.com/jQuery.ajax/>`_.
-For example (Javascript):
+For example (JavaScript):
.. code-block:: javascript
@@ -375,10 +373,9 @@ For example (Javascript):
'&callback=?';
jqhxr = $.getJSON(api_url);
-The string ``callback=?`` above in the ``url`` param to the JQuery
-``getJSON`` function indicates to jQuery that the query should be made as
-a JSONP request; the ``callback`` parameter will be automatically filled
-in for you and used.
+The string ``callback=?`` above in the ``url`` param to the JQuery ``getJSON``
+function indicates to jQuery that the query should be made as a JSONP request;
+the ``callback`` parameter will be automatically filled in for you and used.
The same custom-object serialization scheme defined used for a "normal" JSON
renderer in :ref:`json_serializing_custom_objects` can be used when passing
@@ -397,10 +394,9 @@ Before a response constructed by a :term:`renderer` is returned to
:app:`Pyramid`, several attributes of the request are examined which have the
potential to influence response behavior.
-View callables that don't directly return a response should use the API of
-the :class:`pyramid.response.Response` attribute available as
-``request.response`` during their execution, to influence associated response
-behavior.
+View callables that don't directly return a response should use the API of the
+:class:`pyramid.response.Response` attribute, available as ``request.response``
+during their execution, to influence associated response behavior.
For example, if you need to change the response status from within a view
callable that uses a renderer, assign the ``status`` attribute to the
@@ -419,7 +415,7 @@ callable that uses a renderer, assign the ``status`` attribute to the
Note that mutations of ``request.response`` in views which return a Response
object directly will have no effect unless the response object returned *is*
``request.response``. For example, the following example calls
-``request.response.set_cookie``, but this call will have no effect, because a
+``request.response.set_cookie``, but this call will have no effect because a
different Response object is returned.
.. code-block:: python
@@ -441,8 +437,8 @@ effect, you must return ``request.response``:
request.response.set_cookie('abc', '123')
return request.response
-For more information on attributes of the request, see the API documentation
-in :ref:`request_module`. For more information on the API of
+For more information on attributes of the request, see the API documentation in
+:ref:`request_module`. For more information on the API of
``request.response``, see :attr:`pyramid.request.Request.response`.
.. _adding_and_overriding_renderers:
@@ -481,10 +477,9 @@ You may add a new renderer by creating and registering a :term:`renderer
factory`.
A renderer factory implementation should conform to the
-:class:`pyramid.interfaces.IRendererFactory` interface. It should be capable
-of creating an object that conforms to the
-:class:`pyramid.interfaces.IRenderer` interface. A typical class that follows
-this setup is as follows:
+:class:`pyramid.interfaces.IRendererFactory` interface. It should be capable of
+creating an object that conforms to the :class:`pyramid.interfaces.IRenderer`
+interface. A typical class that follows this setup is as follows:
.. code-block:: python
:linenos:
@@ -504,38 +499,36 @@ this setup is as follows:
the result (a string or unicode object). The value is
the return value of a view. The system value is a
dictionary containing available system values
- (e.g. view, context, and request). """
+ (e.g., view, context, and request). """
The formal interface definition of the ``info`` object passed to a renderer
factory constructor is available as :class:`pyramid.interfaces.IRendererInfo`.
There are essentially two different kinds of renderer factories:
-- A renderer factory which expects to accept an :term:`asset
- specification`, or an absolute path, as the ``name`` attribute of the
- ``info`` object fed to its constructor. These renderer factories are
- registered with a ``name`` value that begins with a dot (``.``). These
- types of renderer factories usually relate to a file on the filesystem,
- such as a template.
+- A renderer factory which expects to accept an :term:`asset specification`, or
+ an absolute path, as the ``name`` attribute of the ``info`` object fed to its
+ constructor. These renderer factories are registered with a ``name`` value
+ that begins with a dot (``.``). These types of renderer factories usually
+ relate to a file on the filesystem, such as a template.
-- A renderer factory which expects to accept a token that does not represent
- a filesystem path or an asset specification in the ``name``
- attribute of the ``info`` object fed to its constructor. These renderer
- factories are registered with a ``name`` value that does not begin with a
- dot. These renderer factories are typically object serializers.
+- A renderer factory which expects to accept a token that does not represent a
+ filesystem path or an asset specification in the ``name`` attribute of the
+ ``info`` object fed to its constructor. These renderer factories are
+ registered with a ``name`` value that does not begin with a dot. These
+ renderer factories are typically object serializers.
.. sidebar:: Asset Specifications
- An asset specification is a colon-delimited identifier for an
- :term:`asset`. The colon separates a Python :term:`package`
- name from a package subpath. For example, the asset
- specification ``my.package:static/baz.css`` identifies the file named
- ``baz.css`` in the ``static`` subdirectory of the ``my.package`` Python
- :term:`package`.
+ An asset specification is a colon-delimited identifier for an :term:`asset`.
+ The colon separates a Python :term:`package` name from a package subpath.
+ For example, the asset specification ``my.package:static/baz.css``
+ identifies the file named ``baz.css`` in the ``static`` subdirectory of the
+ ``my.package`` Python :term:`package`.
Here's an example of the registration of a simple renderer factory via
-:meth:`~pyramid.config.Configurator.add_renderer`, where ``config``
-is an instance of :meth:`pyramid.config.Configurator`:
+:meth:`~pyramid.config.Configurator.add_renderer`, where ``config`` is an
+instance of :meth:`pyramid.config.Configurator`:
.. code-block:: python
@@ -556,16 +549,15 @@ renderer by specifying ``amf`` in the ``renderer`` attribute of a
def myview(request):
return {'Hello':'world'}
-At startup time, when a :term:`view configuration` is encountered, which
-has a ``name`` attribute that does not contain a dot, the full ``name``
-value is used to construct a renderer from the associated renderer
-factory. In this case, the view configuration will create an instance
-of an ``MyAMFRenderer`` for each view configuration which includes ``amf``
-as its renderer value. The ``name`` passed to the ``MyAMFRenderer``
-constructor will always be ``amf``.
+At startup time, when a :term:`view configuration` is encountered which has a
+``name`` attribute that does not contain a dot, the full ``name`` value is used
+to construct a renderer from the associated renderer factory. In this case,
+the view configuration will create an instance of an ``MyAMFRenderer`` for each
+view configuration which includes ``amf`` as its renderer value. The ``name``
+passed to the ``MyAMFRenderer`` constructor will always be ``amf``.
-Here's an example of the registration of a more complicated renderer
-factory, which expects to be passed a filesystem path:
+Here's an example of the registration of a more complicated renderer factory,
+which expects to be passed a filesystem path:
.. code-block:: python
@@ -585,24 +577,23 @@ the ``renderer`` attribute of a :term:`view configuration`:
def myview(request):
return {'Hello':'world'}
-When a :term:`view configuration` is encountered at startup time, which
-has a ``name`` attribute that does contain a dot, the value of the name
-attribute is split on its final dot. The second element of the split is
-typically the filename extension. This extension is used to look up a
-renderer factory for the configured view. Then the value of
-``renderer`` is passed to the factory to create a renderer for the view.
-In this case, the view configuration will create an instance of a
-``MyJinja2Renderer`` for each view configuration which includes anything
-ending with ``.jinja2`` in its ``renderer`` value. The ``name`` passed
-to the ``MyJinja2Renderer`` constructor will be the full value that was
-set as ``renderer=`` in the view configuration.
+When a :term:`view configuration` is encountered at startup time which has a
+``name`` attribute that does contain a dot, the value of the name attribute is
+split on its final dot. The second element of the split is typically the
+filename extension. This extension is used to look up a renderer factory for
+the configured view. Then the value of ``renderer`` is passed to the factory
+to create a renderer for the view. In this case, the view configuration will
+create an instance of a ``MyJinja2Renderer`` for each view configuration which
+includes anything ending with ``.jinja2`` in its ``renderer`` value. The
+``name`` passed to the ``MyJinja2Renderer`` constructor will be the full value
+that was set as ``renderer=`` in the view configuration.
Adding a Default Renderer
~~~~~~~~~~~~~~~~~~~~~~~~~
-To associate a *default* renderer with *all* view configurations (even
-ones which do not possess a ``renderer`` attribute), pass ``None`` as
-the ``name`` attribute to the renderer tag:
+To associate a *default* renderer with *all* view configurations (even ones
+which do not possess a ``renderer`` attribute), pass ``None`` as the ``name``
+attribute to the renderer tag:
.. code-block:: python
@@ -616,40 +607,40 @@ Changing an Existing Renderer
Pyramid supports overriding almost every aspect of its setup through its
:ref:`Conflict Resolution <automatic_conflict_resolution>` mechanism. This
-means that in most cases overriding a renderer is as simple as using the
-:meth:`pyramid.config.Configurator.add_renderer` method to re-define the
-template extension. For example, if you would like to override the ``.txt``
-extension to specify a new renderer you could do the following:
+means that, in most cases, overriding a renderer is as simple as using the
+:meth:`pyramid.config.Configurator.add_renderer` method to redefine the
+template extension. For example, if you would like to override the ``json``
+renderer to specify a new renderer, you could do the following:
.. code-block:: python
json_renderer = pyramid.renderers.JSON()
config.add_renderer('json', json_renderer)
-After doing this, any views registered with the ``json`` renderer will use
-the new renderer.
+After doing this, any views registered with the ``json`` renderer will use the
+new renderer.
.. index::
pair: renderer; overriding at runtime
-Overriding A Renderer At Runtime
+Overriding a Renderer at Runtime
--------------------------------
.. warning:: This is an advanced feature, not typically used by "civilians".
In some circumstances, it is necessary to instruct the system to ignore the
static renderer declaration provided by the developer in view configuration,
-replacing the renderer with another *after a request starts*. For example,
-an "omnipresent" XML-RPC implementation that detects that the request is from
-an XML-RPC client might override a view configuration statement made by the
-user instructing the view to use a template renderer with one that uses an
-XML-RPC renderer. This renderer would produce an XML-RPC representation of
-the data returned by an arbitrary view callable.
+replacing the renderer with another *after a request starts*. For example, an
+"omnipresent" XML-RPC implementation that detects that the request is from an
+XML-RPC client might override a view configuration statement made by the user
+instructing the view to use a template renderer with one that uses an XML-RPC
+renderer. This renderer would produce an XML-RPC representation of the data
+returned by an arbitrary view callable.
To use this feature, create a :class:`~pyramid.events.NewRequest`
:term:`subscriber` which sniffs at the request data and which conditionally
-sets an ``override_renderer`` attribute on the request itself, which is the
-*name* of a registered renderer. For example:
+sets an ``override_renderer`` attribute on the request itself, which in turn is
+the *name* of a registered renderer. For example:
.. code-block:: python
:linenos:
@@ -670,6 +661,6 @@ sets an ``override_renderer`` attribute on the request itself, which is the
request.override_renderer = 'xmlrpc'
return True
-The result of such a subscriber will be to replace any existing static
-renderer configured by the developer with a (notional, nonexistent) XML-RPC
-renderer if the request appears to come from an XML-RPC client.
+The result of such a subscriber will be to replace any existing static renderer
+configured by the developer with a (notional, nonexistent) XML-RPC renderer, if
+the request appears to come from an XML-RPC client.
diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst
index 6139154ff..92139c0ff 100644
--- a/docs/narr/resources.rst
+++ b/docs/narr/resources.rst
@@ -3,50 +3,47 @@
Resources
=========
-A :term:`resource` is an object that represents a "place" in a tree
-related to your application. Every :app:`Pyramid` application has at
-least one resource object: the :term:`root` resource. Even if you don't
-define a root resource manually, a default one is created for you. The
-root resource is the root of a :term:`resource tree`. A resource tree
-is a set of nested dictionary-like objects which you can use to
-represent your website's structure.
+A :term:`resource` is an object that represents a "place" in a tree related to
+your application. Every :app:`Pyramid` application has at least one resource
+object: the :term:`root` resource. Even if you don't define a root resource
+manually, a default one is created for you. The root resource is the root of a
+:term:`resource tree`. A resource tree is a set of nested dictionary-like
+objects which you can use to represent your website's structure.
In an application which uses :term:`traversal` to map URLs to code, the
resource tree structure is used heavily to map each URL to a :term:`view
-callable`. When :term:`traversal` is used, :app:`Pyramid` will walk
-through the resource tree by traversing through its nested dictionary
-structure in order to find a :term:`context` resource. Once a context
-resource is found, the context resource and data in the request will be
-used to find a :term:`view callable`.
+callable`. When :term:`traversal` is used, :app:`Pyramid` will walk through
+the resource tree by traversing through its nested dictionary structure in
+order to find a :term:`context` resource. Once a context resource is found,
+the context resource and data in the request will be used to find a :term:`view
+callable`.
In an application which uses :term:`URL dispatch`, the resource tree is only
used indirectly, and is often "invisible" to the developer. In URL dispatch
applications, the resource "tree" is often composed of only the root resource
-by itself. This root resource sometimes has security declarations attached
-to it, but is not required to have any. In general, the resource tree is
-much less important in applications that use URL dispatch than applications
-that use traversal.
+by itself. This root resource sometimes has security declarations attached to
+it, but is not required to have any. In general, the resource tree is much
+less important in applications that use URL dispatch than applications that use
+traversal.
In "Zope-like" :app:`Pyramid` applications, resource objects also often store
data persistently, and offer methods related to mutating that persistent data.
-In these kinds of applications, resources not only represent the site
-structure of your website, but they become the :term:`domain model` of the
-application.
+In these kinds of applications, resources not only represent the site structure
+of your website, but they become the :term:`domain model` of the application.
Also:
- The ``context`` and ``containment`` predicate arguments to
:meth:`~pyramid.config.Configurator.add_view` (or a
- :func:`~pyramid.view.view_config` decorator) reference a resource class
- or resource :term:`interface`.
+ :func:`~pyramid.view.view_config` decorator) reference a resource class or
+ resource :term:`interface`.
- A :term:`root factory` returns a resource.
-- A resource is exposed to :term:`view` code as the :term:`context` of a
- view.
+- A resource is exposed to :term:`view` code as the :term:`context` of a view.
- Various helpful :app:`Pyramid` API methods expect a resource as an argument
- (e.g. :meth:`~pyramid.request.Request.resource_url` and others).
+ (e.g., :meth:`~pyramid.request.Request.resource_url` and others).
.. index::
single: resource tree
@@ -58,27 +55,26 @@ Also:
Defining a Resource Tree
------------------------
-When :term:`traversal` is used (as opposed to a purely :term:`url dispatch`
+When :term:`traversal` is used (as opposed to a purely :term:`URL dispatch`
based application), :app:`Pyramid` expects to be able to traverse a tree
-composed of resources (the :term:`resource tree`). Traversal begins at a
-root resource, and descends into the tree recursively, trying each resource's
+composed of resources (the :term:`resource tree`). Traversal begins at a root
+resource, and descends into the tree recursively, trying each resource's
``__getitem__`` method to resolve a path segment to another resource object.
-:app:`Pyramid` imposes the following policy on resource instances in the
-tree:
+:app:`Pyramid` imposes the following policy on resource instances in the tree:
-- A container resource (a resource which contains other resources) must
- supply a ``__getitem__`` method which is willing to resolve a unicode name
- to a sub-resource. If a sub-resource by a particular name does not exist
- in a container resource, ``__getitem__`` method of the container resource
- must raise a :exc:`KeyError`. If a sub-resource by that name *does* exist,
- the container's ``__getitem__`` should return the sub-resource.
+- A container resource (a resource which contains other resources) must supply
+ a ``__getitem__`` method which is willing to resolve a Unicode name to a
+ sub-resource. If a sub-resource by a particular name does not exist in a
+ container resource, the ``__getitem__`` method of the container resource must
+ raise a :exc:`KeyError`. If a sub-resource by that name *does* exist, the
+ container's ``__getitem__`` should return the sub-resource.
- Leaf resources, which do not contain other resources, must not implement a
``__getitem__``, or if they do, their ``__getitem__`` method must always
raise a :exc:`KeyError`.
-See :ref:`traversal_chapter` for more information about how traversal
-works against resource instances.
+See :ref:`traversal_chapter` for more information about how traversal works
+against resource instances.
Here's a sample resource tree, represented by a variable named ``root``:
@@ -90,8 +86,8 @@ Here's a sample resource tree, represented by a variable named ``root``:
root = Resource({'a':Resource({'b':Resource({'c':Resource()})})})
-The resource tree we've created above is represented by a dictionary-like
-root object which has a single child named ``'a'``. ``'a'`` has a single child
+The resource tree we've created above is represented by a dictionary-like root
+object which has a single child named ``'a'``. ``'a'`` has a single child
named ``'b'``, and ``'b'`` has a single child named ``'c'``, which has no
children. It is therefore possible to access the ``'c'`` leaf resource like so:
@@ -100,20 +96,20 @@ children. It is therefore possible to access the ``'c'`` leaf resource like so:
root['a']['b']['c']
-If you returned the above ``root`` object from a :term:`root factory`, the
-path ``/a/b/c`` would find the ``'c'`` object in the resource tree as the
-result of :term:`traversal`.
+If you returned the above ``root`` object from a :term:`root factory`, the path
+``/a/b/c`` would find the ``'c'`` object in the resource tree as the result of
+:term:`traversal`.
-In this example, each of the resources in the tree is of the same class.
-This is not a requirement. Resource elements in the tree can be of any type.
-We used a single class to represent all resources in the tree for the sake of
+In this example, each of the resources in the tree is of the same class. This
+is not a requirement. Resource elements in the tree can be of any type. We
+used a single class to represent all resources in the tree for the sake of
simplicity, but in a "real" app, the resources in the tree can be arbitrary.
-Although the example tree above can service a traversal, the resource
-instances in the above example are not aware of :term:`location`, so their
-utility in a "real" application is limited. To make best use of built-in
-:app:`Pyramid` API facilities, your resources should be "location-aware".
-The next section details how to make resources location-aware.
+Although the example tree above can service a traversal, the resource instances
+in the above example are not aware of :term:`location`, so their utility in a
+"real" application is limited. To make best use of built-in :app:`Pyramid` API
+facilities, your resources should be "location-aware". The next section details
+how to make resources location-aware.
.. index::
pair: location-aware; resource
@@ -125,16 +121,16 @@ Location-Aware Resources
In order for certain :app:`Pyramid` location, security, URL-generation, and
traversal APIs to work properly against the resources in a resource tree, all
-resources in the tree must be :term:`location` -aware. This means they must
+resources in the tree must be :term:`location`-aware. This means they must
have two attributes: ``__parent__`` and ``__name__``.
-The ``__parent__`` attribute of a location-aware resource should be a
-reference to the resource's parent resource instance in the tree. The
-``__name__`` attribute should be the name with which a resource's parent
-refers to the resource via ``__getitem__``.
+The ``__parent__`` attribute of a location-aware resource should be a reference
+to the resource's parent resource instance in the tree. The ``__name__``
+attribute should be the name with which a resource's parent refers to the
+resource via ``__getitem__``.
-The ``__parent__`` of the root resource should be ``None`` and its
-``__name__`` should be the empty string. For instance:
+The ``__parent__`` of the root resource should be ``None`` and its ``__name__``
+should be the empty string. For instance:
.. code-block:: python
:linenos:
@@ -143,18 +139,18 @@ The ``__parent__`` of the root resource should be ``None`` and its
__name__ = ''
__parent__ = None
-A resource returned from the root resource's ``__getitem__`` method should
-have a ``__parent__`` attribute that is a reference to the root resource, and
-its ``__name__`` attribute should match the name by which it is reachable via
-the root resource's ``__getitem__``. A container resource within the root
-resource should have a ``__getitem__`` that returns resources with a
-``__parent__`` attribute that points at the container, and these subobjects
-should have a ``__name__`` attribute that matches the name by which they are
-retrieved from the container via ``__getitem__``. This pattern continues
-recursively "up" the tree from the root.
+A resource returned from the root resource's ``__getitem__`` method should have
+a ``__parent__`` attribute that is a reference to the root resource, and its
+``__name__`` attribute should match the name by which it is reachable via the
+root resource's ``__getitem__``. A container resource within the root resource
+should have a ``__getitem__`` that returns resources with a ``__parent__``
+attribute that points at the container, and these sub-objects should have a
+``__name__`` attribute that matches the name by which they are retrieved from
+the container via ``__getitem__``. This pattern continues recursively "up" the
+tree from the root.
The ``__parent__`` attributes of each resource form a linked list that points
-"downwards" toward the root. This is analogous to the `..` entry in
+"downwards" toward the root. This is analogous to the ``..`` entry in
filesystem directories. If you follow the ``__parent__`` values from any
resource in the resource tree, you will eventually come to the root resource,
just like if you keep executing the ``cd ..`` filesystem command, eventually
@@ -162,44 +158,41 @@ you will reach the filesystem root directory.
.. warning::
- If your root resource has a ``__name__`` argument that is not
- ``None`` or the empty string, URLs returned by the
- :func:`~pyramid.request.Request.resource_url` function and paths generated
+ If your root resource has a ``__name__`` argument that is not ``None`` or
+ the empty string, URLs returned by the
+ :func:`~pyramid.request.Request.resource_url` function, and paths generated
by the :func:`~pyramid.traversal.resource_path` and
- :func:`~pyramid.traversal.resource_path_tuple` APIs will be generated
+ :func:`~pyramid.traversal.resource_path_tuple` APIs, will be generated
improperly. The value of ``__name__`` will be prepended to every path and
- URL generated (as opposed to a single leading slash or empty tuple
- element).
+ URL generated (as opposed to a single leading slash or empty tuple element).
.. sidebar:: For your convenience
- If you'd rather not manage the ``__name__`` and ``__parent__`` attributes
- of your resources "by hand", an add-on package named
+ If you'd rather not manage the ``__name__`` and ``__parent__`` attributes of
+ your resources "by hand", an add-on package named
:mod:`pyramid_traversalwrapper` can help.
In order to use this helper feature, you must first install the
:mod:`pyramid_traversalwrapper` package (available via PyPI), then register
- its ``ModelGraphTraverser`` as the traversal policy, rather than the
- default :app:`Pyramid` traverser. The package contains instructions for
- doing so.
-
- Once :app:`Pyramid` is configured with this feature, you will no longer
- need to manage the ``__parent__`` and ``__name__`` attributes on resource
- objects "by hand". Instead, as necessary, during traversal :app:`Pyramid`
- will wrap each resource (even the root resource) in a ``LocationProxy``
- which will dynamically assign a ``__name__`` and a ``__parent__`` to the
- traversed resource (based on the last traversed resource and the name
- supplied to ``__getitem__``). The root resource will have a ``__name__``
- attribute of ``None`` and a ``__parent__`` attribute of ``None``.
-
-Applications which use tree-walking :app:`Pyramid` APIs require
-location-aware resources. These APIs include (but are not limited to)
+ its ``ModelGraphTraverser`` as the traversal policy, rather than the default
+ :app:`Pyramid` traverser. The package contains instructions for doing so.
+
+ Once :app:`Pyramid` is configured with this feature, you will no longer need
+ to manage the ``__parent__`` and ``__name__`` attributes on resource objects
+ "by hand". Instead, as necessary during traversal, :app:`Pyramid` will wrap
+ each resource (even the root resource) in a ``LocationProxy``, which will
+ dynamically assign a ``__name__`` and a ``__parent__`` to the traversed
+ resource, based on the last traversed resource and the name supplied to
+ ``__getitem__``. The root resource will have a ``__name__`` attribute of
+ ``None`` and a ``__parent__`` attribute of ``None``.
+
+Applications which use tree-walking :app:`Pyramid` APIs require location-aware
+resources. These APIs include (but are not limited to)
:meth:`~pyramid.request.Request.resource_url`,
-:func:`~pyramid.traversal.find_resource`,
-:func:`~pyramid.traversal.find_root`,
+:func:`~pyramid.traversal.find_resource`, :func:`~pyramid.traversal.find_root`,
:func:`~pyramid.traversal.find_interface`,
:func:`~pyramid.traversal.resource_path`,
-:func:`~pyramid.traversal.resource_path_tuple`, or
+:func:`~pyramid.traversal.resource_path_tuple`,
:func:`~pyramid.traversal.traverse`, :func:`~pyramid.traversal.virtual_root`,
and (usually) :meth:`~pyramid.request.Request.has_permission` and
:func:`~pyramid.security.principals_allowed_by_permission`.
@@ -214,15 +207,15 @@ location-aware.
.. _generating_the_url_of_a_resource:
-Generating The URL Of A Resource
+Generating the URL of a Resource
--------------------------------
-If your resources are :term:`location` aware, you can use the
+If your resources are :term:`location`-aware, you can use the
:meth:`pyramid.request.Request.resource_url` API to generate a URL for the
resource. This URL will use the resource's position in the parent tree to
create a resource path, and it will prefix the path with the current
-application URL to form a fully-qualified URL with the scheme, host, port,
-and path. You can also pass extra arguments to
+application URL to form a fully-qualified URL with the scheme, host, port, and
+path. You can also pass extra arguments to
:meth:`~pyramid.request.Request.resource_url` to influence the generated URL.
The simplest call to :meth:`~pyramid.request.Request.resource_url` looks like
@@ -237,17 +230,17 @@ The ``request`` in the above example is an instance of a :app:`Pyramid`
:term:`request` object.
If the resource referred to as ``resource`` in the above example was the root
-resource, and the host that was used to contact the server was
-``example.com``, the URL generated would be ``http://example.com/``.
-However, if the resource was a child of the root resource named ``a``, the
-generated URL would be ``http://example.com/a/``.
+resource, and the host that was used to contact the server was ``example.com``,
+the URL generated would be ``http://example.com/``. However, if the resource
+was a child of the root resource named ``a``, the generated URL would be
+``http://example.com/a/``.
A slash is appended to all resource URLs when
-:meth:`~pyramid.request.Request.resource_url` is used to generate them in
-this simple manner, because resources are "places" in the hierarchy, and URLs
-are meant to be clicked on to be visited. Relative URLs that you include on
-HTML pages rendered as the result of the default view of a resource are more
-apt to be relative to these resources than relative to their parent.
+:meth:`~pyramid.request.Request.resource_url` is used to generate them in this
+simple manner, because resources are "places" in the hierarchy, and URLs are
+meant to be clicked on to be visited. Relative URLs that you include on HTML
+pages rendered as the result of the default view of a resource are more apt to
+be relative to these resources than relative to their parent.
You can also pass extra elements to
:meth:`~pyramid.request.Request.resource_url`:
@@ -258,12 +251,12 @@ You can also pass extra elements to
url = request.resource_url(resource, 'foo', 'bar')
If the resource referred to as ``resource`` in the above example was the root
-resource, and the host that was used to contact the server was
-``example.com``, the URL generated would be ``http://example.com/foo/bar``.
-Any number of extra elements can be passed to
-:meth:`~pyramid.request.Request.resource_url` as extra positional arguments.
-When extra elements are passed, they are appended to the resource's URL. A
-slash is not appended to the final segment when elements are passed.
+resource, and the host that was used to contact the server was ``example.com``,
+the URL generated would be ``http://example.com/foo/bar``. Any number of extra
+elements can be passed to :meth:`~pyramid.request.Request.resource_url` as
+extra positional arguments. When extra elements are passed, they are appended
+to the resource's URL. A slash is not appended to the final segment when
+elements are passed.
You can also pass a query string:
@@ -273,16 +266,16 @@ You can also pass a query string:
url = request.resource_url(resource, query={'a':'1'})
If the resource referred to as ``resource`` in the above example was the root
-resource, and the host that was used to contact the server was
-``example.com``, the URL generated would be ``http://example.com/?a=1``.
+resource, and the host that was used to contact the server was ``example.com``,
+the URL generated would be ``http://example.com/?a=1``.
When a :term:`virtual root` is active, the URL generated by
:meth:`~pyramid.request.Request.resource_url` for a resource may be "shorter"
than its physical tree path. See :ref:`virtual_root_support` for more
information about virtually rooting a resource.
-For more information about generating resource URLs, see the documentation
-for :meth:`pyramid.request.Request.resource_url`.
+For more information about generating resource URLs, see the documentation for
+:meth:`pyramid.request.Request.resource_url`.
.. index::
pair: resource URL generation; overriding
@@ -292,10 +285,10 @@ for :meth:`pyramid.request.Request.resource_url`.
Overriding Resource URL Generation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If a resource object implements a ``__resource_url__`` method, this method
-will be called when :meth:`~pyramid.request.Request.resource_url` is called
-to generate a URL for the resource, overriding the default URL returned for
-the resource by :meth:`~pyramid.request.Request.resource_url`.
+If a resource object implements a ``__resource_url__`` method, this method will
+be called when :meth:`~pyramid.request.Request.resource_url` is called to
+generate a URL for the resource, overriding the default URL returned for the
+resource by :meth:`~pyramid.request.Request.resource_url`.
The ``__resource_url__`` hook is passed two arguments: ``request`` and
``info``. ``request`` is the :term:`request` object passed to
@@ -304,21 +297,21 @@ the following keys:
``physical_path``
A string representing the "physical path" computed for the resource, as
- defined by ``pyramid.traversal.resource_path(resource)``. It will begin
- and end with a slash.
+ defined by ``pyramid.traversal.resource_path(resource)``. It will begin and
+ end with a slash.
``virtual_path``
A string representing the "virtual path" computed for the resource, as
defined by :ref:`virtual_root_support`. This will be identical to the
- physical path if virtual rooting is not enabled. It will begin and end
- with a slash.
+ physical path if virtual rooting is not enabled. It will begin and end with
+ a slash.
``app_url``
A string representing the application URL generated during
``request.resource_url``. It will not end with a slash. It represents a
- potentially customized URL prefix, containing potentially custom scheme,
- host and port information passed by the user to ``request.resource_url``.
- It should be preferred over use of ``request.application_url``.
+ potentially customized URL prefix, containing potentially custom scheme, host
+ and port information passed by the user to ``request.resource_url``. It
+ should be preferred over use of ``request.application_url``.
The ``__resource_url__`` method of a resource should return a string
representing a URL. If it cannot override the default, it should return
@@ -335,12 +328,12 @@ Here's an example ``__resource_url__`` method.
The above example actually just generates and returns the default URL, which
would have been what was generated by the default ``resource_url`` machinery,
-but your code can perform arbitrary logic as necessary. For example, your
-code may wish to override the hostname or port number of the generated URL.
+but your code can perform arbitrary logic as necessary. For example, your code
+may wish to override the hostname or port number of the generated URL.
-Note that the URL generated by ``__resource_url__`` should be fully
-qualified, should end in a slash, and should not contain any query string or
-anchor elements (only path elements) to work with
+Note that the URL generated by ``__resource_url__`` should be fully qualified,
+should end in a slash, and should not contain any query string or anchor
+elements (only path elements) to work with
:meth:`~pyramid.request.Request.resource_url`.
.. index::
@@ -350,9 +343,8 @@ Generating the Path To a Resource
---------------------------------
:func:`pyramid.traversal.resource_path` returns a string object representing
-the absolute physical path of the resource object based on its position in
-the resource tree. Each segment of the path is separated with a slash
-character.
+the absolute physical path of the resource object based on its position in the
+resource tree. Each segment of the path is separated with a slash character.
.. code-block:: python
:linenos:
@@ -378,8 +370,8 @@ If ``resource`` in the example above was accessible in the tree as
The resource passed in must be :term:`location`-aware.
-The presence or absence of a :term:`virtual root` has no impact on the
-behavior of :func:`~pyramid.traversal.resource_path`.
+The presence or absence of a :term:`virtual root` has no impact on the behavior
+of :func:`~pyramid.traversal.resource_path`.
.. index::
pair: resource; finding by path
@@ -387,8 +379,8 @@ behavior of :func:`~pyramid.traversal.resource_path`.
Finding a Resource by Path
--------------------------
-If you have a string path to a resource, you can grab the resource from
-that place in the application's resource tree using
+If you have a string path to a resource, you can grab the resource from that
+place in the application's resource tree using
:func:`pyramid.traversal.find_resource`.
You can resolve an absolute path by passing a string prefixed with a ``/`` as
@@ -400,8 +392,9 @@ the ``path`` argument:
from pyramid.traversal import find_resource
url = find_resource(anyresource, '/path')
-Or you can resolve a path relative to the resource you pass in by passing a
-string that isn't prefixed by ``/``:
+Or you can resolve a path relative to the resource that you pass in to
+:func:`pyramid.traversal.find_resource` by passing a string that isn't prefixed
+by ``/``:
.. code-block:: python
:linenos:
@@ -410,8 +403,8 @@ string that isn't prefixed by ``/``:
url = find_resource(anyresource, 'path')
Often the paths you pass to :func:`~pyramid.traversal.find_resource` are
-generated by the :func:`~pyramid.traversal.resource_path` API. These APIs
-are "mirrors" of each other.
+generated by the :func:`~pyramid.traversal.resource_path` API. These APIs are
+"mirrors" of each other.
If the path cannot be resolved when calling
:func:`~pyramid.traversal.find_resource` (if the respective resource in the
@@ -427,10 +420,10 @@ Obtaining the Lineage of a Resource
-----------------------------------
:func:`pyramid.location.lineage` returns a generator representing the
-:term:`lineage` of the :term:`location` aware :term:`resource` object.
+:term:`lineage` of the :term:`location`-aware :term:`resource` object.
-The :func:`~pyramid.location.lineage` function returns the resource it is
-passed, then each parent of the resource, in order. For example, if the
+The :func:`~pyramid.location.lineage` function returns the resource that is
+passed into it, then each parent of the resource in order. For example, if the
resource tree is composed like so:
.. code-block:: python
@@ -451,18 +444,18 @@ list, we will get:
list(lineage(thing2))
[ <Thing object at thing2>, <Thing object at thing1> ]
-The generator returned by :func:`~pyramid.location.lineage` first returns the
-resource it was passed unconditionally. Then, if the resource supplied a
-``__parent__`` attribute, it returns the resource represented by
-``resource.__parent__``. If *that* resource has a ``__parent__`` attribute,
-return that resource's parent, and so on, until the resource being inspected
-either has no ``__parent__`` attribute or has a ``__parent__`` attribute of
-``None``.
+The generator returned by :func:`~pyramid.location.lineage` first returns
+unconditionally the resource that was passed into it. Then, if the resource
+supplied a ``__parent__`` attribute, it returns the resource represented by
+``resource.__parent__``. If *that* resource has a ``__parent__`` attribute, it
+will return that resource's parent, and so on, until the resource being
+inspected either has no ``__parent__`` attribute or has a ``__parent__``
+attribute of ``None``.
See the documentation for :func:`pyramid.location.lineage` for more
information.
-Determining if a Resource is In The Lineage of Another Resource
+Determining if a Resource is in the Lineage of Another Resource
---------------------------------------------------------------
Use the :func:`pyramid.location.inside` function to determine if one resource
@@ -479,12 +472,12 @@ For example, if the resource tree is:
b = Thing()
b.__parent__ = a
-Calling ``inside(b, a)`` will return ``True``, because ``b`` has a lineage
-that includes ``a``. However, calling ``inside(a, b)`` will return ``False``
+Calling ``inside(b, a)`` will return ``True``, because ``b`` has a lineage that
+includes ``a``. However, calling ``inside(a, b)`` will return ``False``
because ``a`` does not have a lineage that includes ``b``.
The argument list for :func:`~pyramid.location.inside` is ``(resource1,
-resource2)``. ``resource1`` is 'inside' ``resource2`` if ``resource2`` is a
+resource2)``. ``resource1`` is "inside" ``resource2`` if ``resource2`` is a
:term:`lineage` ancestor of ``resource1``. It is a lineage ancestor if its
parent (or one of its parent's parents, etc.) is an ancestor.
@@ -497,9 +490,9 @@ Finding the Root Resource
-------------------------
Use the :func:`pyramid.traversal.find_root` API to find the :term:`root`
-resource. The root resource is the root resource of the :term:`resource
-tree`. The API accepts a single argument: ``resource``. This is a resource
-that is :term:`location` aware. It can be any resource in the tree for which
+resource. The root resource is the resource at the root of the :term:`resource
+tree`. The API accepts a single argument: ``resource``. This is a resource
+that is :term:`location`-aware. It can be any resource in the tree for which
you want to find the root.
For example, if the resource tree is:
@@ -518,9 +511,9 @@ Calling ``find_root(b)`` will return ``a``.
The root resource is also available as ``request.root`` within :term:`view
callable` code.
-The presence or absence of a :term:`virtual root` has no impact on the
-behavior of :func:`~pyramid.traversal.find_root`. The root object returned
-is always the *physical* root object.
+The presence or absence of a :term:`virtual root` has no impact on the behavior
+of :func:`~pyramid.traversal.find_root`. The root object returned is always
+the *physical* root object.
.. index::
single: resource interfaces
@@ -531,19 +524,18 @@ Resources Which Implement Interfaces
------------------------------------
Resources can optionally be made to implement an :term:`interface`. An
-interface is used to tag a resource object with a "type" that can later be
+interface is used to tag a resource object with a "type" that later can be
referred to within :term:`view configuration` and by
:func:`pyramid.traversal.find_interface`.
Specifying an interface instead of a class as the ``context`` or
``containment`` predicate arguments within :term:`view configuration`
statements makes it possible to use a single view callable for more than one
-class of resource object. If your application is simple enough that you see
-no reason to want to do this, you can skip reading this section of the
-chapter.
+class of resource objects. If your application is simple enough that you see
+no reason to want to do this, you can skip reading this section of the chapter.
-For example, here's some code which describes a blog entry which also
-declares that the blog entry implements an :term:`interface`.
+For example, here's some code which describes a blog entry which also declares
+that the blog entry implements an :term:`interface`.
.. code-block:: python
:linenos:
@@ -577,10 +569,10 @@ resource implements an interface by using the
``BlogEntry`` resource implements the ``IBlogEntry`` interface.
You can also specify that a particular resource *instance* provides an
-interface, as opposed to its class. When you declare that a class implements
-an interface, all instances of that class will also provide that interface.
-However, you can also just say that a single object provides the interface.
-To do so, use the :func:`zope.interface.directlyProvides` function:
+interface as opposed to its class. When you declare that a class implements an
+interface, all instances of that class will also provide that interface.
+However, you can also just say that a single object provides the interface. To
+do so, use the :func:`zope.interface.directlyProvides` function:
.. code-block:: python
:linenos:
@@ -603,9 +595,9 @@ To do so, use the :func:`zope.interface.directlyProvides` function:
directlyProvides(entry, IBlogEntry)
:func:`zope.interface.directlyProvides` will replace any existing interface
-that was previously provided by an instance. If a resource object already
-has instance-level interface declarations that you don't want to replace, use
-the :func:`zope.interface.alsoProvides` function:
+that was previously provided by an instance. If a resource object already has
+instance-level interface declarations that you don't want to replace, use the
+:func:`zope.interface.alsoProvides` function:
.. code-block:: python
:linenos:
@@ -632,8 +624,8 @@ the :func:`zope.interface.alsoProvides` function:
directlyProvides(entry, IBlogEntry1)
alsoProvides(entry, IBlogEntry2)
-:func:`zope.interface.alsoProvides` will augment the set of interfaces
-directly provided by an instance instead of overwriting them like
+:func:`zope.interface.alsoProvides` will augment the set of interfaces directly
+provided by an instance instead of overwriting them like
:func:`zope.interface.directlyProvides` does.
For more information about how resource interfaces can be used by view
@@ -642,7 +634,7 @@ configuration, see :ref:`using_resource_interfaces`.
.. index::
pair: resource; finding by interface or class
-Finding a Resource With a Class or Interface in Lineage
+Finding a Resource with a Class or Interface in Lineage
-------------------------------------------------------
Use the :func:`~pyramid.traversal.find_interface` API to locate a parent that
@@ -662,18 +654,19 @@ For example, if your resource tree is composed as follows:
Calling ``find_interface(a, Thing1)`` will return the ``a`` resource because
``a`` is of class ``Thing1`` (the resource passed as the first argument is
-considered first, and is returned if the class or interface spec matches).
+considered first, and is returned if the class or interface specification
+matches).
Calling ``find_interface(b, Thing1)`` will return the ``a`` resource because
-``a`` is of class ``Thing1`` and ``a`` is the first resource in ``b``'s
-lineage of this class.
+``a`` is of class ``Thing1`` and ``a`` is the first resource in ``b``'s lineage
+of this class.
Calling ``find_interface(b, Thing2)`` will return the ``b`` resource.
-The second argument to find_interface may also be a :term:`interface` instead
-of a class. If it is an interface, each resource in the lineage is checked
-to see if the resource implements the specificed interface (instead of seeing
-if the resource is of a class).
+The second argument to ``find_interface`` may also be a :term:`interface`
+instead of a class. If it is an interface, each resource in the lineage is
+checked to see if the resource implements the specificed interface (instead of
+seeing if the resource is of a class).
.. seealso::
@@ -690,18 +683,17 @@ A resource object is used as the :term:`context` provided to a view. See
:ref:`traversal_chapter` and :ref:`urldispatch_chapter` for more information
about how a resource object becomes the context.
-The APIs provided by :ref:`traversal_module` are used against resource
-objects. These functions can be used to find the "path" of a resource, the
-root resource in a resource tree, or to generate a URL for a resource.
+The APIs provided by :ref:`traversal_module` are used against resource objects.
+These functions can be used to find the "path" of a resource, the root resource
+in a resource tree, or to generate a URL for a resource.
-The APIs provided by :ref:`location_module` are used against resources.
-These can be used to walk down a resource tree, or conveniently locate one
-resource "inside" another.
-
-Some APIs on the :class:`pyramid.request.Request` accept a resource object as a parameter.
-For example, the :meth:`~pyramid.request.Request.has_permission` API accepts a
-resource object as one of its arguments; the ACL is obtained from this
-resource or one of its ancestors. Other security related APIs on the
-:class:`pyramid.request.Request` class also accept :term:`context` as an argument,
-and a context is always a resource.
+The APIs provided by :ref:`location_module` are used against resources. These
+can be used to walk down a resource tree, or conveniently locate one resource
+"inside" another.
+Some APIs on the :class:`pyramid.request.Request` accept a resource object as a
+parameter. For example, the :meth:`~pyramid.request.Request.has_permission` API
+accepts a resource object as one of its arguments; the ACL is obtained from
+this resource or one of its ancestors. Other security related APIs on the
+:class:`pyramid.request.Request` class also accept :term:`context` as an
+argument, and a context is always a resource.
diff --git a/docs/narr/router.rst b/docs/narr/router.rst
index ac3deefdc..e02142e6e 100644
--- a/docs/narr/router.rst
+++ b/docs/narr/router.rst
@@ -9,17 +9,20 @@
Request Processing
==================
+.. image:: ../_static/pyramid_request_processing.*
+ :alt: Request Processing
+
Once a :app:`Pyramid` application is up and running, it is ready to accept
requests and return responses. What happens from the time a :term:`WSGI`
request enters a :app:`Pyramid` application through to the point that
:app:`Pyramid` hands off a response back to WSGI for upstream processing?
-#. A user initiates a request from his browser to the hostname and port
+#. A user initiates a request from their browser to the hostname and port
number of the WSGI server used by the :app:`Pyramid` application.
#. The WSGI server used by the :app:`Pyramid` application passes the WSGI
- environment to the ``__call__`` method of the :app:`Pyramid`
- :term:`router` object.
+ environment to the ``__call__`` method of the :app:`Pyramid` :term:`router`
+ object.
#. A :term:`request` object is created based on the WSGI environment.
@@ -32,41 +35,40 @@ request enters a :app:`Pyramid` application through to the point that
#. A :class:`~pyramid.events.NewRequest` :term:`event` is sent to any
subscribers.
-#. If any :term:`route` has been defined within application configuration,
- the :app:`Pyramid` :term:`router` calls a :term:`URL dispatch` "route
- mapper." The job of the mapper is to examine the request to determine
- whether any user-defined :term:`route` matches the current WSGI
- environment. The :term:`router` passes the request as an argument to the
- mapper.
+#. If any :term:`route` has been defined within application configuration, the
+ :app:`Pyramid` :term:`router` calls a :term:`URL dispatch` "route mapper."
+ The job of the mapper is to examine the request to determine whether any
+ user-defined :term:`route` matches the current WSGI environment. The
+ :term:`router` passes the request as an argument to the mapper.
#. If any route matches, the route mapper adds attributes to the request:
``matchdict`` and ``matched_route`` attributes are added to the request
object. The former contains a dictionary representing the matched dynamic
- elements of the request's ``PATH_INFO`` value, the latter contains the
+ elements of the request's ``PATH_INFO`` value, and the latter contains the
:class:`~pyramid.interfaces.IRoute` object representing the route which
- matched. The root object associated with the route found is also
- generated: if the :term:`route configuration` which matched has an
- associated ``factory`` argument, this factory is used to generate the
- root object, otherwise a default :term:`root factory` is used.
-
-#. If a route match was *not* found, and a ``root_factory`` argument was
- passed to the :term:`Configurator` constructor, that callable is used to
- generate the root object. If the ``root_factory`` argument passed to the
+ matched. The root object associated with the route found is also generated:
+ if the :term:`route configuration` which matched has an associated
+ ``factory`` argument, this factory is used to generate the root object,
+ otherwise a default :term:`root factory` is used.
+
+#. If a route match was *not* found, and a ``root_factory`` argument was passed
+ to the :term:`Configurator` constructor, that callable is used to generate
+ the root object. If the ``root_factory`` argument passed to the
Configurator constructor was ``None``, a default root factory is used to
generate a root object.
-#. The :app:`Pyramid` router calls a "traverser" function with the root
- object and the request. The traverser function attempts to traverse the
- root object (using any existing ``__getitem__`` on the root object and
+#. The :app:`Pyramid` router calls a "traverser" function with the root object
+ and the request. The traverser function attempts to traverse the root
+ object (using any existing ``__getitem__`` on the root object and
subobjects) to find a :term:`context`. If the root object has no
- ``__getitem__`` method, the root itself is assumed to be the context. The
+ ``__getitem__`` method, the root itself is assumed to be the context. The
exact traversal algorithm is described in :ref:`traversal_chapter`. The
traverser function returns a dictionary, which contains a :term:`context`
and a :term:`view name` as well as other ancillary information.
#. The request is decorated with various names returned from the traverser
- (such as ``context``, ``view_name``, and so forth), so they can be
- accessed via e.g. ``request.context`` within :term:`view` code.
+ (such as ``context``, ``view_name``, and so forth), so they can be accessed
+ via, for example, ``request.context`` within :term:`view` code.
#. A :class:`~pyramid.events.ContextFound` :term:`event` is sent to any
subscribers.
@@ -84,42 +86,41 @@ request enters a :app:`Pyramid` application through to the point that
protected by a :term:`permission`, :app:`Pyramid` determines whether the
view callable being asked for can be executed by the requesting user based
on credential information in the request and security information attached
- to the context. If the view execution is allowed, :app:`Pyramid` calls
- the view callable to obtain a response. If view execution is forbidden,
+ to the context. If the view execution is allowed, :app:`Pyramid` calls the
+ view callable to obtain a response. If view execution is forbidden,
:app:`Pyramid` raises a :class:`~pyramid.httpexceptions.HTTPForbidden`
exception.
#. If any exception is raised within a :term:`root factory`, by
- :term:`traversal`, by a :term:`view callable` or by :app:`Pyramid` itself
+ :term:`traversal`, by a :term:`view callable`, or by :app:`Pyramid` itself
(such as when it raises :class:`~pyramid.httpexceptions.HTTPNotFound` or
:class:`~pyramid.httpexceptions.HTTPForbidden`), the router catches the
exception, and attaches it to the request as the ``exception`` attribute.
- It then attempts to find a :term:`exception view` for the exception that
- was caught. If it finds an exception view callable, that callable is
- called, and is presumed to generate a response. If an :term:`exception
- view` that matches the exception cannot be found, the exception is
- reraised.
-
-#. The following steps occur only when a :term:`response` could be
- successfully generated by a normal :term:`view callable` or an
- :term:`exception view` callable. :app:`Pyramid` will attempt to execute
- any :term:`response callback` functions attached via
- :meth:`~pyramid.request.Request.add_response_callback`. A
+ It then attempts to find a :term:`exception view` for the exception that was
+ caught. If it finds an exception view callable, that callable is called,
+ and is presumed to generate a response. If an :term:`exception view` that
+ matches the exception cannot be found, the exception is reraised.
+
+#. The following steps occur only when a :term:`response` could be successfully
+ generated by a normal :term:`view callable` or an :term:`exception view`
+ callable. :app:`Pyramid` will attempt to execute any :term:`response
+ callback` functions attached via
+ :meth:`~pyramid.request.Request.add_response_callback`. A
:class:`~pyramid.events.NewResponse` :term:`event` is then sent to any
subscribers. The response object's ``__call__`` method is then used to
generate a WSGI response. The response is sent back to the upstream WSGI
server.
-#. :app:`Pyramid` will attempt to execute any :term:`finished
- callback` functions attached via
+#. :app:`Pyramid` will attempt to execute any :term:`finished callback`
+ functions attached via
:meth:`~pyramid.request.Request.add_finished_callback`.
#. The :term:`thread local` stack is popped.
-.. image:: router.png
+.. image:: ../_static/pyramid_router.*
+ :alt: Pyramid Router
This is a very high-level overview that leaves out various details. For more
-detail about subsystems invoked by the :app:`Pyramid` router such as
+detail about subsystems invoked by the :app:`Pyramid` router, such as
traversal, URL dispatch, views, and event processing, see
:ref:`urldispatch_chapter`, :ref:`views_chapter`, and :ref:`events_chapter`.
-
diff --git a/docs/narr/scaffolding.rst b/docs/narr/scaffolding.rst
index f924d0d62..164ceb3bf 100644
--- a/docs/narr/scaffolding.rst
+++ b/docs/narr/scaffolding.rst
@@ -4,8 +4,8 @@ Creating Pyramid Scaffolds
==========================
You can extend Pyramid by creating a :term:`scaffold` template. A scaffold
-template is useful if you'd like to distribute a customizable configuration
-of Pyramid to other users. Once you've created a scaffold, and someone has
+template is useful if you'd like to distribute a customizable configuration of
+Pyramid to other users. Once you've created a scaffold, and someone has
installed the distribution that houses the scaffold, they can use the
``pcreate`` script to create a custom version of your scaffold's template.
Pyramid itself uses scaffolds to allow people to bootstrap new projects. For
@@ -15,22 +15,22 @@ example, ``pcreate -s alchemy MyStuff`` causes Pyramid to render the
Basics
------
-A scaffold template is just a bunch of source files and directories on disk.
-A small definition class points at this directory; it is in turn pointed at
-by a :term:`setuptools` "entry point" which registers the scaffold so it can
-be found by the ``pcreate`` command.
+A scaffold template is just a bunch of source files and directories on disk. A
+small definition class points at this directory. It is in turn pointed at by a
+:term:`setuptools` "entry point" which registers the scaffold so it can be
+found by the ``pcreate`` command.
To create a scaffold template, create a Python :term:`distribution` to house
the scaffold which includes a ``setup.py`` that relies on the ``setuptools``
-package. See `Creating a Package
-<http://guide.python-distribute.org/creation.html>`_ for more information
-about how to do this. For the sake of example, we'll pretend the
-distribution you create is named ``CoolExtension``, and it has a package
-directory within it named ``coolextension``
+package. See `Packaging and Distributing Projects
+<https://packaging.python.org/en/latest/distributing/>`_ for more information
+about how to do this. For example, we'll pretend the distribution you create
+is named ``CoolExtension``, and it has a package directory within it named
+``coolextension``.
-Once you've created the distribution put a "scaffolds" directory within your
-distribution's package directory, and create a file within that directory
-named ``__init__.py`` with something like the following:
+Once you've created the distribution, put a "scaffolds" directory within your
+distribution's package directory, and create a file within that directory named
+``__init__.py`` with something like the following:
.. code-block:: python
:linenos:
@@ -54,22 +54,27 @@ As you create files and directories within the template directory, note that:
the string value of the variable named ``var`` provided to the scaffold.
- Files and directories with filenames that contain the string ``+var+`` will
- have that string replaced with the value of the ``var`` variable provided
- to the scaffold.
+ have that string replaced with the value of the ``var`` variable provided to
+ the scaffold.
+
+- Files that start with a dot (e.g., ``.env``) are ignored and will not be
+ copied over to the destination directory. If you want to include a file with
+ a leading dot, then you must replace the dot with ``+dot+`` (e.g.,
+ ``+dot+env``).
Otherwise, files and directories which live in the template directory will be
copied directly without modification to the ``pcreate`` output location.
The variables provided by the default ``PyramidTemplate`` include ``project``
(the project name provided by the user as an argument to ``pcreate``),
-``package`` (a lowercasing and normalizing of the project name provided by
-the user), ``random_string`` (a long random string), and ``package_logger``
-(the name of the package's logger).
+``package`` (a lowercasing and normalizing of the project name provided by the
+user), ``random_string`` (a long random string), and ``package_logger`` (the
+name of the package's logger).
See Pyramid's "scaffolds" package
-(https://github.com/Pylons/pyramid/tree/master/pyramid/scaffolds) for
-concrete examples of scaffold directories (``zodb``, ``alchemy``, and
-``starter``, for example).
+(https://github.com/Pylons/pyramid/tree/master/pyramid/scaffolds) for concrete
+examples of scaffold directories (``zodb``, ``alchemy``, and ``starter``, for
+example).
After you've created the template directory, add the following to the
``entry_points`` value of your distribution's ``setup.py``:
@@ -91,17 +96,16 @@ For example:
"""
)
-Run your distribution's ``setup.py develop`` or ``setup.py install``
-command. After that, you should be able to see your scaffolding template
-listed when you run ``pcreate -l``. It will be named ``coolextension``
-because that's the name we gave it in the entry point setup. Running
-``pcreate -s coolextension MyStuff`` will then render your scaffold to an
-output directory named ``MyStuff``.
+Run your distribution's ``setup.py develop`` or ``setup.py install`` command.
+After that, you should be able to see your scaffolding template listed when you
+run ``pcreate -l``. It will be named ``coolextension`` because that's the name
+we gave it in the entry point setup. Running ``pcreate -s coolextension
+MyStuff`` will then render your scaffold to an output directory named
+``MyStuff``.
-See the module documentation for :mod:`pyramid.scaffolds` for information
-about the API of the :class:`pyramid.scaffolds.Template` class and
-related classes. You can override methods of this class to get special
-behavior.
+See the module documentation for :mod:`pyramid.scaffolds` for information about
+the API of the :class:`pyramid.scaffolds.Template` class and related classes.
+You can override methods of this class to get special behavior.
Supporting Older Pyramid Versions
---------------------------------
@@ -134,21 +138,22 @@ defining your scaffold template:
And then in the setup.py of the package that contains your scaffold, define
the template as a target of both ``paste.paster_create_template`` (for
-``paster create``) and ``pyramid.scaffold`` (for ``pcreate``)::
+``paster create``) and ``pyramid.scaffold`` (for ``pcreate``).
+
+.. code-block:: ini
- [paste.paster_create_template]
- coolextension=coolextension.scaffolds:CoolExtensionTemplate
- [pyramid.scaffold]
- coolextension=coolextension.scaffolds:CoolExtensionTemplate
+ [paste.paster_create_template]
+ coolextension=coolextension.scaffolds:CoolExtensionTemplate
+ [pyramid.scaffold]
+ coolextension=coolextension.scaffolds:CoolExtensionTemplate
-Doing this hideousness will allow your scaffold to work as a ``paster
-create`` target (under 1.0, 1.1, or 1.2) or as a ``pcreate`` target (under
-1.3). If an invoker tries to run ``paster create`` against a scaffold
-defined this way under 1.3, an error is raised instructing them to use
-``pcreate`` instead.
+Doing this hideousness will allow your scaffold to work as a ``paster create``
+target (under 1.0, 1.1, or 1.2) or as a ``pcreate`` target (under 1.3). If an
+invoker tries to run ``paster create`` against a scaffold defined this way
+under 1.3, an error is raised instructing them to use ``pcreate`` instead.
-If you want only to support Pyramid 1.3 only, it's much cleaner, and the API
-is stable:
+If you want to support Pyramid 1.3 only, it's much cleaner, and the API is
+stable:
.. code-block:: python
:linenos:
@@ -159,17 +164,17 @@ is stable:
_template_dir = 'coolextension_scaffold'
summary = 'My cool_extension'
-You only need to specify a ``paste.paster_create_template`` entry point
-target in your ``setup.py`` if you want your scaffold to be consumable by
-users of Pyramid 1.0, 1.1, or 1.2. To support only 1.3, specifying only the
+You only need to specify a ``paste.paster_create_template`` entry point target
+in your ``setup.py`` if you want your scaffold to be consumable by users of
+Pyramid 1.0, 1.1, or 1.2. To support only 1.3, specifying only the
``pyramid.scaffold`` entry point is good enough. If you want to support both
-``paster create`` and ``pcreate`` (meaning you want to support Pyramid 1.2
-and some older version), you'll need to define both.
+``paster create`` and ``pcreate`` (meaning you want to support Pyramid 1.2 and
+some older version), you'll need to define both.
Examples
--------
Existing third-party distributions which house scaffolding are available via
-:term:`PyPI`. The ``pyramid_jqm``, ``pyramid_zcml`` and ``pyramid_jinja2``
+:term:`PyPI`. The ``pyramid_jqm``, ``pyramid_zcml``, and ``pyramid_jinja2``
packages house scaffolds. You can install and examine these packages to see
how they work in the quest to develop your own scaffolding.
diff --git a/docs/narr/security.rst b/docs/narr/security.rst
index 8db23a33b..7cbea113c 100644
--- a/docs/narr/security.rst
+++ b/docs/narr/security.rst
@@ -6,56 +6,59 @@
Security
========
-:app:`Pyramid` provides an optional declarative authorization system
-that can prevent a :term:`view` from being invoked based on an
-:term:`authorization policy`. Before a view is invoked, the
-authorization system can use the credentials in the :term:`request`
-along with the :term:`context` resource to determine if access will be
-allowed. Here's how it works at a high level:
+:app:`Pyramid` provides an optional, declarative, security system. Security in
+:app:`Pyramid` is separated into authentication and authorization. The two
+systems communicate via :term:`principal` identifiers. Authentication is merely
+the mechanism by which credentials provided in the :term:`request` are resolved
+to one or more :term:`principal` identifiers. These identifiers represent the
+users and groups that are in effect during the request. Authorization then
+determines access based on the :term:`principal` identifiers, the requested
+:term:`permission`, and a :term:`context`.
+
+The :app:`Pyramid` authorization system can prevent a :term:`view` from being
+invoked based on an :term:`authorization policy`. Before a view is invoked, the
+authorization system can use the credentials in the :term:`request` along with
+the :term:`context` resource to determine if access will be allowed. Here's
+how it works at a high level:
+
+- A user may or may not have previously visited the application and supplied
+ authentication credentials, including a :term:`userid`. If so, the
+ application may have called :func:`pyramid.security.remember` to remember
+ these.
- A :term:`request` is generated when a user visits the application.
- Based on the request, a :term:`context` resource is located through
:term:`resource location`. A context is located differently depending on
- whether the application uses :term:`traversal` or :term:`URL dispatch`, but
- a context is ultimately found in either case. See
- the :ref:`urldispatch_chapter` chapter for more information.
+ whether the application uses :term:`traversal` or :term:`URL dispatch`, but a
+ context is ultimately found in either case. See the
+ :ref:`urldispatch_chapter` chapter for more information.
-- A :term:`view callable` is located by :term:`view lookup` using the
- context as well as other attributes of the request.
+- A :term:`view callable` is located by :term:`view lookup` using the context
+ as well as other attributes of the request.
-- If an :term:`authentication policy` is in effect, it is passed the
- request; it returns some number of :term:`principal` identifiers.
+- If an :term:`authentication policy` is in effect, it is passed the request.
+ It will return some number of :term:`principal` identifiers. To do this, the
+ policy would need to determine the authenticated :term:`userid` present in
+ the request.
- If an :term:`authorization policy` is in effect and the :term:`view
- configuration` associated with the view callable that was found has
- a :term:`permission` associated with it, the authorization policy is
- passed the :term:`context`, some number of :term:`principal`
- identifiers returned by the authentication policy, and the
- :term:`permission` associated with the view; it will allow or deny
- access.
-
-- If the authorization policy allows access, the view callable is
- invoked.
-
-- If the authorization policy denies access, the view callable is not
- invoked; instead the :term:`forbidden view` is invoked.
-
-Security in :app:`Pyramid`, unlike many systems, cleanly and explicitly
-separates authentication and authorization. Authentication is merely the
-mechanism by which credentials provided in the :term:`request` are
-resolved to one or more :term:`principal` identifiers. These identifiers
-represent the users and groups in effect during the request.
-Authorization then determines access based on the :term:`principal`
-identifiers, the :term:`view callable` being invoked, and the
-:term:`context` resource.
+ configuration` associated with the view callable that was found has a
+ :term:`permission` associated with it, the authorization policy is passed the
+ :term:`context`, some number of :term:`principal` identifiers returned by the
+ authentication policy, and the :term:`permission` associated with the view;
+ it will allow or deny access.
+
+- If the authorization policy allows access, the view callable is invoked.
+
+- If the authorization policy denies access, the view callable is not invoked.
+ Instead the :term:`forbidden view` is invoked.
Authorization is enabled by modifying your application to include an
-:term:`authentication policy` and :term:`authorization policy`.
-:app:`Pyramid` comes with a variety of implementations of these
-policies. To provide maximal flexibility, :app:`Pyramid` also
-allows you to create custom authentication policies and authorization
-policies.
+:term:`authentication policy` and :term:`authorization policy`. :app:`Pyramid`
+comes with a variety of implementations of these policies. To provide maximal
+flexibility, :app:`Pyramid` also allows you to create custom authentication
+policies and authorization policies.
.. index::
single: authorization policy
@@ -65,23 +68,22 @@ policies.
Enabling an Authorization Policy
--------------------------------
-:app:`Pyramid` does not enable any authorization policy by default. All
-views are accessible by completely anonymous users. In order to begin
-protecting views from execution based on security settings, you need
-to enable an authorization policy.
+:app:`Pyramid` does not enable any authorization policy by default. All views
+are accessible by completely anonymous users. In order to begin protecting
+views from execution based on security settings, you need to enable an
+authorization policy.
Enabling an Authorization Policy Imperatively
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Use the :meth:`~pyramid.config.Configurator.set_authorization_policy` method
-of the :class:`~pyramid.config.Configurator` to enable an authorization
-policy.
+Use the :meth:`~pyramid.config.Configurator.set_authorization_policy` method of
+the :class:`~pyramid.config.Configurator` to enable an authorization policy.
You must also enable an :term:`authentication policy` in order to enable the
-authorization policy. This is because authorization, in general, depends
-upon authentication. Use the
-:meth:`~pyramid.config.Configurator.set_authentication_policy` method
-during application setup to specify the authentication policy.
+authorization policy. This is because authorization, in general, depends upon
+authentication. Use the
+:meth:`~pyramid.config.Configurator.set_authentication_policy` method during
+application setup to specify the authentication policy.
For example:
@@ -97,27 +99,27 @@ For example:
config.set_authentication_policy(authn_policy)
config.set_authorization_policy(authz_policy)
-.. note:: The ``authentication_policy`` and ``authorization_policy``
- arguments may also be passed to their respective methods mentioned above
- as :term:`dotted Python name` values, each representing the dotted name
- path to a suitable implementation global defined at Python module scope.
+.. note:: The ``authentication_policy`` and ``authorization_policy`` arguments
+ may also be passed to their respective methods mentioned above as
+ :term:`dotted Python name` values, each representing the dotted name path to
+ a suitable implementation global defined at Python module scope.
The above configuration enables a policy which compares the value of an "auth
ticket" cookie passed in the request's environment which contains a reference
-to a single :term:`principal` against the principals present in any
-:term:`ACL` found in the resource tree when attempting to call some
-:term:`view`.
+to a single :term:`userid`, and matches that userid's :term:`principals
+<principal>` against the principals present in any :term:`ACL` found in the
+resource tree when attempting to call some :term:`view`.
While it is possible to mix and match different authentication and
-authorization policies, it is an error to configure a Pyramid application
-with an authentication policy but without the authorization policy or vice
-versa. If you do this, you'll receive an error at application startup time.
+authorization policies, it is an error to configure a Pyramid application with
+an authentication policy but without the authorization policy or vice versa. If
+you do this, you'll receive an error at application startup time.
.. seealso::
- See also the :mod:`pyramid.authorization` and
- :mod:`pyramid.authentication` modules for alternate implementations of
- authorization and authentication policies.
+ See also the :mod:`pyramid.authorization` and :mod:`pyramid.authentication`
+ modules for alternative implementations of authorization and authentication
+ policies.
.. index::
single: permissions
@@ -130,14 +132,13 @@ Protecting Views with Permissions
To protect a :term:`view callable` from invocation based on a user's security
settings when a particular type of resource becomes the :term:`context`, you
-must pass a :term:`permission` to :term:`view configuration`. Permissions
-are usually just strings, and they have no required composition: you can name
+must pass a :term:`permission` to :term:`view configuration`. Permissions are
+usually just strings, and they have no required composition: you can name
permissions whatever you like.
For example, the following view declaration protects the view named
``add_entry.html`` when the context resource is of type ``Blog`` with the
-``add`` permission using the :meth:`pyramid.config.Configurator.add_view`
-API:
+``add`` permission using the :meth:`pyramid.config.Configurator.add_view` API:
.. code-block:: python
:linenos:
@@ -149,8 +150,8 @@ API:
context='mypackage.resources.Blog',
permission='add')
-The equivalent view registration including the ``add`` permission name
-may be performed via the ``@view_config`` decorator:
+The equivalent view registration including the ``add`` permission name may be
+performed via the ``@view_config`` decorator:
.. code-block:: python
:linenos:
@@ -164,11 +165,11 @@ may be performed via the ``@view_config`` decorator:
pass
As a result of any of these various view configuration statements, if an
-authorization policy is in place when the view callable is found during
-normal application operations, the requesting user will need to possess the
-``add`` permission against the :term:`context` resource in order to be able
-to invoke the ``blog_entry_add_view`` view. If he does not, the
-:term:`Forbidden view` will be invoked.
+authorization policy is in place when the view callable is found during normal
+application operations, the requesting user will need to possess the ``add``
+permission against the :term:`context` resource in order to be able to invoke
+the ``blog_entry_add_view`` view. If they do not, the :term:`Forbidden view`
+will be invoked.
.. index::
pair: permission; default
@@ -178,18 +179,17 @@ to invoke the ``blog_entry_add_view`` view. If he does not, the
Setting a Default Permission
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If a permission is not supplied to a view configuration, the registered
-view will always be executable by entirely anonymous users: any
-authorization policy in effect is ignored.
+If a permission is not supplied to a view configuration, the registered view
+will always be executable by entirely anonymous users: any authorization policy
+in effect is ignored.
-In support of making it easier to configure applications which are
-"secure by default", :app:`Pyramid` allows you to configure a
-*default* permission. If supplied, the default permission is used as
-the permission string to all view registrations which don't otherwise
-name a ``permission`` argument.
+In support of making it easier to configure applications which are "secure by
+default", :app:`Pyramid` allows you to configure a *default* permission. If
+supplied, the default permission is used as the permission string to all view
+registrations which don't otherwise name a ``permission`` argument.
-The :meth:`pyramid.config.Configurator.set_default_permission` method
-supports configuring a default permission for an application.
+The :meth:`pyramid.config.Configurator.set_default_permission` method supports
+configuring a default permission for an application.
When a default permission is registered:
@@ -198,8 +198,8 @@ When a default permission is registered:
view-configuration-named permission is used.
- If a view configuration names the permission
- :data:`pyramid.security.NO_PERMISSION_REQUIRED`, the default permission
- is ignored, and the view is registered *without* a permission (making it
+ :data:`pyramid.security.NO_PERMISSION_REQUIRED`, the default permission is
+ ignored, and the view is registered *without* a permission (making it
available to all callers regardless of their credentials).
.. warning::
@@ -217,19 +217,18 @@ When a default permission is registered:
.. _assigning_acls:
-Assigning ACLs to your Resource Objects
+Assigning ACLs to Your Resource Objects
---------------------------------------
-When the default :app:`Pyramid` :term:`authorization policy` determines
-whether a user possesses a particular permission with respect to a resource,
-it examines the :term:`ACL` associated with the resource. An ACL is
-associated with a resource by adding an ``__acl__`` attribute to the resource
-object. This attribute can be defined on the resource *instance* if you need
+When the default :app:`Pyramid` :term:`authorization policy` determines whether
+a user possesses a particular permission with respect to a resource, it
+examines the :term:`ACL` associated with the resource. An ACL is associated
+with a resource by adding an ``__acl__`` attribute to the resource object.
+This attribute can be defined on the resource *instance* if you need
instance-level security, or it can be defined on the resource *class* if you
just need type-level security.
-For example, an ACL might be attached to the resource for a blog via its
-class:
+For example, an ACL might be attached to the resource for a blog via its class:
.. code-block:: python
:linenos:
@@ -264,11 +263,11 @@ Or, if your resources are persistent, an ACL might be specified via the
(Allow, 'group:editors', 'edit'),
]
-Whether an ACL is attached to a resource's class or an instance of the
-resource itself, the effect is the same. It is useful to decorate individual
-resource instances with an ACL (as opposed to just decorating their class) in
-applications such as "CMS" systems where fine-grained access is required on
-an object-by-object basis.
+Whether an ACL is attached to a resource's class or an instance of the resource
+itself, the effect is the same. It is useful to decorate individual resource
+instances with an ACL (as opposed to just decorating their class) in
+applications such as content management systems where fine-grained access is
+required on an object-by-object basis.
Dynamic ACLs are also possible by turning the ACL into a callable on the
resource. This may allow the ACL to dynamically generate rules based on
@@ -312,32 +311,27 @@ Here's an example ACL:
(Allow, 'group:editors', 'edit'),
]
-The example ACL indicates that the
-:data:`pyramid.security.Everyone` principal -- a special
-system-defined principal indicating, literally, everyone -- is allowed
-to view the blog, the ``group:editors`` principal is allowed to add to
-and edit the blog.
+The example ACL indicates that the :data:`pyramid.security.Everyone`
+principal—a special system-defined principal indicating, literally, everyone—is
+allowed to view the blog, and the ``group:editors`` principal is allowed to add
+to and edit the blog.
-Each element of an ACL is an :term:`ACE` or access control entry.
-For example, in the above code block, there are three ACEs: ``(Allow,
-Everyone, 'view')``, ``(Allow, 'group:editors', 'add')``, and
-``(Allow, 'group:editors', 'edit')``.
+Each element of an ACL is an :term:`ACE`, or access control entry. For example,
+in the above code block, there are three ACEs: ``(Allow, Everyone, 'view')``,
+``(Allow, 'group:editors', 'add')``, and ``(Allow, 'group:editors', 'edit')``.
-The first element of any ACE is either
-:data:`pyramid.security.Allow`, or
-:data:`pyramid.security.Deny`, representing the action to take when
-the ACE matches. The second element is a :term:`principal`. The
-third argument is a permission or sequence of permission names.
+The first element of any ACE is either :data:`pyramid.security.Allow`, or
+:data:`pyramid.security.Deny`, representing the action to take when the ACE
+matches. The second element is a :term:`principal`. The third argument is a
+permission or sequence of permission names.
A principal is usually a user id, however it also may be a group id if your
authentication system provides group information and the effective
:term:`authentication policy` policy is written to respect group information.
-For example, the
-:class:`pyramid.authentication.RepozeWho1AuthenticationPolicy` respects group
-information if you configure it with a ``callback``.
+See :ref:`extending_default_authentication_policies`.
-Each ACE in an ACL is processed by an authorization policy *in the
-order dictated by the ACL*. So if you have an ACL like this:
+Each ACE in an ACL is processed by an authorization policy *in the order
+dictated by the ACL*. So if you have an ACL like this:
.. code-block:: python
:linenos:
@@ -351,10 +345,9 @@ order dictated by the ACL*. So if you have an ACL like this:
(Deny, Everyone, 'view'),
]
-The default authorization policy will *allow* everyone the view
-permission, even though later in the ACL you have an ACE that denies
-everyone the view permission. On the other hand, if you have an ACL
-like this:
+The default authorization policy will *allow* everyone the view permission,
+even though later in the ACL you have an ACE that denies everyone the view
+permission. On the other hand, if you have an ACL like this:
.. code-block:: python
:linenos:
@@ -368,14 +361,13 @@ like this:
(Allow, Everyone, 'view'),
]
-The authorization policy will deny everyone the view permission, even
-though later in the ACL is an ACE that allows everyone.
+The authorization policy will deny everyone the view permission, even though
+later in the ACL, there is an ACE that allows everyone.
-The third argument in an ACE can also be a sequence of permission
-names instead of a single permission name. So instead of creating
-multiple ACEs representing a number of different permission grants to
-a single ``group:editors`` group, we can collapse this into a single
-ACE, as below.
+The third argument in an ACE can also be a sequence of permission names instead
+of a single permission name. So instead of creating multiple ACEs representing
+a number of different permission grants to a single ``group:editors`` group, we
+can collapse this into a single ACE, as below.
.. code-block:: python
:linenos:
@@ -396,23 +388,21 @@ ACE, as below.
Special Principal Names
-----------------------
-Special principal names exist in the :mod:`pyramid.security`
-module. They can be imported for use in your own code to populate
-ACLs, e.g. :data:`pyramid.security.Everyone`.
+Special principal names exist in the :mod:`pyramid.security` module. They can
+be imported for use in your own code to populate ACLs, e.g.,
+:data:`pyramid.security.Everyone`.
:data:`pyramid.security.Everyone`
- Literally, everyone, no matter what. This object is actually a
- string "under the hood" (``system.Everyone``). Every user "is" the
- principal named Everyone during every request, even if a security
- policy is not in use.
+ Literally, everyone, no matter what. This object is actually a string under
+ the hood (``system.Everyone``). Every user *is* the principal named
+ "Everyone" during every request, even if a security policy is not in use.
:data:`pyramid.security.Authenticated`
- Any user with credentials as determined by the current security
- policy. You might think of it as any user that is "logged in".
- This object is actually a string "under the hood"
- (``system.Authenticated``).
+ Any user with credentials as determined by the current security policy. You
+ might think of it as any user that is "logged in". This object is actually a
+ string under the hood (``system.Authenticated``).
.. index::
single: permission names
@@ -421,19 +411,19 @@ ACLs, e.g. :data:`pyramid.security.Everyone`.
Special Permissions
-------------------
-Special permission names exist in the :mod:`pyramid.security`
-module. These can be imported for use in ACLs.
+Special permission names exist in the :mod:`pyramid.security` module. These
+can be imported for use in ACLs.
.. _all_permissions:
:data:`pyramid.security.ALL_PERMISSIONS`
- An object representing, literally, *all* permissions. Useful in an
- ACL like so: ``(Allow, 'fred', ALL_PERMISSIONS)``. The
- ``ALL_PERMISSIONS`` object is actually a stand-in object that has a
- ``__contains__`` method that always returns ``True``, which, for all
- known authorization policies, has the effect of indicating that a
- given principal "has" any permission asked for by the system.
+ An object representing, literally, *all* permissions. Useful in an ACL like
+ so: ``(Allow, 'fred', ALL_PERMISSIONS)``. The ``ALL_PERMISSIONS`` object is
+ actually a stand-in object that has a ``__contains__`` method that always
+ returns ``True``, which, for all known authorization policies, has the effect
+ of indicating that a given principal has any permission asked for by the
+ system.
.. index::
single: special ACE
@@ -444,11 +434,11 @@ Special ACEs
A convenience :term:`ACE` is defined representing a deny to everyone of all
permissions in :data:`pyramid.security.DENY_ALL`. This ACE is often used as
-the *last* ACE of an ACL to explicitly cause inheriting authorization
-policies to "stop looking up the traversal tree" (effectively breaking any
-inheritance). For example, an ACL which allows *only* ``fred`` the view
-permission for a particular resource despite what inherited ACLs may say when
-the default authorization policy is in effect might look like so:
+the *last* ACE of an ACL to explicitly cause inheriting authorization policies
+to "stop looking up the traversal tree" (effectively breaking any inheritance).
+For example, an ACL which allows *only* ``fred`` the view permission for a
+particular resource, despite what inherited ACLs may say when the default
+authorization policy is in effect, might look like so:
.. code-block:: python
:linenos:
@@ -458,8 +448,8 @@ the default authorization policy is in effect might look like so:
__acl__ = [ (Allow, 'fred', 'view'), DENY_ALL ]
-"Under the hood", the :data:`pyramid.security.DENY_ALL` ACE equals
-the following:
+Under the hood, the :data:`pyramid.security.DENY_ALL` ACE equals the
+following:
.. code-block:: python
:linenos:
@@ -476,14 +466,14 @@ ACL Inheritance and Location-Awareness
While the default :term:`authorization policy` is in place, if a resource
object does not have an ACL when it is the context, its *parent* is consulted
-for an ACL. If that object does not have an ACL, *its* parent is consulted
-for an ACL, ad infinitum, until we've reached the root and there are no more
+for an ACL. If that object does not have an ACL, *its* parent is consulted for
+an ACL, ad infinitum, until we've reached the root and there are no more
parents left.
In order to allow the security machinery to perform ACL inheritance, resource
objects must provide *location-awareness*. Providing *location-awareness*
-means two things: the root object in the resource tree must have a
-``__name__`` attribute and a ``__parent__`` attribute.
+means two things: the root object in the resource tree must have a ``__name__``
+attribute and a ``__parent__`` attribute.
.. code-block:: python
:linenos:
@@ -492,10 +482,10 @@ means two things: the root object in the resource tree must have a
__name__ = ''
__parent__ = None
-An object with a ``__parent__`` attribute and a ``__name__`` attribute
-is said to be *location-aware*. Location-aware objects define an
-``__parent__`` attribute which points at their parent object. The
-root object's ``__parent__`` is ``None``.
+An object with a ``__parent__`` attribute and a ``__name__`` attribute is said
+to be *location-aware*. Location-aware objects define a ``__parent__``
+attribute which points at their parent object. The root object's
+``__parent__`` is ``None``.
.. seealso::
@@ -512,12 +502,11 @@ root object's ``__parent__`` is ``None``.
Changing the Forbidden View
---------------------------
-When :app:`Pyramid` denies a view invocation due to an
-authorization denial, the special ``forbidden`` view is invoked. "Out
-of the box", this forbidden view is very plain. See
-:ref:`changing_the_forbidden_view` within :ref:`hooks_chapter` for
-instructions on how to create a custom forbidden view and arrange for
-it to be called when view authorization is denied.
+When :app:`Pyramid` denies a view invocation due to an authorization denial,
+the special ``forbidden`` view is invoked. Out of the box, this forbidden view
+is very plain. See :ref:`changing_the_forbidden_view` within
+:ref:`hooks_chapter` for instructions on how to create a custom forbidden view
+and arrange for it to be called when view authorization is denied.
.. index::
single: debugging authorization failures
@@ -527,8 +516,8 @@ it to be called when view authorization is denied.
Debugging View Authorization Failures
-------------------------------------
-If your application in your judgment is allowing or denying view
-access inappropriately, start your application under a shell using the
+If your application in your judgment is allowing or denying view access
+inappropriately, start your application under a shell using the
``PYRAMID_DEBUG_AUTHORIZATION`` environment variable set to ``1``. For
example:
@@ -536,14 +525,13 @@ example:
$ PYRAMID_DEBUG_AUTHORIZATION=1 $VENV/bin/pserve myproject.ini
-When any authorization takes place during a top-level view rendering,
-a message will be logged to the console (to stderr) about what ACE in
-which ACL permitted or denied the authorization based on
-authentication information.
+When any authorization takes place during a top-level view rendering, a message
+will be logged to the console (to stderr) about what ACE in which ACL permitted
+or denied the authorization based on authentication information.
-This behavior can also be turned on in the application ``.ini`` file
-by setting the ``pyramid.debug_authorization`` key to ``true`` within the
-application's configuration section, e.g.:
+This behavior can also be turned on in the application ``.ini`` file by setting
+the ``pyramid.debug_authorization`` key to ``true`` within the application's
+configuration section, e.g.:
.. code-block:: ini
:linenos:
@@ -552,26 +540,77 @@ application's configuration section, e.g.:
use = egg:MyProject
pyramid.debug_authorization = true
-With this debug flag turned on, the response sent to the browser will
-also contain security debugging information in its body.
+With this debug flag turned on, the response sent to the browser will also
+contain security debugging information in its body.
Debugging Imperative Authorization Failures
-------------------------------------------
The :meth:`pyramid.request.Request.has_permission` API is used to check
-security within view functions imperatively. It returns instances of
-objects that are effectively booleans. But these objects are not raw
-``True`` or ``False`` objects, and have information attached to them
-about why the permission was allowed or denied. The object will be
-one of :data:`pyramid.security.ACLAllowed`,
-:data:`pyramid.security.ACLDenied`,
-:data:`pyramid.security.Allowed`, or
-:data:`pyramid.security.Denied`, as documented in
-:ref:`security_module`. At the very minimum these objects will have a
-``msg`` attribute, which is a string indicating why the permission was
-denied or allowed. Introspecting this information in the debugger or
-via print statements when a call to
-:meth:`~pyramid.request.Request.has_permission` fails is often useful.
+security within view functions imperatively. It returns instances of objects
+that are effectively booleans. But these objects are not raw ``True`` or
+``False`` objects, and have information attached to them about why the
+permission was allowed or denied. The object will be one of
+:data:`pyramid.security.ACLAllowed`, :data:`pyramid.security.ACLDenied`,
+:data:`pyramid.security.Allowed`, or :data:`pyramid.security.Denied`, as
+documented in :ref:`security_module`. At the very minimum, these objects will
+have a ``msg`` attribute, which is a string indicating why the permission was
+denied or allowed. Introspecting this information in the debugger or via print
+statements when a call to :meth:`~pyramid.request.Request.has_permission` fails
+is often useful.
+
+.. index::
+ single: authentication policy (extending)
+
+.. _extending_default_authentication_policies:
+
+Extending Default Authentication Policies
+-----------------------------------------
+
+Pyramid ships with some built in authentication policies for use in your
+applications. See :mod:`pyramid.authentication` for the available policies.
+They differ on their mechanisms for tracking authentication credentials between
+requests, however they all interface with your application in mostly the same
+way.
+
+Above you learned about :ref:`assigning_acls`. Each :term:`principal` used in
+the :term:`ACL` is matched against the list returned from
+:meth:`pyramid.interfaces.IAuthenticationPolicy.effective_principals`.
+Similarly, :meth:`pyramid.request.Request.authenticated_userid` maps to
+:meth:`pyramid.interfaces.IAuthenticationPolicy.authenticated_userid`.
+
+You may control these values by subclassing the default authentication
+policies. For example, below we subclass the
+:class:`pyramid.authentication.AuthTktAuthenticationPolicy` and define extra
+functionality to query our database before confirming that the :term:`userid`
+is valid in order to avoid blindly trusting the value in the cookie (what if
+the cookie is still valid, but the user has deleted their account?). We then
+use that :term:`userid` to augment the ``effective_principals`` with
+information about groups and other state for that user.
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.authentication import AuthTktAuthenticationPolicy
+
+ class MyAuthenticationPolicy(AuthTktAuthenticationPolicy):
+ def authenticated_userid(self, request):
+ userid = self.unauthenticated_userid(request)
+ if userid:
+ if request.verify_userid_is_still_valid(userid):
+ return userid
+
+ def effective_principals(self, request):
+ principals = [Everyone]
+ userid = self.authenticated_userid(request)
+ if userid:
+ principals += [Authenticated, str(userid)]
+ return principals
+
+In most instances ``authenticated_userid`` and ``effective_principals`` are
+application-specific, whereas ``unauthenticated_userid``, ``remember``, and
+``forget`` are generic and focused on transport and serialization of data
+between consecutive requests.
.. index::
single: authentication policy (creating)
@@ -581,12 +620,11 @@ via print statements when a call to
Creating Your Own Authentication Policy
---------------------------------------
-:app:`Pyramid` ships with a number of useful out-of-the-box
-security policies (see :mod:`pyramid.authentication`). However,
-creating your own authentication policy is often necessary when you
-want to control the "horizontal and vertical" of how your users
-authenticate. Doing so is a matter of creating an instance of something
-that implements the following interface:
+:app:`Pyramid` ships with a number of useful out-of-the-box security policies
+(see :mod:`pyramid.authentication`). However, creating your own authentication
+policy is often necessary when you want to control the "horizontal and
+vertical" of how your users authenticate. Doing so is a matter of creating an
+instance of something that implements the following interface:
.. code-block:: python
:linenos:
@@ -595,39 +633,56 @@ that implements the following interface:
""" An object representing a Pyramid authentication policy. """
def authenticated_userid(self, request):
- """ Return the authenticated userid or ``None`` if no
- authenticated userid can be found. This method of the policy
- should ensure that a record exists in whatever persistent store is
- used related to the user (the user should not have been deleted);
- if a record associated with the current id does not exist in a
- persistent store, it should return ``None``."""
+ """ Return the authenticated :term:`userid` or ``None`` if
+ no authenticated userid can be found. This method of the
+ policy should ensure that a record exists in whatever
+ persistent store is used related to the user (the user
+ should not have been deleted); if a record associated with
+ the current id does not exist in a persistent store, it
+ should return ``None``.
+
+ """
def unauthenticated_userid(self, request):
- """ Return the *unauthenticated* userid. This method performs the
- same duty as ``authenticated_userid`` but is permitted to return the
- userid based only on data present in the request; it needn't (and
- shouldn't) check any persistent store to ensure that the user record
- related to the request userid exists."""
+ """ Return the *unauthenticated* userid. This method
+ performs the same duty as ``authenticated_userid`` but is
+ permitted to return the userid based only on data present
+ in the request; it needn't (and shouldn't) check any
+ persistent store to ensure that the user record related to
+ the request userid exists.
+
+ This method is intended primarily a helper to assist the
+ ``authenticated_userid`` method in pulling credentials out
+ of the request data, abstracting away the specific headers,
+ query strings, etc that are used to authenticate the request.
+
+ """
def effective_principals(self, request):
""" Return a sequence representing the effective principals
- including the userid and any groups belonged to by the current
- user, including 'system' groups such as
- ``pyramid.security.Everyone`` and
- ``pyramid.security.Authenticated``. """
+ typically including the :term:`userid` and any groups belonged
+ to by the current user, always including 'system' groups such
+ as ``pyramid.security.Everyone`` and
+ ``pyramid.security.Authenticated``.
+
+ """
- def remember(self, request, principal, **kw):
+ def remember(self, request, userid, **kw):
""" Return a set of headers suitable for 'remembering' the
- principal named ``principal`` when set in a response. An
- individual authentication policy and its consumers can decide
- on the composition and meaning of **kw. """
-
+ :term:`userid` named ``userid`` when set in a response. An
+ individual authentication policy and its consumers can
+ decide on the composition and meaning of **kw.
+
+ """
+
def forget(self, request):
""" Return a set of headers suitable for 'forgetting' the
- current user on subsequent requests. """
+ current user on subsequent requests.
+
+ """
After you do so, you can pass an instance of such a class into the
-:class:`~pyramid.config.Configurator.set_authentication_policy` method
+:class:`~pyramid.config.Configurator.set_authentication_policy` method at
configuration time to use it.
.. index::
@@ -639,21 +694,19 @@ Creating Your Own Authorization Policy
--------------------------------------
An authorization policy is a policy that allows or denies access after a user
-has been authenticated. Most :app:`Pyramid` applications will use the
-default :class:`pyramid.authorization.ACLAuthorizationPolicy`.
-
-However, in some cases, it's useful to be able to use a different
-authorization policy than the default
-:class:`~pyramid.authorization.ACLAuthorizationPolicy`. For example, it
-might be desirable to construct an alternate authorization policy which
-allows the application to use an authorization mechanism that does not
-involve :term:`ACL` objects.
-
-:app:`Pyramid` ships with only a single default authorization
-policy, so you'll need to create your own if you'd like to use a
-different one. Creating and using your own authorization policy is a
-matter of creating an instance of an object that implements the
-following interface:
+has been authenticated. Most :app:`Pyramid` applications will use the default
+:class:`pyramid.authorization.ACLAuthorizationPolicy`.
+
+However, in some cases, it's useful to be able to use a different authorization
+policy than the default :class:`~pyramid.authorization.ACLAuthorizationPolicy`.
+For example, it might be desirable to construct an alternate authorization
+policy which allows the application to use an authorization mechanism that does
+not involve :term:`ACL` objects.
+
+:app:`Pyramid` ships with only a single default authorization policy, so you'll
+need to create your own if you'd like to use a different one. Creating and
+using your own authorization policy is a matter of creating an instance of an
+object that implements the following interface:
.. code-block:: python
:linenos:
@@ -704,4 +757,3 @@ which would allow the attacker to control the content of the payload. Re-using
a secret across two different subsystems might drop the security of signing to
zero. Keys should not be re-used across different contexts where an attacker
has the possibility of providing a chosen plaintext.
-
diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst
index 8da743a01..db554a93b 100644
--- a/docs/narr/sessions.rst
+++ b/docs/narr/sessions.rst
@@ -6,45 +6,44 @@
Sessions
========
-A :term:`session` is a namespace which is valid for some period of
-continual activity that can be used to represent a user's interaction
-with a web application.
+A :term:`session` is a namespace which is valid for some period of continual
+activity that can be used to represent a user's interaction with a web
+application.
-This chapter describes how to configure sessions, what session
-implementations :app:`Pyramid` provides out of the box, how to store and
-retrieve data from sessions, and two session-specific features: flash
-messages, and cross-site request forgery attack prevention.
+This chapter describes how to configure sessions, what session implementations
+:app:`Pyramid` provides out of the box, how to store and retrieve data from
+sessions, and two session-specific features: flash messages, and cross-site
+request forgery attack prevention.
.. index::
single: session factory (default)
.. _using_the_default_session_factory:
-Using The Default Session Factory
+Using the Default Session Factory
---------------------------------
-In order to use sessions, you must set up a :term:`session factory`
-during your :app:`Pyramid` configuration.
+In order to use sessions, you must set up a :term:`session factory` during your
+:app:`Pyramid` configuration.
-A very basic, insecure sample session factory implementation is
-provided in the :app:`Pyramid` core. It uses a cookie to store
-session information. This implementation has the following
-limitations:
+A very basic, insecure sample session factory implementation is provided in the
+:app:`Pyramid` core. It uses a cookie to store session information. This
+implementation has the following limitations:
-- The session information in the cookies used by this implementation
- is *not* encrypted, so it can be viewed by anyone with access to the
- cookie storage of the user's browser or anyone with access to the
- network along which the cookie travels.
+- The session information in the cookies used by this implementation is *not*
+ encrypted, so it can be viewed by anyone with access to the cookie storage of
+ the user's browser or anyone with access to the network along which the
+ cookie travels.
-- The maximum number of bytes that are storable in a serialized
- representation of the session is fewer than 4000. This is
- suitable only for very small data sets.
+- The maximum number of bytes that are storable in a serialized representation
+ of the session is fewer than 4000. This is suitable only for very small data
+ sets.
-It is digitally signed, however, and thus its data cannot easily be
-tampered with.
+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.
+You can configure this session factory in your :app:`Pyramid` application by
+using the :meth:`pyramid.config.Configurator.set_session_factory` method.
.. code-block:: python
:linenos:
@@ -56,20 +55,20 @@ 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
- when you keep sensitive information in the session object, as the
- information can be easily read by both users of your application and third
- parties who have access to your users' network traffic. And if you use this
- sessioning implementation, and you inadvertently create a cross-site
- scripting vulnerability in your application, because the session data is
- stored unencrypted in a cookie, it will also be easier for evildoers to
- obtain the current user's cross-site scripting token. In short, use a
- different session factory implementation (preferably one which keeps session
- data on the server) for anything but the most basic of applications where
- "session security doesn't matter", and you are sure your application has no
+ implementation is *unencrypted*. You should not use it when you keep
+ sensitive information in the session object, as the information can be
+ easily read by both users of your application and third parties who have
+ access to your users' network traffic. And, if you use this sessioning
+ implementation, and you inadvertently create a cross-site scripting
+ vulnerability in your application, because the session data is stored
+ unencrypted in a cookie, it will also be easier for evildoers to obtain the
+ current user's cross-site scripting token. In short, use a different
+ session factory implementation (preferably one which keeps session data on
+ the server) for anything but the most basic of applications where "session
+ security doesn't matter", and you are sure your application has no
cross-site scripting vulnerabilities.
.. index::
@@ -78,10 +77,9 @@ by using the :meth:`pyramid.config.Configurator.set_session_factory`` method.
Using a Session Object
----------------------
-Once a session factory has been configured for your application, you
-can access session objects provided by the session factory via
-the ``session`` attribute of any :term:`request` object. For
-example:
+Once a session factory has been configured for your application, you can access
+session objects provided by the session factory via the ``session`` attribute
+of any :term:`request` object. For example:
.. code-block:: python
:linenos:
@@ -98,13 +96,12 @@ example:
else:
return Response('Fred was not in the session')
-The first time this view is invoked produces ``Fred was not in the
-session``. Subsequent invocations produce ``Fred was in the
-session``, assuming of course that the client side maintains the
-session's identity across multiple requests.
+The first time this view is invoked produces ``Fred was not in the session``.
+Subsequent invocations produce ``Fred was in the session``, assuming of course
+that the client side maintains the session's identity across multiple requests.
You can use a session much like a Python dictionary. It supports all
-dictionary methods, along with some extra attributes, and methods.
+dictionary methods, along with some extra attributes and methods.
Extra attributes:
@@ -112,42 +109,39 @@ 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
- been constituted from data that was already serialized.
+ A boolean. If ``new`` is True, this session is new. Otherwise, it has been
+ constituted from data that was already serialized.
Extra methods:
``changed()``
- Call this when you mutate a mutable value in the session namespace.
- See the gotchas below for details on when, and why you should
- call this.
+ Call this when you mutate a mutable value in the session namespace. See the
+ gotchas below for details on when and why you should call this.
``invalidate()``
- Call this when you want to invalidate the session (dump all data,
- and -- perhaps -- set a clearing cookie).
+ Call this when you want to invalidate the session (dump all data, and perhaps
+ set a clearing cookie).
-The formal definition of the methods and attributes supported by the
-session object are in the :class:`pyramid.interfaces.ISession`
-documentation.
+The formal definition of the methods and attributes supported by the session
+object are in the :class:`pyramid.interfaces.ISession` documentation.
Some gotchas:
-- Keys and values of session data must be *pickleable*. This means,
- typically, that they are instances of basic types of objects,
- such as strings, lists, dictionaries, tuples, integers, etc. If you
- place an object in a session data key or value that is not
- pickleable, an error will be raised when the session is serialized.
-
-- If you place a mutable value (for example, a list or a dictionary)
- in a session object, and you subsequently mutate that value, you must
- call the ``changed()`` method of the session object. In this case, the
- session has no way to know that is was modified. However, when you
- modify a session object directly, such as setting a value (i.e.,
- ``__setitem__``), or removing a key (e.g., ``del`` or ``pop``), the
- session will automatically know that it needs to re-serialize its
- data, thus calling ``changed()`` is unnecessary. There is no harm in
- calling ``changed()`` in either case, so when in doubt, call it after
- you've changed sessioning data.
+- Keys and values of session data must be *pickleable*. This means, typically,
+ that they are instances of basic types of objects, such as strings, lists,
+ dictionaries, tuples, integers, etc. If you place an object in a session
+ data key or value that is not pickleable, an error will be raised when the
+ session is serialized.
+
+- If you place a mutable value (for example, a list or a dictionary) in a
+ session object, and you subsequently mutate that value, you must call the
+ ``changed()`` method of the session object. In this case, the session has no
+ way to know that it was modified. However, when you modify a session object
+ directly, such as setting a value (i.e., ``__setitem__``), or removing a key
+ (e.g., ``del`` or ``pop``), the session will automatically know that it needs
+ to re-serialize its data, thus calling ``changed()`` is unnecessary. There is
+ no harm in calling ``changed()`` in either case, so when in doubt, call it
+ after you've changed sessioning data.
.. index::
single: pyramid_redis_sessions
@@ -183,14 +177,13 @@ pyramid_beaker_ Beaker_ Session factory for Pyramid
Creating Your Own Session Factory
---------------------------------
-If none of the default or otherwise available sessioning
-implementations for :app:`Pyramid` suit you, you may create your own
-session object by implementing a :term:`session factory`. Your
-session factory should return a :term:`session`. The interfaces for
-both types are available in
+If none of the default or otherwise available sessioning implementations for
+:app:`Pyramid` suit you, you may create your own session object by implementing
+a :term:`session factory`. Your session factory should return a
+:term:`session`. The interfaces for both types are available in
:class:`pyramid.interfaces.ISessionFactory` and
-:class:`pyramid.interfaces.ISession`. You might use the cookie
-implementation in the :mod:`pyramid.session` module as inspiration.
+:class:`pyramid.interfaces.ISession`. You might use the cookie implementation
+in the :mod:`pyramid.session` module as inspiration.
.. index::
single: flash messages
@@ -205,9 +198,9 @@ Flash Messages
factory` as described in :ref:`using_the_default_session_factory` or
:ref:`using_alternate_session_factories`.
-Flash messaging has two main uses: to display a status message only once to
-the user after performing an internal redirect, and to allow generic code to
-log messages for single-time display without having direct access to an HTML
+Flash messaging has two main uses: to display a status message only once to the
+user after performing an internal redirect, and to allow generic code to log
+messages for single-time display without having direct access to an HTML
template. The user interface consists of a number of methods of the
:term:`session` object.
@@ -225,7 +218,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:
@@ -235,22 +228,21 @@ The ``message`` argument is required. It represents a message you wish to
later display to a user. It is usually a string but the ``message`` you
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 can pass any name for your queue, but it must be a string.
-Each queue is independent, and can be popped by ``pop_flash()`` or
-examined via ``peek_flash()`` separately. ``queue`` defaults to the
-empty string. The empty string represents the default flash message
-queue.
+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 can pass
+any name for your queue, but it must be a string. Each queue is independent,
+and can be popped by ``pop_flash()`` or examined via ``peek_flash()``
+separately. ``queue`` defaults to the empty string. The empty string
+represents the default flash message queue.
.. code-block:: python
request.session.flash(msg, 'myappsqueue')
-The ``allow_duplicate`` argument defaults to ``True``. If this is
-``False``, and you attempt to add a message value which is already
-present in the queue, it will not be added.
+The ``allow_duplicate`` argument defaults to ``True``. If this is ``False``,
+and you attempt to add a message value which is already present in the queue,
+it will not be added.
.. index::
single: session.pop_flash
@@ -259,12 +251,12 @@ Using the ``session.pop_flash`` Method
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 an entire queue and return it for use.
+``session.flash()`` API, the ``session.pop_flash()`` API can be used to pop an
+entire 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. This returns a list of the messages
-that were added to the flash queue, and empties the queue.
+object's ``pop_flash()`` method. This returns a list of the messages that were
+added to the flash queue, and empties the queue.
.. method:: pop_flash(queue='')
@@ -288,10 +280,10 @@ been popped.
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.
+Once one or more messages have 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='')
@@ -322,8 +314,8 @@ You can avoid most of these attacks by issuing a unique token to the browser
and then requiring that it be present in all potentially unsafe requests.
:app:`Pyramid` sessions provide facilities to create and check CSRF tokens.
-To use CSRF tokens, you must first enable a :term:`session factory`
-as described in :ref:`using_the_default_session_factory` or
+To use CSRF tokens, you must first enable a :term:`session factory` as
+described in :ref:`using_the_default_session_factory` or
:ref:`using_alternate_session_factories`.
.. index::
@@ -342,9 +334,9 @@ To get the current CSRF token from the session, use the
The ``session.get_csrf_token()`` method accepts no arguments. It returns a
CSRF *token* string. If ``session.get_csrf_token()`` or
``session.new_csrf_token()`` was invoked previously for this session, then the
-existing token will be returned. If no CSRF token previously existed for
-this session, then a new token will be will be set into the session and returned.
-The newly created token will be opaque and randomized.
+existing token will be returned. If no CSRF token previously existed for this
+session, then a new token will be set into the session and returned. The newly
+created token will be opaque and randomized.
You can use the returned token as the value of a hidden field in a form that
posts to a method that requires elevated privileges, or supply it as a request
@@ -359,7 +351,7 @@ For example, include the CSRF token as a hidden field:
<input type="submit" value="Delete Everything">
</form>
-Or, include it as a header in a jQuery AJAX request:
+Or include it as a header in a jQuery AJAX request:
.. code-block:: javascript
@@ -372,18 +364,17 @@ Or, include it as a header in a jQuery AJAX request:
alert("Deleted");
});
-
-The handler for the URL that receives the request
-should then require that the correct CSRF token is supplied.
+The handler for the URL that receives the request should then require that the
+correct CSRF token is supplied.
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
-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.
+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.
By default, it checks for a GET or POST parameter named ``csrf_token`` or a
header named ``X-CSRF-Token``.
@@ -401,12 +392,12 @@ header named ``X-CSRF-Token``.
.. index::
single: session.new_csrf_token
-Checking CSRF Tokens With A View Predicate
+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`.
+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_view`.
.. code-block:: python
@@ -414,18 +405,20 @@ See :meth:`pyramid.config.Configurator.add_route`.
def myview(request):
...
+.. note::
+ A mismatch of a 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-To explicitly create a new CSRF token, use the
-``session.new_csrf_token()`` method. This differs only from
-``session.get_csrf_token()`` inasmuch as it clears any existing CSRF token,
-creates a new CSRF token, sets the token into the session, and returns the
-token.
+To explicitly create a new CSRF token, use the ``session.new_csrf_token()``
+method. This differs only from ``session.get_csrf_token()`` inasmuch as it
+clears any existing CSRF token, creates a new CSRF token, sets the token into
+the session, and returns the token.
.. code-block:: python
token = request.session.new_csrf_token()
-
-
diff --git a/docs/narr/startup.rst b/docs/narr/startup.rst
index 7b4a7ea08..3e168eaea 100644
--- a/docs/narr/startup.rst
+++ b/docs/narr/startup.rst
@@ -6,19 +6,19 @@ Startup
When you cause a :app:`Pyramid` application to start up in a console window,
you'll see something much like this show up on the console:
-.. code-block:: text
+.. code-block:: bash
- $ pserve development.ini
- Starting server in PID 16601.
- serving on 0.0.0.0:6543 view at http://127.0.0.1:6543
+ $ $VENV/bin/pserve development.ini
+ Starting server in PID 16305.
+ serving on http://127.0.0.1:6543
-This chapter explains what happens between the time you press the "Return"
-key on your keyboard after typing ``pserve development.ini``
-and the time the line ``serving on 0.0.0.0:6543 ...`` is output to your
-console.
+This chapter explains what happens between the time you press the "Return" key
+on your keyboard after typing ``pserve development.ini`` and the time the line
+``serving on http://127.0.0.1:6543`` is output to your console.
.. index::
single: startup process
+ pair: settings; .ini
The Startup Process
-------------------
@@ -26,9 +26,8 @@ The Startup Process
The easiest and best-documented way to start and serve a :app:`Pyramid`
application is to use the ``pserve`` command against a :term:`PasteDeploy`
``.ini`` file. This uses the ``.ini`` file to infer settings and starts a
-server listening on a port. For the purposes of this discussion, we'll
-assume that you are using this command to run your :app:`Pyramid`
-application.
+server listening on a port. For the purposes of this discussion, we'll assume
+that you are using this command to run your :app:`Pyramid` application.
Here's a high-level time-ordered overview of what happens when you press
``return`` after running ``pserve development.ini``.
@@ -40,30 +39,29 @@ Here's a high-level time-ordered overview of what happens when you press
#. The framework finds a section named either ``[app:main]``,
``[pipeline:main]``, or ``[composite:main]`` in the ``.ini`` file. This
- section represents the configuration of a :term:`WSGI` application that
- will be served. If you're using a simple application (e.g.
- ``[app:main]``), the application's ``paste.app_factory`` :term:`entry
- point` will be named on the ``use=`` line within the section's
- configuration. If, instead of a simple application, you're using a WSGI
- :term:`pipeline` (e.g. a ``[pipeline:main]`` section), the application
- named on the "last" element will refer to your :app:`Pyramid` application.
- If instead of a simple application or a pipeline, you're using a
- "composite" (e.g. ``[composite:main]``), refer to the documentation for
- that particular composite to understand how to make it refer to your
- :app:`Pyramid` application. In most cases, a Pyramid application built
- from a scaffold will have a single ``[app:main]`` section in it, and this
- will be the application served.
-
-#. The framework finds all :mod:`logging` related configuration in the
- ``.ini`` file and uses it to configure the Python standard library logging
- system for this application. See :ref:`logging_config` for more
- information.
-
-#. The application's *constructor* named by the entry point reference on the
- ``use=`` line of the section representing your :app:`Pyramid` application
- is passed the key/value parameters mentioned within the section in which
- it's defined. The constructor is meant to return a :term:`router`
- instance, which is a :term:`WSGI` application.
+ section represents the configuration of a :term:`WSGI` application that will
+ be served. If you're using a simple application (e.g., ``[app:main]``), the
+ application's ``paste.app_factory`` :term:`entry point` will be named on the
+ ``use=`` line within the section's configuration. If instead of a simple
+ application, you're using a WSGI :term:`pipeline` (e.g., a
+ ``[pipeline:main]`` section), the application named on the "last" element
+ will refer to your :app:`Pyramid` application. If instead of a simple
+ application or a pipeline, you're using a "composite" (e.g.,
+ ``[composite:main]``), refer to the documentation for that particular
+ composite to understand how to make it refer to your :app:`Pyramid`
+ application. In most cases, a Pyramid application built from a scaffold
+ will have a single ``[app:main]`` section in it, and this will be the
+ application served.
+
+#. The framework finds all :mod:`logging` related configuration in the ``.ini``
+ file and uses it to configure the Python standard library logging system for
+ this application. See :ref:`logging_config` for more information.
+
+#. The application's *constructor* named by the entry point referenced on the
+ ``use=`` line of the section representing your :app:`Pyramid` application is
+ passed the key/value parameters mentioned within the section in which it's
+ defined. The constructor is meant to return a :term:`router` instance,
+ which is a :term:`WSGI` application.
For :app:`Pyramid` applications, the constructor will be a function named
``main`` in the ``__init__.py`` file within the :term:`package` in which
@@ -77,14 +75,13 @@ Here's a high-level time-ordered overview of what happens when you press
Note that the constructor function accepts a ``global_config`` argument,
which is a dictionary of key/value pairs mentioned in the ``[DEFAULT]``
- section of an ``.ini`` file
- (if :ref:`[DEFAULT] <defaults_section_of_pastedeploy_file>` is present).
- It also accepts a ``**settings`` argument, which collects
- another set of arbitrary key/value pairs. The arbitrary key/value pairs
- received by this function in ``**settings`` will be composed of all the
- key/value pairs that are present in the ``[app:main]`` section (except for
- the ``use=`` setting) when this function is called by when you run
- ``pserve``.
+ section of an ``.ini`` file (if :ref:`[DEFAULT]
+ <defaults_section_of_pastedeploy_file>` is present). It also accepts a
+ ``**settings`` argument, which collects another set of arbitrary key/value
+ pairs. The arbitrary key/value pairs received by this function in
+ ``**settings`` will be composed of all the key/value pairs that are present
+ in the ``[app:main]`` section (except for the ``use=`` setting) when this
+ function is called when you run ``pserve``.
Our generated ``development.ini`` file looks like so:
@@ -94,12 +91,12 @@ Here's a high-level time-ordered overview of what happens when you press
In this case, the ``myproject.__init__:main`` function referred to by the
entry point URI ``egg:MyProject`` (see :ref:`MyProject_ini` for more
- information about entry point URIs, and how they relate to callables),
- will receive the key/value pairs ``{'pyramid.reload_templates':'true',
- 'pyramid.debug_authorization':'false', 'pyramid.debug_notfound':'false',
- 'pyramid.debug_routematch':'false', 'pyramid.debug_templates':'true',
- 'pyramid.default_locale_name':'en'}``. See :ref:`environment_chapter` for
- the meanings of these keys.
+ information about entry point URIs, and how they relate to callables) will
+ receive the key/value pairs ``{pyramid.reload_templates = true,
+ pyramid.debug_authorization = false, pyramid.debug_notfound = false,
+ pyramid.debug_routematch = false, pyramid.default_locale_name = en, and
+ pyramid.includes = pyramid_debugtoolbar}``. See :ref:`environment_chapter`
+ for the meanings of these keys.
#. The ``main`` function first constructs a
:class:`~pyramid.config.Configurator` instance, passing the ``settings``
@@ -113,13 +110,13 @@ Here's a high-level time-ordered overview of what happens when you press
#. The ``main`` function then calls various methods on the instance of the
class :class:`~pyramid.config.Configurator` created in the previous step.
- The intent of calling these methods is to populate an
- :term:`application registry`, which represents the :app:`Pyramid`
- configuration related to the application.
+ The intent of calling these methods is to populate an :term:`application
+ registry`, which represents the :app:`Pyramid` configuration related to the
+ application.
-#. The :meth:`~pyramid.config.Configurator.make_wsgi_app` method is called.
- The result is a :term:`router` instance. The router is associated with
- the :term:`application registry` implied by the configurator previously
+#. The :meth:`~pyramid.config.Configurator.make_wsgi_app` method is called. The
+ result is a :term:`router` instance. The router is associated with the
+ :term:`application registry` implied by the configurator previously
populated by other methods run against the Configurator. The router is a
WSGI application.
@@ -134,10 +131,15 @@ Here's a high-level time-ordered overview of what happens when you press
#. ``pserve`` starts the WSGI *server* defined within the ``[server:main]``
section. In our case, this is the Waitress server (``use =
egg:waitress#main``), and it will listen on all interfaces (``host =
- 0.0.0.0``), on port number 6543 (``port = 6543``). The server code itself
- is what prints ``serving on 0.0.0.0:6543 view at http://127.0.0.1:6543``.
- The server serves the application, and the application is running, waiting
- to receive requests.
+ 127.0.0.1``), on port number 6543 (``port = 6543``). The server code itself
+ is what prints ``serving on http://127.0.0.1:6543``. The server serves the
+ application, and the application is running, waiting to receive requests.
+
+.. seealso::
+ Logging configuration is described in the :ref:`logging_chapter` chapter.
+ There, in :ref:`request_logging_with_pastes_translogger`, you will also find
+ an example of how to configure :term:`middleware` to add pre-packaged
+ functionality to your application.
.. index::
pair: settings; deployment
@@ -150,8 +152,7 @@ Deployment Settings
Note that an augmented version of the values passed as ``**settings`` to the
:class:`~pyramid.config.Configurator` constructor will be available in
-:app:`Pyramid` :term:`view callable` code as ``request.registry.settings``.
-You can create objects you wish to access later from view code, and put them
-into the dictionary you pass to the configurator as ``settings``. They will
-then be present in the ``request.registry.settings`` dictionary at
-application runtime.
+:app:`Pyramid` :term:`view callable` code as ``request.registry.settings``. You
+can create objects you wish to access later from view code, and put them into
+the dictionary you pass to the configurator as ``settings``. They will then be
+present in the ``request.registry.settings`` dictionary at application runtime.
diff --git a/docs/narr/subrequest.rst b/docs/narr/subrequest.rst
index 4b4e99d41..daa3cc43f 100644
--- a/docs/narr/subrequest.rst
+++ b/docs/narr/subrequest.rst
@@ -17,6 +17,7 @@ application.
Here's an example application which uses a subrequest:
.. code-block:: python
+ :linenos:
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
@@ -41,16 +42,16 @@ Here's an example application which uses a subrequest:
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
-When ``/view_one`` is visted in a browser, the text printed in the browser
-pane will be ``This came from view_two``. The ``view_one`` view used the
-:meth:`pyramid.request.Request.invoke_subrequest` API to obtain a response
-from another view (``view_two``) within the same application when it
-executed. It did so by constructing a new request that had a URL that it
-knew would match the ``view_two`` view registration, and passed that new
-request along to :meth:`pyramid.request.Request.invoke_subrequest`. The
-``view_two`` view callable was invoked, and it returned a response. The
-``view_one`` view callable then simply returned the response it obtained from
-the ``view_two`` view callable.
+When ``/view_one`` is visted in a browser, the text printed in the browser pane
+will be ``This came from view_two``. The ``view_one`` view used the
+:meth:`pyramid.request.Request.invoke_subrequest` API to obtain a response from
+another view (``view_two``) within the same application when it executed. It
+did so by constructing a new request that had a URL that it knew would match
+the ``view_two`` view registration, and passed that new request along to
+:meth:`pyramid.request.Request.invoke_subrequest`. The ``view_two`` view
+callable was invoked, and it returned a response. The ``view_one`` view
+callable then simply returned the response it obtained from the ``view_two``
+view callable.
Note that it doesn't matter if the view callable invoked via a subrequest
actually returns a *literal* Response object. Any view callable that uses a
@@ -60,6 +61,8 @@ adapter when found and invoked via
object:
.. code-block:: python
+ :linenos:
+ :emphasize-lines: 11
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
@@ -83,19 +86,19 @@ object:
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
-Even though the ``view_two`` view callable returned a string, it was invoked
-in such a way that the ``string`` renderer associated with the view
-registration that was found turned it into a "real" response object for
-consumption by ``view_one``.
+Even though the ``view_two`` view callable returned a string, it was invoked in
+such a way that the ``string`` renderer associated with the view registration
+that was found turned it into a "real" response object for consumption by
+``view_one``.
Being able to unconditionally obtain a response object by invoking a view
callable indirectly is the main advantage to using
-:meth:`pyramid.request.Request.invoke_subrequest` instead of simply importing
-a view callable and executing it directly. Note that there's not much
-advantage to invoking a view using a subrequest if you *can* invoke a view
-callable directly. Subrequests are slower and are less convenient if you
-actually do want just the literal information returned by a function that
-happens to be a view callable.
+:meth:`pyramid.request.Request.invoke_subrequest` instead of simply importing a
+view callable and executing it directly. Note that there's not much advantage
+to invoking a view using a subrequest if you *can* invoke a view callable
+directly. Subrequests are slower and are less convenient if you actually do
+want just the literal information returned by a function that happens to be a
+view callable.
Note that, by default, if a view callable invoked by a subrequest raises an
exception, the exception will be raised to the caller of
@@ -103,6 +106,8 @@ exception, the exception will be raised to the caller of
:term:`exception view` configured:
.. code-block:: python
+ :linenos:
+ :emphasize-lines: 11-16
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
@@ -136,15 +141,21 @@ When we run the above code and visit ``/view_one`` in a browser, the
``excview`` :term:`exception view` will *not* be executed. Instead, the call
to :meth:`~pyramid.request.Request.invoke_subrequest` will cause a
:exc:`ValueError` exception to be raised and a response will never be
-generated. We can change this behavior; how to do so is described below in
-our discussion of the ``use_tweens`` argument.
+generated. We can change this behavior; how to do so is described below in our
+discussion of the ``use_tweens`` argument.
+
+.. index::
+ pair: subrequest; use_tweens
+
+Subrequests with Tweens
+-----------------------
The :meth:`pyramid.request.Request.invoke_subrequest` API accepts two
-arguments: a positional argument ``request`` that must be provided, and
-``use_tweens`` keyword argument that is optional; it defaults to ``False``.
+arguments: a required positional argument ``request``, and an optional keyword
+argument ``use_tweens`` which defaults to ``False``.
-The ``request`` object passed to the API must be an object that implements
-the Pyramid request interface (such as a :class:`pyramid.request.Request`
+The ``request`` object passed to the API must be an object that implements the
+Pyramid request interface (such as a :class:`pyramid.request.Request`
instance). If ``use_tweens`` is ``True``, the request will be sent to the
:term:`tween` in the tween stack closest to the request ingress. If
``use_tweens`` is ``False``, the request will be sent to the main router
@@ -153,9 +164,9 @@ handler, and no tweens will be invoked.
In the example above, the call to
:meth:`~pyramid.request.Request.invoke_subrequest` will always raise an
exception. This is because it's using the default value for ``use_tweens``,
-which is ``False``. You can pass ``use_tweens=True`` instead to ensure that
-it will convert an exception to a Response if an :term:`exception view` is
-configured instead of raising the exception. This is because exception views
+which is ``False``. Alternatively, you can pass ``use_tweens=True`` to ensure
+that it will convert an exception to a Response if an :term:`exception view` is
+configured, instead of raising the exception. This is because exception views
are called by the exception view :term:`tween` as described in
:ref:`exception_views` when any view raises an exception.
@@ -164,6 +175,8 @@ We can cause the subrequest to be run through the tween stack by passing
:meth:`~pyramid.request.Request.invoke_subrequest`, like this:
.. code-block:: python
+ :linenos:
+ :emphasize-lines: 7
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
@@ -199,71 +212,70 @@ attempted invocation of ``view_two``, because the tween which invokes an
exception view to generate a response is run, and therefore ``excview`` is
executed.
-This is one of the major differences between specifying the
-``use_tweens=True`` and ``use_tweens=False`` arguments to
+This is one of the major differences between specifying the ``use_tweens=True``
+and ``use_tweens=False`` arguments to
:meth:`~pyramid.request.Request.invoke_subrequest`. ``use_tweens=True`` may
-also imply invoking transaction commit/abort for the logic executed in the
-subrequest if you've got ``pyramid_tm`` in the tween list, injecting debug
-HTML if you've got ``pyramid_debugtoolbar`` in the tween list, and other
+also imply invoking a transaction commit or abort for the logic executed in the
+subrequest if you've got ``pyramid_tm`` in the tween list, injecting debug HTML
+if you've got ``pyramid_debugtoolbar`` in the tween list, and other
tween-related side effects as defined by your particular tween list.
The :meth:`~pyramid.request.Request.invoke_subrequest` function also
-unconditionally:
-
-- manages the threadlocal stack so that
+unconditionally does the following:
+
+- It manages the threadlocal stack so that
:func:`~pyramid.threadlocal.get_current_request` and
- :func:`~pyramid.threadlocal.get_current_registry` work during a request
- (they will return the subrequest instead of the original request)
+ :func:`~pyramid.threadlocal.get_current_registry` work during a request (they
+ will return the subrequest instead of the original request).
-- Adds a ``registry`` attribute and a ``invoke_subrequest`` attribute (a
- callable) to the request object it's handed.
+- It adds a ``registry`` attribute and an ``invoke_subrequest`` attribute (a
+ callable) to the request object to which it is handed.
-- sets request extensions (such as those added via
+- It sets request extensions (such as those added via
:meth:`~pyramid.config.Configurator.add_request_method` or
:meth:`~pyramid.config.Configurator.set_request_property`) on the subrequest
- object passed as ``request``
+ object passed as ``request``.
-- causes a :class:`~pyramid.events.NewRequest` event to be sent at the
+- It causes a :class:`~pyramid.events.NewRequest` event to be sent at the
beginning of request processing.
-- causes a :class:`~pyramid.events.ContextFound` event to be sent when a
+- It causes a :class:`~pyramid.events.ContextFound` event to be sent when a
context resource is found.
-- Ensures that the user implied by the request passed has the necessary
- authorization to invoke view callable before calling it.
+- It ensures that the user implied by the request passed in has the necessary
+ authorization to invoke the view callable before calling it.
-- Calls any :term:`response callback` functions defined within the subrequest's
- lifetime if a response is obtained from the Pyramid application.
+- It calls any :term:`response callback` functions defined within the
+ subrequest's lifetime if a response is obtained from the Pyramid application.
-- causes a :class:`~pyramid.events.NewResponse` event to be sent if a response
- is obtained.
+- It causes a :class:`~pyramid.events.NewResponse` event to be sent if a
+ response is obtained.
-- Calls any :term:`finished callback` functions defined within the subrequest's
- lifetime.
+- It calls any :term:`finished callback` functions defined within the
+ subrequest's lifetime.
-The invocation of a subrequest has more or less exactly the same effect as
-the invocation of a request received by the Pyramid router from a web client
+The invocation of a subrequest has more or less exactly the same effect as the
+invocation of a request received by the :app:`Pyramid` router from a web client
when ``use_tweens=True``. When ``use_tweens=False``, the tweens are skipped
but all the other steps take place.
It's a poor idea to use the original ``request`` object as an argument to
-:meth:`~pyramid.request.Request.invoke_subrequest`. You should construct a
-new request instead as demonstrated in the above example, using
+:meth:`~pyramid.request.Request.invoke_subrequest`. You should construct a new
+request instead as demonstrated in the above example, using
:meth:`pyramid.request.Request.blank`. Once you've constructed a request
-object, you'll need to massage it to match the view callable you'd like
-to be executed during the subrequest. This can be done by adjusting the
+object, you'll need to massage it to match the view callable that you'd like to
+be executed during the subrequest. This can be done by adjusting the
subrequest's URL, its headers, its request method, and other attributes. The
documentation for :class:`pyramid.request.Request` exposes the methods you
-should call and attributes you should set on the request you create to
-massage it into something that will actually match the view you'd like to
-call via a subrequest.
-
-We've demonstrated use of a subrequest from within a view callable, but you
-can use the :meth:`~pyramid.request.Request.invoke_subrequest` API from
-within a tween or an event handler as well. It's usually a poor idea to
-invoke :meth:`~pyramid.request.Request.invoke_subrequest` from within a
-tween, because tweens already by definition have access to a function that
-will cause a subrequest (they are passed a ``handle`` function), but you can
-do it. It's fine to invoke
-:meth:`~pyramid.request.Request.invoke_subrequest` from within an event
-handler, however.
+should call and attributes you should set on the request that you create, then
+massage it into something that will actually match the view you'd like to call
+via a subrequest.
+
+We've demonstrated use of a subrequest from within a view callable, but you can
+use the :meth:`~pyramid.request.Request.invoke_subrequest` API from within a
+tween or an event handler as well. Even though you can do it, it's usually a
+poor idea to invoke :meth:`~pyramid.request.Request.invoke_subrequest` from
+within a tween, because tweens already, by definition, have access to a
+function that will cause a subrequest (they are passed a ``handle`` function).
+It's fine to invoke :meth:`~pyramid.request.Request.invoke_subrequest` from
+within an event handler, however.
diff --git a/docs/narr/tb_introspector.png b/docs/narr/tb_introspector.png
index 4ae406a86..b00d36067 100644
--- a/docs/narr/tb_introspector.png
+++ b/docs/narr/tb_introspector.png
Binary files differ
diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst
index 460cda8ee..9e3a31845 100644
--- a/docs/narr/templates.rst
+++ b/docs/narr/templates.rst
@@ -3,15 +3,14 @@
Templates
=========
-A :term:`template` is a file on disk which can be used to render
-dynamic data provided by a :term:`view`. :app:`Pyramid` offers a
-number of ways to perform templating tasks out of the box, and
-provides add-on templating support through a set of bindings packages.
+A :term:`template` is a file on disk which can be used to render dynamic data
+provided by a :term:`view`. :app:`Pyramid` offers a number of ways to perform
+templating tasks out of the box, and provides add-on templating support through
+a set of bindings packages.
-Before discussing how built-in templates are used in
-detail, we'll discuss two ways to render templates within
-:app:`Pyramid` in general: directly, and via renderer
-configuration.
+Before discussing how built-in templates are used in detail, we'll discuss two
+ways to render templates within :app:`Pyramid` in general: directly and via
+renderer configuration.
.. index::
single: templates used directly
@@ -21,16 +20,15 @@ configuration.
Using Templates Directly
------------------------
-The most straightforward way to use a template within
-:app:`Pyramid` is to cause it to be rendered directly within a
-:term:`view callable`. You may use whatever API is supplied by a
-given templating engine to do so.
+The most straightforward way to use a template within :app:`Pyramid` is to
+cause it to be rendered directly within a :term:`view callable`. You may use
+whatever API is supplied by a given templating engine to do so.
-:app:`Pyramid` provides various APIs that allow you to render templates
-directly from within a view callable. For example, if there is a
-:term:`Chameleon` ZPT template named ``foo.pt`` in a directory named
-``templates`` in your application, you can render the template from
-within the body of a view callable like so:
+:app:`Pyramid` provides various APIs that allow you to render templates directly
+from within a view callable. For example, if there is a :term:`Chameleon` ZPT
+template named ``foo.pt`` in a directory named ``templates`` in your
+application, you can render the template from within the body of a view
+callable like so:
.. code-block:: python
:linenos:
@@ -43,23 +41,21 @@ within the body of a view callable like so:
request=request)
The ``sample_view`` :term:`view callable` function above returns a
-:term:`response` object which contains the body of the
-``templates/foo.pt`` template. In this case, the ``templates``
-directory should live in the same directory as the module containing
-the ``sample_view`` function. The template author will have the names
-``foo`` and ``bar`` available as top-level names for replacement or
-comparison purposes.
+:term:`response` object which contains the body of the ``templates/foo.pt``
+template. In this case, the ``templates`` directory should live in the same
+directory as the module containing the ``sample_view`` function. The template
+author will have the names ``foo`` and ``bar`` available as top-level names for
+replacement or comparison purposes.
In the example above, the path ``templates/foo.pt`` is relative to the
-directory containing the file which defines the view configuration.
-In this case, this is the directory containing the file that
-defines the ``sample_view`` function. Although a renderer path is
-usually just a simple relative pathname, a path named as a renderer
-can be absolute, starting with a slash on UNIX or a drive letter
-prefix on Windows. The path can alternately be an
-:term:`asset specification` in the form
-``some.dotted.package_name:relative/path``. This makes it possible to
-address template assets which live in another package. For example:
+directory containing the file which defines the view configuration. In this
+case, this is the directory containing the file that defines the
+``sample_view`` function. Although a renderer path is usually just a simple
+relative pathname, a path named as a renderer can be absolute, starting with a
+slash on UNIX or a drive letter prefix on Windows. The path can alternatively
+be an :term:`asset specification` in the form
+``some.dotted.package_name:relative/path``. This makes it possible to address
+template assets which live in another package. For example:
.. code-block:: python
:linenos:
@@ -71,38 +67,36 @@ address template assets which live in another package. For example:
{'foo':1, 'bar':2},
request=request)
-An asset specification points at a file within a Python *package*.
-In this case, it points at a file named ``foo.pt`` within the
-``templates`` directory of the ``mypackage`` package. Using an
-asset specification instead of a relative template name is usually
-a good idea, because calls to :func:`~pyramid.renderers.render_to_response`
-using asset specifications will continue to work properly if you move the
-code containing them to another location.
+An asset specification points at a file within a Python *package*. In this
+case, it points at a file named ``foo.pt`` within the ``templates`` directory
+of the ``mypackage`` package. Using an asset specification instead of a
+relative template name is usually a good idea, because calls to
+:func:`~pyramid.renderers.render_to_response` using asset specifications will
+continue to work properly if you move the code containing them to another
+location.
In the examples above we pass in a keyword argument named ``request``
-representing the current :app:`Pyramid` request. Passing a request
-keyword argument will cause the ``render_to_response`` function to
-supply the renderer with more correct system values (see
-:ref:`renderer_system_values`), because most of the information required
-to compose proper system values is present in the request. If your
-template relies on the name ``request`` or ``context``, or if you've
-configured special :term:`renderer globals`, make sure to pass
+representing the current :app:`Pyramid` request. Passing a request keyword
+argument will cause the ``render_to_response`` function to supply the renderer
+with more correct system values (see :ref:`renderer_system_values`), because
+most of the information required to compose proper system values is present in
+the request. If your template relies on the name ``request`` or ``context``,
+or if you've configured special :term:`renderer globals`, make sure to pass
``request`` as a keyword argument in every call to a
``pyramid.renderers.render_*`` function.
-Every view must return a :term:`response` object, except for views
-which use a :term:`renderer` named via view configuration (which we'll
-see shortly). The :func:`pyramid.renderers.render_to_response`
-function is a shortcut function that actually returns a response
-object. This allows the example view above to simply return the result
-of its call to ``render_to_response()`` directly.
+Every view must return a :term:`response` object, except for views which use a
+:term:`renderer` named via view configuration (which we'll see shortly). The
+:func:`pyramid.renderers.render_to_response` function is a shortcut function
+that actually returns a response object. This allows the example view above to
+simply return the result of its call to ``render_to_response()`` directly.
Obviously not all APIs you might call to get response data will return a
-response object. For example, you might render one or more templates to
-a string that you want to use as response data. The
-:func:`pyramid.renderers.render` API renders a template to a string. We
-can manufacture a :term:`response` object directly, and use that string
-as the body of the response:
+response object. For example, you might render one or more templates to a
+string that you want to use as response data. The
+:func:`pyramid.renderers.render` API renders a template to a string. We can
+manufacture a :term:`response` object directly, and use that string as the body
+of the response:
.. code-block:: python
:linenos:
@@ -119,10 +113,10 @@ as the body of the response:
Because :term:`view callable` functions are typically the only code in
:app:`Pyramid` that need to know anything about templates, and because view
-functions are very simple Python, you can use whatever templating system you're
-most comfortable with within :app:`Pyramid`. Install the templating system,
-import its API functions into your views module, use those APIs to generate a
-string, then return that string as the body of a :app:`Pyramid`
+functions are very simple Python, you can use whatever templating system with
+which you're most comfortable within :app:`Pyramid`. Install the templating
+system, import its API functions into your views module, use those APIs to
+generate a string, then return that string as the body of a :app:`Pyramid`
:term:`Response` object.
For example, here's an example of using "raw" Mako_ from within a
@@ -141,34 +135,32 @@ For example, here's an example of using "raw" Mako_ from within a
return response
You probably wouldn't use this particular snippet in a project, because it's
-easier to use the supported
-:ref:`Mako bindings <available_template_system_bindings>`. But if your
-favorite templating system is not supported as a renderer extension for
-:app:`Pyramid`, you can create your own simple combination as shown above.
+easier to use the supported :ref:`Mako bindings
+<available_template_system_bindings>`. But if your favorite templating system
+is not supported as a renderer extension for :app:`Pyramid`, you can create
+your own simple combination as shown above.
.. note::
If you use third-party templating languages without cooperating
:app:`Pyramid` bindings directly within view callables, the
- auto-template-reload strategy explained in
- :ref:`reload_templates_section` will not be available, nor will the
- template asset overriding capability explained in
- :ref:`overriding_assets_section` be available, nor will it be
- possible to use any template using that language as a
- :term:`renderer`. However, it's reasonably easy to write custom
- templating system binding packages for use under :app:`Pyramid` so
- that templates written in the language can be used as renderers.
- See :ref:`adding_and_overriding_renderers` for instructions on how
- to create your own template renderer and
- :ref:`available_template_system_bindings` for example packages.
-
-If you need more control over the status code and content-type, or
-other response attributes from views that use direct templating, you
-may set attributes on the response that influence these values.
-
-Here's an example of changing the content-type and status of the
-response object returned by
-:func:`~pyramid.renderers.render_to_response`:
+ auto-template-reload strategy explained in :ref:`reload_templates_section`
+ will not be available, nor will the template asset overriding capability
+ explained in :ref:`overriding_assets_section` be available, nor will it be
+ possible to use any template using that language as a :term:`renderer`.
+ However, it's reasonably easy to write custom templating system binding
+ packages for use under :app:`Pyramid` so that templates written in the
+ language can be used as renderers. See
+ :ref:`adding_and_overriding_renderers` for instructions on how to create
+ your own template renderer and :ref:`available_template_system_bindings`
+ for example packages.
+
+If you need more control over the status code and content-type, or other
+response attributes from views that use direct templating, you may set
+attributes on the response that influence these values.
+
+Here's an example of changing the content-type and status of the response
+object returned by :func:`~pyramid.renderers.render_to_response`:
.. code-block:: python
:linenos:
@@ -183,8 +175,8 @@ response object returned by
response.status_int = 204
return response
-Here's an example of manufacturing a response object using the result
-of :func:`~pyramid.renderers.render` (a string):
+Here's an example of manufacturing a response object using the result of
+:func:`~pyramid.renderers.render` (a string):
.. code-block:: python
:linenos:
@@ -214,9 +206,8 @@ of :func:`~pyramid.renderers.render` (a string):
System Values Used During Rendering
-----------------------------------
-When a template is rendered using
-:func:`~pyramid.renderers.render_to_response` or
-:func:`~pyramid.renderers.render`, or a ``renderer=`` argument to view
+When a template is rendered using :func:`~pyramid.renderers.render_to_response`
+or :func:`~pyramid.renderers.render`, or a ``renderer=`` argument to view
configuration (see :ref:`templates_used_as_renderers`), the renderer
representing the template will be provided with a number of *system* values.
These values are provided to the template:
@@ -232,31 +223,31 @@ These values are provided to the template:
``context``
The current :app:`Pyramid` :term:`context` if ``request`` was provided as a
- keyword argument to ``render_to_response`` or ``render``, or ``None`` if
- the ``request`` keyword argument was not provided. This value will always
- be provided if the template is rendered as the result of a ``renderer=``
- argument to view configuration being used.
+ keyword argument to ``render_to_response`` or ``render``, or ``None`` if the
+ ``request`` keyword argument was not provided. This value will always be
+ provided if the template is rendered as the result of a ``renderer=``
+ argument to the view configuration being used.
``renderer_name``
- The renderer name used to perform the rendering,
- e.g. ``mypackage:templates/foo.pt``.
+ The renderer name used to perform the rendering, e.g.,
+ ``mypackage:templates/foo.pt``.
``renderer_info``
An object implementing the :class:`pyramid.interfaces.IRendererInfo`
interface. Basically, an object with the following attributes: ``name``,
- ``package`` and ``type``.
+ ``package``, and ``type``.
``view``
- The view callable object that was used to render this template. If the
- view callable is a method of a class-based view, this will be an instance
- of the class that the method was defined on. If the view callable is a
- function or instance, it will be that function or instance. Note that this
- value will only be automatically present when a template is rendered as a
- result of a ``renderer=`` argument; it will be ``None`` when the
- ``render_to_response`` or ``render`` APIs are used.
+ The view callable object that was used to render this template. If the view
+ callable is a method of a class-based view, this will be an instance of the
+ class that the method was defined on. If the view callable is a function or
+ instance, it will be that function or instance. Note that this value will
+ only be automatically present when a template is rendered as a result of a
+ ``renderer=`` argument; it will be ``None`` when the ``render_to_response``
+ or ``render`` APIs are used.
-You can define more values which will be passed to every template executed as
-a result of rendering by defining :term:`renderer globals`.
+You can define more values which will be passed to every template executed as a
+result of rendering by defining :term:`renderer globals`.
What any particular renderer does with these system values is up to the
renderer itself, but most template renderers make these names available as
@@ -270,26 +261,23 @@ top-level template variables.
Templates Used as Renderers via Configuration
---------------------------------------------
-An alternative to using :func:`~pyramid.renderers.render_to_response`
-to render templates manually in your view callable code, is
-to specify the template as a :term:`renderer` in your
-*view configuration*. This can be done with any of the
+An alternative to using :func:`~pyramid.renderers.render_to_response` to render
+templates manually in your view callable code is to specify the template as a
+:term:`renderer` in your *view configuration*. This can be done with any of the
templating languages supported by :app:`Pyramid`.
-To use a renderer via view configuration, specify a template
-:term:`asset specification` as the ``renderer`` argument, or
-attribute to the :term:`view configuration` of a :term:`view
-callable`. Then return a *dictionary* from that view callable. The
-dictionary items returned by the view callable will be made available
-to the renderer template as top-level names.
+To use a renderer via view configuration, specify a template :term:`asset
+specification` as the ``renderer`` argument, or attribute to the :term:`view
+configuration` of a :term:`view callable`. Then return a *dictionary* from
+that view callable. The dictionary items returned by the view callable will be
+made available to the renderer template as top-level names.
-The association of a template as a renderer for a :term:`view
-configuration` makes it possible to replace code within a :term:`view
-callable` that handles the rendering of a template.
+The association of a template as a renderer for a :term:`view configuration`
+makes it possible to replace code within a :term:`view callable` that handles
+the rendering of a template.
-Here's an example of using a :class:`~pyramid.view.view_config`
-decorator to specify a :term:`view configuration` that names a
-template renderer:
+Here's an example of using a :class:`~pyramid.view.view_config` decorator to
+specify a :term:`view configuration` that names a template renderer:
.. code-block:: python
:linenos:
@@ -302,11 +290,10 @@ template renderer:
.. note::
- You do not need to supply the ``request`` value as a key
- in the dictionary result returned from a renderer-configured view
- callable. :app:`Pyramid` automatically supplies this value for
- you so that the "most correct" system values are provided to
- the renderer.
+ You do not need to supply the ``request`` value as a key in the dictionary
+ result returned from a renderer-configured view callable. :app:`Pyramid`
+ automatically supplies this value for you, so that the "most correct" system
+ values are provided to the renderer.
.. warning::
@@ -314,10 +301,9 @@ template renderer:
shown above is the template *path*. In the example above, the path
``templates/foo.pt`` is *relative*. Relative to what, you ask? Because
we're using a Chameleon renderer, it means "relative to the directory in
- which the file which defines the view configuration lives". In this case,
+ which the file that defines the view configuration lives". In this case,
this is the directory containing the file that defines the ``my_view``
- function. View-configuration-relative asset specifications work only
- in Chameleon, not in Mako templates.
+ function.
Similar renderer configuration can be done imperatively. See
:ref:`views_which_use_a_renderer`.
@@ -328,7 +314,7 @@ Similar renderer configuration can be done imperatively. See
Although a renderer path is usually just a simple relative pathname, a path
named as a renderer can be absolute, starting with a slash on UNIX or a drive
-letter prefix on Windows. The path can alternately be an :term:`asset
+letter prefix on Windows. The path can alternatively be an :term:`asset
specification` in the form ``some.dotted.package_name:relative/path``, making
it possible to address template assets which live in another package.
@@ -336,32 +322,31 @@ Not just any template from any arbitrary templating system may be used as a
renderer. Bindings must exist specifically for :app:`Pyramid` to use a
templating language template as a renderer.
-.. sidebar:: Why Use A Renderer via View Configuration
-
- Using a renderer in view configuration is usually a better way to
- render templates than using any rendering API directly from within a
- :term:`view callable` because it makes the view callable more
- unit-testable. Views which use templating or rendering APIs directly
- must return a :term:`Response` object. Making testing assertions
- about response objects is typically an indirect process, because it
- means that your test code often needs to somehow parse information
- out of the response body (often HTML). View callables configured
- with renderers externally via view configuration typically return a
- dictionary, as above. Making assertions about results returned in a
- dictionary is almost always more direct and straightforward than
- needing to parse HTML.
+.. sidebar:: Why Use a Renderer via View Configuration
+
+ Using a renderer in view configuration is usually a better way to render
+ templates than using any rendering API directly from within a :term:`view
+ callable` because it makes the view callable more unit-testable. Views
+ which use templating or rendering APIs directly must return a
+ :term:`Response` object. Making testing assertions about response objects
+ is typically an indirect process, because it means that your test code often
+ needs to somehow parse information out of the response body (often HTML).
+ View callables configured with renderers externally via view configuration
+ typically return a dictionary, as above. Making assertions about results
+ returned in a dictionary is almost always more direct and straightforward
+ than needing to parse HTML.
By default, views rendered via a template renderer return a :term:`Response`
object which has a *status code* of ``200 OK``, and a *content-type* of
``text/html``. To vary attributes of the response of a view that uses a
-renderer, such as the content-type, headers, or status attributes, you must
-use the API of the :class:`pyramid.response.Response` object exposed as
+renderer, such as the content-type, headers, or status attributes, you must use
+the API of the :class:`pyramid.response.Response` object exposed as
``request.response`` within the view before returning the dictionary. See
:ref:`request_response_attr` for more information.
-The same set of system values are provided to templates rendered via a
-renderer view configuration as those provided to templates rendered
-imperatively. See :ref:`renderer_system_values`.
+The same set of system values are provided to templates rendered via a renderer
+view configuration as those provided to templates rendered imperatively. See
+:ref:`renderer_system_values`.
.. index::
pair: debugging; templates
@@ -402,32 +387,31 @@ displaying the arguments passed to the template itself.
Automatically Reloading Templates
---------------------------------
-It's often convenient to see changes you make to a template file
-appear immediately without needing to restart the application process.
-:app:`Pyramid` allows you to configure your application development
-environment so that a change to a template will be automatically
-detected, and the template will be reloaded on the next rendering.
+It's often convenient to see changes you make to a template file appear
+immediately without needing to restart the application process. :app:`Pyramid`
+allows you to configure your application development environment so that a
+change to a template will be automatically detected, and the template will be
+reloaded on the next rendering.
.. warning::
- Auto-template-reload behavior is not recommended for
- production sites as it slows rendering slightly; it's
- usually only desirable during development.
+ Auto-template-reload behavior is not recommended for production sites as it
+ slows rendering slightly; it's usually only desirable during development.
In order to turn on automatic reloading of templates, you can use an
-environment variable, or a configuration file setting.
+environment variable or a configuration file setting.
-To use an environment variable, start your application under a shell
-using the ``PYRAMID_RELOAD_TEMPLATES`` operating system environment
-variable set to ``1``, For example:
+To use an environment variable, start your application under a shell using the
+``PYRAMID_RELOAD_TEMPLATES`` operating system environment variable set to
+``1``, For example:
.. code-block:: text
$ PYRAMID_RELOAD_TEMPLATES=1 $VENV/bin/pserve myproject.ini
-To use a setting in the application ``.ini`` file for the same
-purpose, set the ``pyramid.reload_templates`` key to ``true`` within the
-application's configuration section, e.g.:
+To use a setting in the application ``.ini`` file for the same purpose, set the
+``pyramid.reload_templates`` key to ``true`` within the application's
+configuration section, e.g.:
.. code-block:: ini
:linenos:
diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst
index e001ad81c..a3f62058b 100644
--- a/docs/narr/testing.rst
+++ b/docs/narr/testing.rst
@@ -13,34 +13,32 @@ application. In this context, a "unit" is often a function or a method of a
class instance. The unit is also referred to as a "unit under test".
The goal of a single unit test is to test **only** some permutation of the
-"unit under test". If you write a unit test that aims to verify the result
-of a particular codepath through a Python function, you need only be
-concerned about testing the code that *lives in the function body itself*.
-If the function accepts a parameter that represents a complex application
-"domain object" (such as a resource, a database connection, or an SMTP
-server), the argument provided to this function during a unit test *need not
-be* and likely *should not be* a "real" implementation object. For example,
-although a particular function implementation may accept an argument that
-represents an SMTP server object, and the function may call a method of this
-object when the system is operating normally that would result in an email
-being sent, a unit test of this codepath of the function does *not* need to
-test that an email is actually sent. It just needs to make sure that the
-function calls the method of the object provided as an argument that *would*
-send an email if the argument happened to be the "real" implementation of an
-SMTP server object.
+"unit under test". If you write a unit test that aims to verify the result of
+a particular codepath through a Python function, you need only be concerned
+about testing the code that *lives in the function body itself*. If the
+function accepts a parameter that represents a complex application "domain
+object" (such as a resource, a database connection, or an SMTP server), the
+argument provided to this function during a unit test *need not be* and likely
+*should not be* a "real" implementation object. For example, although a
+particular function implementation may accept an argument that represents an
+SMTP server object, and the function may call a method of this object when the
+system is operating normally that would result in an email being sent, a unit
+test of this codepath of the function does *not* need to test that an email is
+actually sent. It just needs to make sure that the function calls the method
+of the object provided as an argument that *would* send an email if the
+argument happened to be the "real" implementation of an SMTP server object.
An *integration test*, on the other hand, is a different form of testing in
which the interaction between two or more "units" is explicitly tested.
-Integration tests verify that the components of your application work
-together. You *might* make sure that an email was actually sent in an
-integration test.
+Integration tests verify that the components of your application work together.
+You *might* make sure that an email was actually sent in an integration test.
A *functional test* is a form of integration test in which the application is
-run "literally". You would *have to* make sure that an email was actually
-sent in a functional test, because it tests your code end to end.
+run "literally". You would *have to* make sure that an email was actually sent
+in a functional test, because it tests your code end to end.
-It is often considered best practice to write each type of tests for any
-given codebase. Unit testing often provides the opportunity to obtain better
+It is often considered best practice to write each type of tests for any given
+codebase. Unit testing often provides the opportunity to obtain better
"coverage": it's usually possible to supply a unit under test with arguments
and/or an environment which causes *all* of its potential codepaths to be
executed. This is usually not as easy to do with a set of integration or
@@ -55,9 +53,9 @@ integration tests. A good :mod:`unittest` tutorial is available within `Dive
Into Python <http://www.diveintopython.net/unit_testing/index.html>`_ by Mark
Pilgrim.
-:app:`Pyramid` provides a number of facilities that make unit, integration,
-and functional tests easier to write. The facilities become particularly
-useful when your code calls into :app:`Pyramid` -related framework functions.
+:app:`Pyramid` provides a number of facilities that make unit, integration, and
+functional tests easier to write. The facilities become particularly useful
+when your code calls into :app:`Pyramid`-related framework functions.
.. index::
single: test setup
@@ -67,42 +65,41 @@ useful when your code calls into :app:`Pyramid` -related framework functions.
.. _test_setup_and_teardown:
Test Set Up and Tear Down
---------------------------
+-------------------------
:app:`Pyramid` uses a "global" (actually :term:`thread local`) data structure
to hold two items: the current :term:`request` and the current
:term:`application registry`. These data structures are available via the
:func:`pyramid.threadlocal.get_current_request` and
-:func:`pyramid.threadlocal.get_current_registry` functions, respectively.
-See :ref:`threadlocals_chapter` for information about these functions and the
-data structures they return.
+:func:`pyramid.threadlocal.get_current_registry` functions, respectively. See
+:ref:`threadlocals_chapter` for information about these functions and the data
+structures they return.
If your code uses these ``get_current_*`` functions or calls :app:`Pyramid`
code which uses ``get_current_*`` functions, you will need to call
:func:`pyramid.testing.setUp` in your test setup and you will need to call
:func:`pyramid.testing.tearDown` in your test teardown.
-:func:`~pyramid.testing.setUp` pushes a registry onto the :term:`thread
-local` stack, which makes the ``get_current_*`` functions work. It returns a
+:func:`~pyramid.testing.setUp` pushes a registry onto the :term:`thread local`
+stack, which makes the ``get_current_*`` functions work. It returns a
:term:`Configurator` object which can be used to perform extra configuration
required by the code under test. :func:`~pyramid.testing.tearDown` pops the
thread local stack.
-Normally when a Configurator is used directly with the ``main`` block of
-a Pyramid application, it defers performing any "real work" until its
-``.commit`` method is called (often implicitly by the
-:meth:`pyramid.config.Configurator.make_wsgi_app` method). The
-Configurator returned by :func:`~pyramid.testing.setUp` is an
-*autocommitting* Configurator, however, which performs all actions
-implied by methods called on it immediately. This is more convenient
-for unit-testing purposes than needing to call
-:meth:`pyramid.config.Configurator.commit` in each test after adding
-extra configuration statements.
+Normally when a Configurator is used directly with the ``main`` block of a
+Pyramid application, it defers performing any "real work" until its ``.commit``
+method is called (often implicitly by the
+:meth:`pyramid.config.Configurator.make_wsgi_app` method). The Configurator
+returned by :func:`~pyramid.testing.setUp` is an *autocommitting* Configurator,
+however, which performs all actions implied by methods called on it
+immediately. This is more convenient for unit testing purposes than needing to
+call :meth:`pyramid.config.Configurator.commit` in each test after adding extra
+configuration statements.
The use of the :func:`~pyramid.testing.setUp` and
-:func:`~pyramid.testing.tearDown` functions allows you to supply each unit
-test method in a test case with an environment that has an isolated registry
-and an isolated request for the duration of a single test. Here's an example
-of using this feature:
+:func:`~pyramid.testing.tearDown` functions allows you to supply each unit test
+method in a test case with an environment that has an isolated registry and an
+isolated request for the duration of a single test. Here's an example of using
+this feature:
.. code-block:: python
:linenos:
@@ -117,21 +114,21 @@ of using this feature:
def tearDown(self):
testing.tearDown()
-The above will make sure that
-:func:`~pyramid.threadlocal.get_current_registry` called within a test
-case method of ``MyTest`` will return the :term:`application registry`
-associated with the ``config`` Configurator instance. Each test case
-method attached to ``MyTest`` will use an isolated registry.
+The above will make sure that :func:`~pyramid.threadlocal.get_current_registry`
+called within a test case method of ``MyTest`` will return the
+:term:`application registry` associated with the ``config`` Configurator
+instance. Each test case method attached to ``MyTest`` will use an isolated
+registry.
The :func:`~pyramid.testing.setUp` and :func:`~pyramid.testing.tearDown`
-functions accepts various arguments that influence the environment of the
-test. See the :ref:`testing_module` API for information about the extra
-arguments supported by these functions.
+functions accept various arguments that influence the environment of the test.
+See the :ref:`testing_module` API for information about the extra arguments
+supported by these functions.
-If you also want to make :func:`~pyramid.threadlocal.get_current_request` return something
-other than ``None`` during the course of a single test, you can pass a
-:term:`request` object into the :func:`pyramid.testing.setUp` within the
-``setUp`` method of your test:
+If you also want to make :func:`~pyramid.threadlocal.get_current_request`
+return something other than ``None`` during the course of a single test, you
+can pass a :term:`request` object into the :func:`pyramid.testing.setUp` within
+the ``setUp`` method of your test:
.. code-block:: python
:linenos:
@@ -147,24 +144,23 @@ other than ``None`` during the course of a single test, you can pass a
def tearDown(self):
testing.tearDown()
-If you pass a :term:`request` object into :func:`pyramid.testing.setUp`
-within your test case's ``setUp``, any test method attached to the
-``MyTest`` test case that directly or indirectly calls
+If you pass a :term:`request` object into :func:`pyramid.testing.setUp` within
+your test case's ``setUp``, any test method attached to the ``MyTest`` test
+case that directly or indirectly calls
:func:`~pyramid.threadlocal.get_current_request` will receive the request
object. Otherwise, during testing,
-:func:`~pyramid.threadlocal.get_current_request` will return ``None``.
-We use a "dummy" request implementation supplied by
-:class:`pyramid.testing.DummyRequest` because it's easier to construct
-than a "real" :app:`Pyramid` request object.
+:func:`~pyramid.threadlocal.get_current_request` will return ``None``. We use a
+"dummy" request implementation supplied by
+:class:`pyramid.testing.DummyRequest` because it's easier to construct than a
+"real" :app:`Pyramid` request object.
Test setup using a context manager
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-An alternative style of setting up a test configuration is to use the
-`with` statement and :func:`pyramid.testing.testConfig` to create a
-context manager. The context manager will call
-:func:`pyramid.testing.setUp` before the code under test and
-:func:`pyramid.testing.tearDown` afterwards.
+An alternative style of setting up a test configuration is to use the ``with``
+statement and :func:`pyramid.testing.testConfig` to create a context manager.
+The context manager will call :func:`pyramid.testing.setUp` before the code
+under test and :func:`pyramid.testing.tearDown` afterwards.
This style is useful for small self-contained tests. For example:
@@ -192,8 +188,8 @@ they're used by frameworks. Sorry. So here's a rule of thumb: if you don't
about any of this, but you still want to write test code, just always call
:func:`pyramid.testing.setUp` in your test's ``setUp`` method and
:func:`pyramid.testing.tearDown` in your tests' ``tearDown`` method. This
-won't really hurt anything if the application you're testing does not call
-any ``get_current*`` function.
+won't really hurt anything if the application you're testing does not call any
+``get_current*`` function.
.. index::
single: pyramid.testing
@@ -224,15 +220,15 @@ function.
.. note::
This code implies that you have defined a renderer imperatively in a
- relevant :class:`pyramid.config.Configurator` instance,
- otherwise it would fail when run normally.
+ relevant :class:`pyramid.config.Configurator` instance, otherwise it would
+ fail when run normally.
Without doing anything special during a unit test, the call to
:meth:`~pyramid.request.Request.has_permission` in this view function will
always return a ``True`` value. When a :app:`Pyramid` application starts
-normally, it will populate a :term:`application registry` using
+normally, it will populate an :term:`application registry` using
:term:`configuration declaration` calls made against a :term:`Configurator`.
-But if this application registry is not created and populated (e.g. by
+But if this application registry is not created and populated (e.g., by
initializing the configurator with an authorization policy), like when you
invoke application code via a unit test, :app:`Pyramid` API functions will tend
to either fail or return default results. So how do you test the branch of the
@@ -282,10 +278,10 @@ In the above example, we create a ``MyTest`` test case that inherits from
be found when ``setup.py test`` is run. It has two test methods.
The first test method, ``test_view_fn_forbidden`` tests the ``view_fn`` when
-the authentication policy forbids the current user the ``edit`` permission.
-Its third line registers a "dummy" "non-permissive" authorization policy
-using the :meth:`~pyramid.config.Configurator.testing_securitypolicy` method,
-which is a special helper method for unit testing.
+the authentication policy forbids the current user the ``edit`` permission. Its
+third line registers a "dummy" "non-permissive" authorization policy using the
+:meth:`~pyramid.config.Configurator.testing_securitypolicy` method, which is a
+special helper method for unit testing.
We then create a :class:`pyramid.testing.DummyRequest` object which simulates a
WebOb request object API. A :class:`pyramid.testing.DummyRequest` is a request
@@ -299,25 +295,25 @@ access. We check that the view function raises a
The second test method, named ``test_view_fn_allowed``, tests the alternate
case, where the authentication policy allows access. Notice that we pass
-different values to
-:meth:`~pyramid.config.Configurator.testing_securitypolicy` to obtain this
-result. We assert at the end of this that the view function returns a value.
+different values to :meth:`~pyramid.config.Configurator.testing_securitypolicy`
+to obtain this result. We assert at the end of this that the view function
+returns a value.
Note that the test calls the :func:`pyramid.testing.setUp` function in its
``setUp`` method and the :func:`pyramid.testing.tearDown` function in its
-``tearDown`` method. We assign the result of :func:`pyramid.testing.setUp`
-as ``config`` on the unittest class. This is a :term:`Configurator` object
-and all methods of the configurator can be called as necessary within
-tests. If you use any of the :class:`~pyramid.config.Configurator` APIs during
-testing, be sure to use this pattern in your test case's ``setUp`` and
-``tearDown``; these methods make sure you're using a "fresh"
-:term:`application registry` per test run.
-
-See the :ref:`testing_module` chapter for the entire :app:`Pyramid` -specific
+``tearDown`` method. We assign the result of :func:`pyramid.testing.setUp` as
+``config`` on the unittest class. This is a :term:`Configurator` object and
+all methods of the configurator can be called as necessary within tests. If you
+use any of the :class:`~pyramid.config.Configurator` APIs during testing, be
+sure to use this pattern in your test case's ``setUp`` and ``tearDown``; these
+methods make sure you're using a "fresh" :term:`application registry` per test
+run.
+
+See the :ref:`testing_module` chapter for the entire :app:`Pyramid`-specific
testing API. This chapter describes APIs for registering a security policy,
-registering resources at paths, registering event listeners, registering
-views and view permissions, and classes representing "dummy" implementations
-of a request and a resource.
+registering resources at paths, registering event listeners, registering views
+and view permissions, and classes representing "dummy" implementations of a
+request and a resource.
.. seealso::
@@ -333,66 +329,29 @@ Creating Integration Tests
--------------------------
In :app:`Pyramid`, a *unit test* typically relies on "mock" or "dummy"
-implementations to give the code under test only enough context to run.
+implementations to give the code under test enough context to run.
"Integration testing" implies another sort of testing. In the context of a
-:app:`Pyramid` integration test, the test logic tests the functionality of
-some code *and* its integration with the rest of the :app:`Pyramid`
+:app:`Pyramid` integration test, the test logic exercises the functionality of
+the code under test *and* its integration with the rest of the :app:`Pyramid`
framework.
-In :app:`Pyramid` applications that are plugins to Pyramid, you can create an
-integration test by including its ``includeme`` function via
-:meth:`pyramid.config.Configurator.include` in the test's setup code. This
-causes the entire :app:`Pyramid` environment to be set up and torn down as if
-your application was running "for real". This is a heavy-hammer way of
-making sure that your tests have enough context to run properly, and it tests
-your code's integration with the rest of :app:`Pyramid`.
-
-Let's demonstrate this by showing an integration test for a view. The below
-test assumes that your application's package name is ``myapp``, and that
-there is a ``views`` module in the app with a function with the name
-``my_view`` in it that returns the response 'Welcome to this application'
-after accessing some values that require a fully set up environment.
+Creating an integration test for a :app:`Pyramid` application usually means
+invoking the application's ``includeme`` function via
+:meth:`pyramid.config.Configurator.include` within the test's setup code. This
+causes the entire :app:`Pyramid` environment to be set up, simulating what
+happens when your application is run "for real". This is a heavy-hammer way of
+making sure that your tests have enough context to run properly, and tests your
+code's integration with the rest of :app:`Pyramid`.
-.. code-block:: python
- :linenos:
-
- import unittest
-
- from pyramid import testing
-
- class ViewIntegrationTests(unittest.TestCase):
- def setUp(self):
- """ This sets up the application registry with the
- registrations your application declares in its ``includeme``
- function.
- """
- import myapp
- self.config = testing.setUp()
- self.config.include('myapp')
+.. seealso::
- def tearDown(self):
- """ Clear out the application registry """
- testing.tearDown()
+ See also :ref:`including_configuration`
- def test_my_view(self):
- from myapp.views import my_view
- request = testing.DummyRequest()
- result = my_view(request)
- self.assertEqual(result.status, '200 OK')
- body = result.app_iter[0]
- self.assertTrue('Welcome to' in body)
- self.assertEqual(len(result.headerlist), 2)
- self.assertEqual(result.headerlist[0],
- ('Content-Type', 'text/html; charset=UTF-8'))
- self.assertEqual(result.headerlist[1], ('Content-Length',
- str(len(body))))
-
-Unless you cannot avoid it, you should prefer writing unit tests that use the
-:class:`~pyramid.config.Configurator` API to set up the right "mock"
-registrations rather than creating an integration test. Unit tests will run
-faster (because they do less for each test) and the result of a unit test is
-usually easier to make assertions about.
+Writing unit tests that use the :class:`~pyramid.config.Configurator` API to
+set up the right "mock" registrations is often preferred to creating
+integration tests. Unit tests will run faster (because they do less for each
+test) and are usually easier to reason about.
.. index::
single: functional tests
@@ -404,34 +363,71 @@ Creating Functional Tests
Functional tests test your literal application.
-The below test assumes that your application's package name is ``myapp``, and
-that there is a view that returns an HTML body when the root URL is invoked.
-It further assumes that you've added a ``tests_require`` dependency on the
-``WebTest`` package within your ``setup.py`` file. :term:`WebTest` is a
-functional testing package written by Ian Bicking.
+In Pyramid, functional tests are typically written using the :term:`WebTest`
+package, which provides APIs for invoking HTTP(S) requests to your application.
-.. code-block:: python
- :linenos:
+Regardless of which testing :term:`package` you use, ensure to add a
+``tests_require`` dependency on that package to your application's
+``setup.py`` file. Using the project ``MyProject`` generated by the starter
+scaffold as described in :doc:`project`, we would insert the following code immediately following the
+``requires`` block in the file ``MyProject/setup.py``.
- import unittest
+.. code-block:: ini
+ :linenos:
+ :lineno-start: 11
+ :emphasize-lines: 8-
- class FunctionalTests(unittest.TestCase):
- def setUp(self):
- from myapp import main
- app = main({})
- from webtest import TestApp
- self.testapp = TestApp(app)
-
- def test_root(self):
- res = self.testapp.get('/', status=200)
- self.assertTrue('Pyramid' in res.body)
-
-When this test is run, each test creates a "real" WSGI application using the
-``main`` function in your ``myapp.__init__`` module and uses :term:`WebTest`
-to wrap that WSGI application. It assigns the result to ``self.testapp``.
-In the test named ``test_root``, we use the testapp's ``get`` method to
-invoke the root URL. We then assert that the returned HTML has the string
-``Pyramid`` in it.
-
-See the :term:`WebTest` documentation for further information about the
-methods available to a :class:`webtest.app.TestApp` instance.
+ requires = [
+ 'pyramid',
+ 'pyramid_chameleon',
+ 'pyramid_debugtoolbar',
+ 'waitress',
+ ]
+
+ test_requires = [
+ 'webtest',
+ ]
+
+Remember to change the dependency.
+
+.. code-block:: ini
+ :linenos:
+ :lineno-start: 39
+ :emphasize-lines: 2
+
+ install_requires=requires,
+ tests_require=test_requires,
+ test_suite="myproject",
+
+As always, whenever you change your dependencies, make sure to run the
+following command.
+
+.. code-block:: bash
+
+ $VENV/bin/python setup.py develop
+
+In your ``MyPackage`` project, your :term:`package` is named ``myproject``
+which contains a ``views`` module, which in turn contains a :term:`view`
+function ``my_view`` that returns an HTML body when the root URL is invoked:
+
+ .. literalinclude:: MyProject/myproject/views.py
+ :linenos:
+ :language: python
+
+The following example functional test demonstrates invoking the above
+:term:`view`:
+
+ .. literalinclude:: MyProject/myproject/tests.py
+ :linenos:
+ :pyobject: FunctionalTests
+ :language: python
+
+When this test is run, each test method creates a "real" :term:`WSGI`
+application using the ``main`` function in your ``myproject.__init__`` module,
+using :term:`WebTest` to wrap that WSGI application. It assigns the result to
+``self.testapp``. In the test named ``test_root``, the ``TestApp``'s ``GET``
+method is used to invoke the root URL. Finally, an assertion is made that the
+returned HTML contains the text ``Pyramid``.
+
+See the :term:`WebTest` documentation for further information about the methods
+available to a :class:`webtest.app.TestApp` instance.
diff --git a/docs/narr/threadlocals.rst b/docs/narr/threadlocals.rst
index afe56de3e..7437a3a76 100644
--- a/docs/narr/threadlocals.rst
+++ b/docs/narr/threadlocals.rst
@@ -8,26 +8,24 @@
Thread Locals
=============
-A :term:`thread local` variable is a variable that appears to be a
-"global" variable to an application which uses it. However, unlike a
-true global variable, one thread or process serving the application
-may receive a different value than another thread or process when that
-variable is "thread local".
+A :term:`thread local` variable is a variable that appears to be a "global"
+variable to an application which uses it. However, unlike a true global
+variable, one thread or process serving the application may receive a different
+value than another thread or process when that variable is "thread local".
-When a request is processed, :app:`Pyramid` makes two :term:`thread
-local` variables available to the application: a "registry" and a
-"request".
+When a request is processed, :app:`Pyramid` makes two :term:`thread local`
+variables available to the application: a "registry" and a "request".
Why and How :app:`Pyramid` Uses Thread Local Variables
----------------------------------------------------------
+------------------------------------------------------
-How are thread locals beneficial to :app:`Pyramid` and application
-developers who use :app:`Pyramid`? Well, usually they're decidedly
-**not**. Using a global or a thread local variable in any application
-usually makes it a lot harder to understand for a casual reader. Use
-of a thread local or a global is usually just a way to avoid passing
-some value around between functions, which is itself usually a very
-bad idea, at least if code readability counts as an important concern.
+How are thread locals beneficial to :app:`Pyramid` and application developers
+who use :app:`Pyramid`? Well, usually they're decidedly **not**. Using a
+global or a thread local variable in any application usually makes it a lot
+harder to understand for a casual reader. Use of a thread local or a global is
+usually just a way to avoid passing some value around between functions, which
+is itself usually a very bad idea, at least if code readability counts as an
+important concern.
For historical reasons, however, thread local variables are indeed consulted by
various :app:`Pyramid` API functions. For example, the implementation of the
@@ -40,119 +38,107 @@ application registry, from which it looks up the authentication policy; it then
uses the authentication policy to retrieve the authenticated user id. This is
how :app:`Pyramid` allows arbitrary authentication policies to be "plugged in".
-When they need to do so, :app:`Pyramid` internals use two API
-functions to retrieve the :term:`request` and :term:`application
-registry`: :func:`~pyramid.threadlocal.get_current_request` and
-:func:`~pyramid.threadlocal.get_current_registry`. The former
-returns the "current" request; the latter returns the "current"
-registry. Both ``get_current_*`` functions retrieve an object from a
-thread-local data structure. These API functions are documented in
-:ref:`threadlocal_module`.
-
-These values are thread locals rather than true globals because one
-Python process may be handling multiple simultaneous requests or even
-multiple :app:`Pyramid` applications. If they were true globals,
-:app:`Pyramid` could not handle multiple simultaneous requests or
-allow more than one :app:`Pyramid` application instance to exist in
-a single Python process.
-
-Because one :app:`Pyramid` application is permitted to call
-*another* :app:`Pyramid` application from its own :term:`view` code
-(perhaps as a :term:`WSGI` app with help from the
-:func:`pyramid.wsgi.wsgiapp2` decorator), these variables are
-managed in a *stack* during normal system operations. The stack
-instance itself is a :class:`threading.local`.
+When they need to do so, :app:`Pyramid` internals use two API functions to
+retrieve the :term:`request` and :term:`application registry`:
+:func:`~pyramid.threadlocal.get_current_request` and
+:func:`~pyramid.threadlocal.get_current_registry`. The former returns the
+"current" request; the latter returns the "current" registry. Both
+``get_current_*`` functions retrieve an object from a thread-local data
+structure. These API functions are documented in :ref:`threadlocal_module`.
+
+These values are thread locals rather than true globals because one Python
+process may be handling multiple simultaneous requests or even multiple
+:app:`Pyramid` applications. If they were true globals, :app:`Pyramid` could
+not handle multiple simultaneous requests or allow more than one :app:`Pyramid`
+application instance to exist in a single Python process.
+
+Because one :app:`Pyramid` application is permitted to call *another*
+:app:`Pyramid` application from its own :term:`view` code (perhaps as a
+:term:`WSGI` app with help from the :func:`pyramid.wsgi.wsgiapp2` decorator),
+these variables are managed in a *stack* during normal system operations. The
+stack instance itself is a :class:`threading.local`.
During normal operations, the thread locals stack is managed by a
-:term:`Router` object. At the beginning of a request, the Router
-pushes the application's registry and the request on to the stack. At
-the end of a request, the stack is popped. The topmost request and
-registry on the stack are considered "current". Therefore, when the
-system is operating normally, the very definition of "current" is
-defined entirely by the behavior of a pyramid :term:`Router`.
+:term:`Router` object. At the beginning of a request, the Router pushes the
+application's registry and the request on to the stack. At the end of a
+request, the stack is popped. The topmost request and registry on the stack
+are considered "current". Therefore, when the system is operating normally,
+the very definition of "current" is defined entirely by the behavior of a
+pyramid :term:`Router`.
However, during unit testing, no Router code is ever invoked, and the
-definition of "current" is defined by the boundary between calls to
-the :meth:`pyramid.config.Configurator.begin` and
-:meth:`pyramid.config.Configurator.end` methods (or between
-calls to the :func:`pyramid.testing.setUp` and
-:func:`pyramid.testing.tearDown` functions). These functions push
-and pop the threadlocal stack when the system is under test. See
-:ref:`test_setup_and_teardown` for the definitions of these functions.
-
-Scripts which use :app:`Pyramid` machinery but never actually start
-a WSGI server or receive requests via HTTP such as scripts which use
-the :mod:`pyramid.scripting` API will never cause any Router code
-to be executed. However, the :mod:`pyramid.scripting` APIs also
-push some values on to the thread locals stack as a matter of course.
-Such scripts should expect the
-:func:`~pyramid.threadlocal.get_current_request` function to always
-return ``None``, and should expect the
-:func:`~pyramid.threadlocal.get_current_registry` function to return
-exactly the same :term:`application registry` for every request.
+definition of "current" is defined by the boundary between calls to the
+:meth:`pyramid.config.Configurator.begin` and
+:meth:`pyramid.config.Configurator.end` methods (or between calls to the
+:func:`pyramid.testing.setUp` and :func:`pyramid.testing.tearDown` functions).
+These functions push and pop the threadlocal stack when the system is under
+test. See :ref:`test_setup_and_teardown` for the definitions of these
+functions.
+
+Scripts which use :app:`Pyramid` machinery but never actually start a WSGI
+server or receive requests via HTTP, such as scripts which use the
+:mod:`pyramid.scripting` API, will never cause any Router code to be executed.
+However, the :mod:`pyramid.scripting` APIs also push some values on to the
+thread locals stack as a matter of course. Such scripts should expect the
+:func:`~pyramid.threadlocal.get_current_request` function to always return
+``None``, and should expect the
+:func:`~pyramid.threadlocal.get_current_registry` function to return exactly
+the same :term:`application registry` for every request.
Why You Shouldn't Abuse Thread Locals
-------------------------------------
You probably should almost never use the
:func:`~pyramid.threadlocal.get_current_request` or
-:func:`~pyramid.threadlocal.get_current_registry` functions, except
-perhaps in tests. In particular, it's almost always a mistake to use
-``get_current_request`` or ``get_current_registry`` in application
-code because its usage makes it possible to write code that can be
-neither easily tested nor scripted. Inappropriate usage is defined as
-follows:
+:func:`~pyramid.threadlocal.get_current_registry` functions, except perhaps in
+tests. In particular, it's almost always a mistake to use
+``get_current_request`` or ``get_current_registry`` in application code because
+its usage makes it possible to write code that can be neither easily tested nor
+scripted. Inappropriate usage is defined as follows:
- ``get_current_request`` should never be called within the body of a
- :term:`view callable`, or within code called by a view callable.
- View callables already have access to the request (it's passed in to
- each as ``request``).
-
-- ``get_current_request`` should never be called in :term:`resource` code.
- If a resource needs access to the request, it should be passed the request
- by a :term:`view callable`.
-
-- ``get_current_request`` function should never be called because it's
- "easier" or "more elegant" to think about calling it than to pass a
- request through a series of function calls when creating some API
- design. Your application should instead almost certainly pass data
- derived from the request around rather than relying on being able to
- call this function to obtain the request in places that actually
- have no business knowing about it. Parameters are *meant* to be
- passed around as function arguments, this is why they exist. Don't
- try to "save typing" or create "nicer APIs" by using this function
- in the place where a request is required; this will only lead to
- sadness later.
-
-- Neither ``get_current_request`` nor ``get_current_registry`` should
- ever be called within application-specific forks of third-party
- library code. The library you've forked almost certainly has
- nothing to do with :app:`Pyramid`, and making it dependent on
- :app:`Pyramid` (rather than making your :app:`pyramid`
- application depend upon it) means you're forming a dependency in the
- wrong direction.
-
-Use of the :func:`~pyramid.threadlocal.get_current_request` function
-in application code *is* still useful in very limited circumstances.
-As a rule of thumb, usage of ``get_current_request`` is useful
-**within code which is meant to eventually be removed**. For
-instance, you may find yourself wanting to deprecate some API that
-expects to be passed a request object in favor of one that does not
-expect to be passed a request object. But you need to keep
-implementations of the old API working for some period of time while
-you deprecate the older API. So you write a "facade" implementation
-of the new API which calls into the code which implements the older
-API. Since the new API does not require the request, your facade
-implementation doesn't have local access to the request when it needs
-to pass it into the older API implementation. After some period of
-time, the older implementation code is disused and the hack that uses
-``get_current_request`` is removed. This would be an appropriate
-place to use the ``get_current_request``.
-
-Use of the :func:`~pyramid.threadlocal.get_current_registry`
-function should be limited to testing scenarios. The registry made
-current by use of the
-:meth:`pyramid.config.Configurator.begin` method during a
-test (or via :func:`pyramid.testing.setUp`) when you do not pass
-one in is available to you via this API.
-
+ :term:`view callable`, or within code called by a view callable. View
+ callables already have access to the request (it's passed in to each as
+ ``request``).
+
+- ``get_current_request`` should never be called in :term:`resource` code. If a
+ resource needs access to the request, it should be passed the request by a
+ :term:`view callable`.
+
+- ``get_current_request`` function should never be called because it's "easier"
+ or "more elegant" to think about calling it than to pass a request through a
+ series of function calls when creating some API design. Your application
+ should instead, almost certainly, pass around data derived from the request
+ rather than relying on being able to call this function to obtain the request
+ in places that actually have no business knowing about it. Parameters are
+ *meant* to be passed around as function arguments; this is why they exist.
+ Don't try to "save typing" or create "nicer APIs" by using this function in
+ the place where a request is required; this will only lead to sadness later.
+
+- Neither ``get_current_request`` nor ``get_current_registry`` should ever be
+ called within application-specific forks of third-party library code. The
+ library you've forked almost certainly has nothing to do with :app:`Pyramid`,
+ and making it dependent on :app:`Pyramid` (rather than making your
+ :app:`pyramid` application depend upon it) means you're forming a dependency
+ in the wrong direction.
+
+Use of the :func:`~pyramid.threadlocal.get_current_request` function in
+application code *is* still useful in very limited circumstances. As a rule of
+thumb, usage of ``get_current_request`` is useful **within code which is meant
+to eventually be removed**. For instance, you may find yourself wanting to
+deprecate some API that expects to be passed a request object in favor of one
+that does not expect to be passed a request object. But you need to keep
+implementations of the old API working for some period of time while you
+deprecate the older API. So you write a "facade" implementation of the new API
+which calls into the code which implements the older API. Since the new API
+does not require the request, your facade implementation doesn't have local
+access to the request when it needs to pass it into the older API
+implementation. After some period of time, the older implementation code is
+disused and the hack that uses ``get_current_request`` is removed. This would
+be an appropriate place to use the ``get_current_request``.
+
+Use of the :func:`~pyramid.threadlocal.get_current_registry` function should be
+limited to testing scenarios. The registry made current by use of the
+:meth:`pyramid.config.Configurator.begin` method during a test (or via
+:func:`pyramid.testing.setUp`) when you do not pass one in is available to you
+via this API.
diff --git a/docs/narr/traversal.rst b/docs/narr/traversal.rst
index 454bb5620..cd8395eac 100644
--- a/docs/narr/traversal.rst
+++ b/docs/narr/traversal.rst
@@ -3,32 +3,30 @@
Traversal
=========
-This chapter explains the technical details of how traversal works in
-Pyramid.
+This chapter explains the technical details of how traversal works in Pyramid.
For a quick example, see :doc:`hellotraversal`.
For more about *why* you might use traversal, see :doc:`muchadoabouttraversal`.
A :term:`traversal` uses the URL (Universal Resource Locator) to find a
-:term:`resource` located in a :term:`resource tree`, which is a set of
-nested dictionary-like objects. Traversal is done by using each segment
-of the path portion of the URL to navigate through the :term:`resource
-tree`. You might think of this as looking up files and directories in a
-file system. Traversal walks down the path until it finds a published
-resource, analogous to a file system "directory" or "file". The
-resource found as the result of a traversal becomes the
-:term:`context` of the :term:`request`. Then, the :term:`view lookup`
-subsystem is used to find some view code willing to "publish" this
+:term:`resource` located in a :term:`resource tree`, which is a set of nested
+dictionary-like objects. Traversal is done by using each segment of the path
+portion of the URL to navigate through the :term:`resource tree`. You might
+think of this as looking up files and directories in a file system. Traversal
+walks down the path until it finds a published resource, analogous to a file
+system "directory" or "file". The resource found as the result of a traversal
+becomes the :term:`context` of the :term:`request`. Then, the :term:`view
+lookup` subsystem is used to find some view code willing to "publish" this
resource by generating a :term:`response`.
.. note::
Using :term:`Traversal` to map a URL to code is optional. If you're creating
- your first Pyramid application it probably makes more sense to use :term:`URL
- dispatch` to map URLs to code instead of traversal, as new Pyramid developers
- tend to find URL dispatch slightly easier to understand. If you use URL
- dispatch, you needn't read this chapter.
+ your first Pyramid application, it probably makes more sense to use
+ :term:`URL dispatch` to map URLs to code instead of traversal, as new Pyramid
+ developers tend to find URL dispatch slightly easier to understand. If you
+ use URL dispatch, you needn't read this chapter.
.. index::
single: traversal details
@@ -36,33 +34,32 @@ resource by generating a :term:`response`.
Traversal Details
-----------------
-:term:`Traversal` is dependent on information in a :term:`request`
-object. Every :term:`request` object contains URL path information in
-the ``PATH_INFO`` portion of the :term:`WSGI` environment. The
-``PATH_INFO`` string is the portion of a request's URL following the
-hostname and port number, but before any query string elements or
-fragment element. For example the ``PATH_INFO`` portion of the URL
-``http://example.com:8080/a/b/c?foo=1`` is ``/a/b/c``.
+:term:`Traversal` is dependent on information in a :term:`request` object.
+Every :term:`request` object contains URL path information in the ``PATH_INFO``
+portion of the :term:`WSGI` environment. The ``PATH_INFO`` string is the
+portion of a request's URL following the hostname and port number, but before
+any query string elements or fragment element. For example the ``PATH_INFO``
+portion of the URL ``http://example.com:8080/a/b/c?foo=1`` is ``/a/b/c``.
-Traversal treats the ``PATH_INFO`` segment of a URL as a sequence of
-path segments. For example, the ``PATH_INFO`` string ``/a/b/c`` is
-converted to the sequence ``['a', 'b', 'c']``.
+Traversal treats the ``PATH_INFO`` segment of a URL as a sequence of path
+segments. For example, the ``PATH_INFO`` string ``/a/b/c`` is converted to the
+sequence ``['a', 'b', 'c']``.
-This path sequence is then used to descend through the :term:`resource
-tree`, looking up a resource for each path segment. Each lookup uses the
+This path sequence is then used to descend through the :term:`resource tree`,
+looking up a resource for each path segment. Each lookup uses the
``__getitem__`` method of a resource in the tree.
For example, if the path info sequence is ``['a', 'b', 'c']``:
- :term:`Traversal` starts by acquiring the :term:`root` resource of the
- application by calling the :term:`root factory`. The :term:`root factory`
- can be configured to return whatever object is appropriate as the
- traversal root of your application.
+ application by calling the :term:`root factory`. The :term:`root factory` can
+ be configured to return whatever object is appropriate as the traversal root
+ of your application.
-- Next, the first element (``'a'``) is popped from the path segment
- sequence and is used as a key to lookup the corresponding resource
- in the root. This invokes the root resource's ``__getitem__`` method
- using that value (``'a'``) as an argument.
+- Next, the first element (``'a'``) is popped from the path segment sequence
+ and is used as a key to lookup the corresponding resource in the root. This
+ invokes the root resource's ``__getitem__`` method using that value (``'a'``)
+ as an argument.
- If the root resource "contains" a resource with key ``'a'``, its
``__getitem__`` method will return it. The :term:`context` temporarily
@@ -72,29 +69,26 @@ For example, if the path info sequence is ``['a', 'b', 'c']``:
resource's ``__getitem__`` is called with that value (``'b'``) as an
argument; we'll presume it succeeds.
-- The "A" resource's ``__getitem__`` returns another resource, which
- we'll call "B". The :term:`context` temporarily becomes the "B"
- resource.
+- The "A" resource's ``__getitem__`` returns another resource, which we'll call
+ "B". The :term:`context` temporarily becomes the "B" resource.
-Traversal continues until the path segment sequence is exhausted or a
-path element cannot be resolved to a resource. In either case, the
-:term:`context` resource is the last object that the traversal
-successfully resolved. If any resource found during traversal lacks a
-``__getitem__`` method, or if its ``__getitem__`` method raises a
-:exc:`KeyError`, traversal ends immediately, and that resource becomes
-the :term:`context`.
+Traversal continues until the path segment sequence is exhausted or a path
+element cannot be resolved to a resource. In either case, the :term:`context`
+resource is the last object that the traversal successfully resolved. If any
+resource found during traversal lacks a ``__getitem__`` method, or if its
+``__getitem__`` method raises a :exc:`KeyError`, traversal ends immediately,
+and that resource becomes the :term:`context`.
The results of a :term:`traversal` also include a :term:`view name`. If
-traversal ends before the path segment sequence is exhausted, the
-:term:`view name` is the *next* remaining path segment element. If the
-:term:`traversal` expends all of the path segments, then the :term:`view
-name` is the empty string (``''``).
+traversal ends before the path segment sequence is exhausted, the :term:`view
+name` is the *next* remaining path segment element. If the :term:`traversal`
+expends all of the path segments, then the :term:`view name` is the empty
+string (``''``).
-The combination of the context resource and the :term:`view name` found
-via traversal is used later in the same request by the :term:`view
-lookup` subsystem to find a :term:`view callable`. How :app:`Pyramid`
-performs view lookup is explained within the :ref:`view_config_chapter`
-chapter.
+The combination of the context resource and the :term:`view name` found via
+traversal is used later in the same request by the :term:`view lookup`
+subsystem to find a :term:`view callable`. How :app:`Pyramid` performs view
+lookup is explained within the :ref:`view_config_chapter` chapter.
.. index::
single: object tree
@@ -106,20 +100,20 @@ chapter.
The Resource Tree
-----------------
-The resource tree is a set of nested dictionary-like resource objects
-that begins with a :term:`root` resource. In order to use
-:term:`traversal` to resolve URLs to code, your application must supply
-a :term:`resource tree` to :app:`Pyramid`.
+The resource tree is a set of nested dictionary-like resource objects that
+begins with a :term:`root` resource. In order to use :term:`traversal` to
+resolve URLs to code, your application must supply a :term:`resource tree` to
+:app:`Pyramid`.
In order to supply a root resource for an application the :app:`Pyramid`
-:term:`Router` is configured with a callback known as a :term:`root
-factory`. The root factory is supplied by the application, at startup
-time, as the ``root_factory`` argument to the :term:`Configurator`.
+:term:`Router` is configured with a callback known as a :term:`root factory`.
+The root factory is supplied by the application at startup time as the
+``root_factory`` argument to the :term:`Configurator`.
-The root factory is a Python callable that accepts a :term:`request`
-object, and returns the root object of the :term:`resource tree`. A
-function, or class is typically used as an application's root factory.
-Here's an example of a simple root factory class:
+The root factory is a Python callable that accepts a :term:`request` object,
+and returns the root object of the :term:`resource tree`. A function or class
+is typically used as an application's root factory. Here's an example of a
+simple root factory class:
.. code-block:: python
:linenos:
@@ -136,62 +130,60 @@ passing it to an instance of a :term:`Configurator` named ``config``:
config = Configurator(root_factory=Root)
-The ``root_factory`` argument to the
-:class:`~pyramid.config.Configurator` constructor registers this root
-factory to be called to generate a root resource whenever a request
-enters the application. The root factory registered this way is also
-known as the global root factory. A root factory can alternately be
-passed to the ``Configurator`` as a :term:`dotted Python name` which can
-refer to a root factory defined in a different module.
+The ``root_factory`` argument to the :class:`~pyramid.config.Configurator`
+constructor registers this root factory to be called to generate a root
+resource whenever a request enters the application. The root factory
+registered this way is also known as the global root factory. A root factory
+can alternatively be passed to the ``Configurator`` as a :term:`dotted Python
+name` which can refer to a root factory defined in a different module.
-If no :term:`root factory` is passed to the :app:`Pyramid`
-:term:`Configurator` constructor, or if the ``root_factory`` value
-specified is ``None``, a :term:`default root factory` is used. The default
-root factory always returns a resource that has no child resources; it
-is effectively empty.
+If no :term:`root factory` is passed to the :app:`Pyramid` :term:`Configurator`
+constructor, or if the ``root_factory`` value specified is ``None``, a
+:term:`default root factory` is used. The default root factory always returns
+a resource that has no child resources; it is effectively empty.
Usually a root factory for a traversal-based application will be more
-complicated than the above ``Root`` class; in particular it may be associated
+complicated than the above ``Root`` class. In particular it may be associated
with a database connection or another persistence mechanism. The above
``Root`` class is analogous to the default root factory present in Pyramid. The
default root factory is very simple and not very useful.
.. note::
- If the items contained within the resource tree are "persistent" (they
- have state that lasts longer than the execution of a single process), they
- become analogous to the concept of :term:`domain model` objects used by
- many other frameworks.
+ If the items contained within the resource tree are "persistent" (they have
+ state that lasts longer than the execution of a single process), they become
+ analogous to the concept of :term:`domain model` objects used by many other
+ frameworks.
-The resource tree consists of *container* resources and *leaf* resources.
-There is only one difference between a *container* resource and a *leaf*
-resource: *container* resources possess a ``__getitem__`` method (making it
+The resource tree consists of *container* resources and *leaf* resources. There
+is only one difference between a *container* resource and a *leaf* resource:
+*container* resources possess a ``__getitem__`` method (making it
"dictionary-like") while *leaf* resources do not. The ``__getitem__`` method
was chosen as the signifying difference between the two types of resources
because the presence of this method is how Python itself typically determines
whether an object is "containerish" or not (dictionary objects are
"containerish").
-Each container resource is presumed to be willing to return a child resource
-or raise a ``KeyError`` based on a name passed to its ``__getitem__``.
+Each container resource is presumed to be willing to return a child resource or
+raise a ``KeyError`` based on a name passed to its ``__getitem__``.
-Leaf-level instances must not have a ``__getitem__``. If instances that
-you'd like to be leaves already happen to have a ``__getitem__`` through some
+Leaf-level instances must not have a ``__getitem__``. If instances that you'd
+like to be leaves already happen to have a ``__getitem__`` through some
historical inequity, you should subclass these resource types and cause their
``__getitem__`` methods to simply raise a ``KeyError``. Or just disuse them
and think up another strategy.
-Usually, the traversal root is a *container* resource, and as such it
-contains other resources. However, it doesn't *need* to be a container.
-Your resource tree can be as shallow or as deep as you require.
+Usually the traversal root is a *container* resource, and as such it contains
+other resources. However, it doesn't *need* to be a container. Your resource
+tree can be as shallow or as deep as you require.
-In general, the resource tree is traversed beginning at its root resource
-using a sequence of path elements described by the ``PATH_INFO`` of the
-current request; if there are path segments, the root resource's
-``__getitem__`` is called with the next path segment, and it is expected to
-return another resource. The resulting resource's ``__getitem__`` is called
-with the very next path segment, and it is expected to return another
-resource. This happens *ad infinitum* until all path segments are exhausted.
+In general, the resource tree is traversed beginning at its root resource using
+a sequence of path elements described by the ``PATH_INFO`` of the current
+request. If there are path segments, the root resource's ``__getitem__`` is
+called with the next path segment, and it is expected to return another
+resource. The resulting resource's ``__getitem__`` is called with the very
+next path segment, and it is expected to return another resource. This happens
+*ad infinitum* until all path segments are exhausted.
.. index::
single: traversal algorithm
@@ -204,17 +196,17 @@ The Traversal Algorithm
This section will attempt to explain the :app:`Pyramid` traversal algorithm.
We'll provide a description of the algorithm, a diagram of how the algorithm
-works, and some example traversal scenarios that might help you understand
-how the algorithm operates against a specific resource tree.
+works, and some example traversal scenarios that might help you understand how
+the algorithm operates against a specific resource tree.
We'll also talk a bit about :term:`view lookup`. The
-:ref:`view_config_chapter` chapter discusses :term:`view lookup` in
-detail, and it is the canonical source for information about views.
-Technically, :term:`view lookup` is a :app:`Pyramid` subsystem that is
-separated from traversal entirely. However, we'll describe the
-fundamental behavior of view lookup in the examples in the next few
-sections to give you an idea of how traversal and view lookup cooperate,
-because they are almost always used together.
+:ref:`view_config_chapter` chapter discusses :term:`view lookup` in detail, and
+it is the canonical source for information about views. Technically,
+:term:`view lookup` is a :app:`Pyramid` subsystem that is separated from
+traversal entirely. However, we'll describe the fundamental behavior of view
+lookup in the examples in the next few sections to give you an idea of how
+traversal and view lookup cooperate, because they are almost always used
+together.
.. index::
single: view name
@@ -223,26 +215,24 @@ because they are almost always used together.
single: root factory
single: default view
-A Description of The Traversal Algorithm
+A Description of the Traversal Algorithm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When a user requests a page from your traversal-powered application, the
-system uses this algorithm to find a :term:`context` resource and a
-:term:`view name`.
+When a user requests a page from your traversal-powered application, the system
+uses this algorithm to find a :term:`context` resource and a :term:`view name`.
-#. The request for the page is presented to the :app:`Pyramid`
- :term:`router` in terms of a standard :term:`WSGI` request, which is
- represented by a WSGI environment and a WSGI ``start_response`` callable.
+#. The request for the page is presented to the :app:`Pyramid` :term:`router`
+ in terms of a standard :term:`WSGI` request, which is represented by a WSGI
+ environment and a WSGI ``start_response`` callable.
-#. The router creates a :term:`request` object based on the WSGI
- environment.
+#. The router creates a :term:`request` object based on the WSGI environment.
-#. The :term:`root factory` is called with the :term:`request`. It returns
- a :term:`root` resource.
+#. The :term:`root factory` is called with the :term:`request`. It returns a
+ :term:`root` resource.
#. The router uses the WSGI environment's ``PATH_INFO`` information to
- determine the path segments to traverse. The leading slash is stripped
- off ``PATH_INFO``, and the remaining path segments are split on the slash
+ determine the path segments to traverse. The leading slash is stripped off
+ ``PATH_INFO``, and the remaining path segments are split on the slash
character to form a traversal sequence.
The traversal algorithm by default attempts to first URL-unquote and then
@@ -252,26 +242,26 @@ system uses this algorithm to find a :term:`context` resource and a
Conversion from a URL-decoded string into Unicode is attempted using the
UTF-8 encoding. If any URL-unquoted path segment in ``PATH_INFO`` is not
decodeable using the UTF-8 decoding, a :exc:`TypeError` is raised. A
- segment will be fully URL-unquoted and UTF8-decoded before it is passed
- in to the ``__getitem__`` of any resource during traversal.
+ segment will be fully URL-unquoted and UTF8-decoded before it is passed in
+ to the ``__getitem__`` of any resource during traversal.
- Thus, a request with a ``PATH_INFO`` variable of ``/a/b/c`` maps to the
+ Thus a request with a ``PATH_INFO`` variable of ``/a/b/c`` maps to the
traversal sequence ``[u'a', u'b', u'c']``.
-#. :term:`Traversal` begins at the root resource returned by the root
- factory. For the traversal sequence ``[u'a', u'b', u'c']``, the root
- resource's ``__getitem__`` is called with the name ``'a'``. Traversal
- continues through the sequence. In our example, if the root resource's
- ``__getitem__`` called with the name ``a`` returns a resource (aka
+#. :term:`Traversal` begins at the root resource returned by the root factory.
+ For the traversal sequence ``[u'a', u'b', u'c']``, the root resource's
+ ``__getitem__`` is called with the name ``'a'``. Traversal continues
+ through the sequence. In our example, if the root resource's
+ ``__getitem__`` called with the name ``a`` returns a resource (a.k.a.
resource "A"), that resource's ``__getitem__`` is called with the name
``'b'``. If resource "A" returns a resource "B" when asked for ``'b'``,
resource B's ``__getitem__`` is then asked for the name ``'c'``, and may
return resource "C".
-#. Traversal ends when a) the entire path is exhausted or b) when any
- resource raises a :exc:`KeyError` from its ``__getitem__`` or c) when any
+#. Traversal ends when either (a) the entire path is exhausted, (b) when any
+ resource raises a :exc:`KeyError` from its ``__getitem__``, (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
+ (resulting in an :exc:`AttributeError`), or (d) when any path element is
prefixed with the set of characters ``@@`` (indicating that the characters
following the ``@@`` token should be treated as a :term:`view name`).
@@ -279,13 +269,13 @@ system uses this algorithm to find a :term:`context` resource and a
resource found during traversal is deemed to be the :term:`context`. If
the path has been exhausted when traversal ends, the :term:`view name` is
deemed to be the empty string (``''``). However, if the path was *not*
- exhausted before traversal terminated, the first remaining path segment
- is treated as the view name.
+ exhausted before traversal terminated, the first remaining path segment is
+ treated as the view name.
#. Any subsequent path elements after the :term:`view name` is found are
deemed the :term:`subpath`. The subpath is always a sequence of path
- segments that come from ``PATH_INFO`` that are "left over" after
- traversal has completed.
+ segments that come from ``PATH_INFO`` that are "left over" after traversal
+ has completed.
Once the :term:`context` resource, the :term:`view name`, and associated
attributes such as the :term:`subpath` are located, the job of
@@ -297,20 +287,19 @@ The traversal algorithm exposes two special cases:
- You will often end up with a :term:`view name` that is the empty string as
the result of a particular traversal. This indicates that the view lookup
- machinery should look up the :term:`default view`. The default view is a
- view that is registered with no name or a view which is registered with a
- name that equals the empty string.
+ machinery should lookup the :term:`default view`. The default view is a view
+ that is registered with no name or a view which is registered with a name
+ that equals the empty string.
-- If any path segment element begins with the special characters ``@@``
- (think of them as goggles), the value of that segment minus the goggle
- characters is considered the :term:`view name` immediately and traversal
- stops there. This allows you to address views that may have the same names
- as resource names in the tree unambiguously.
+- If any path segment element begins with the special characters ``@@`` (think
+ of them as goggles), the value of that segment minus the goggle characters is
+ considered the :term:`view name` immediately and traversal stops there. This
+ allows you to address views that may have the same names as resource names in
+ the tree unambiguously.
Finally, traversal is responsible for locating a :term:`virtual root`. A
-virtual root is used during "virtual hosting"; see the
-:ref:`vhosting_chapter` chapter for information. We won't speak more about
-it in this chapter.
+virtual root is used during "virtual hosting". See the :ref:`vhosting_chapter`
+chapter for information. We won't speak more about it in this chapter.
.. image:: resourcetreetraverser.png
@@ -321,13 +310,13 @@ Traversal Algorithm Examples
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No one can be expected to understand the traversal algorithm by analogy and
-description alone, so let's examine some traversal scenarios that use
-concrete URLs and resource tree compositions.
+description alone, so let's examine some traversal scenarios that use concrete
+URLs and resource tree compositions.
-Let's pretend the user asks for
-``http://example.com/foo/bar/baz/biz/buz.txt``. The request's ``PATH_INFO``
-in that case is ``/foo/bar/baz/biz/buz.txt``. Let's further pretend that
-when this request comes in that we're traversing the following resource tree:
+Let's pretend the user asks for ``http://example.com/foo/bar/baz/biz/buz.txt``.
+The request's ``PATH_INFO`` in that case is ``/foo/bar/baz/biz/buz.txt``.
+Let's further pretend that when this request comes in, we're traversing the
+following resource tree:
.. code-block:: text
@@ -346,33 +335,32 @@ Here's what happens:
finds.
- :term:`traversal` traverses "bar", and attempts to find "baz", which it does
- not find (the "bar" resource raises a :exc:`KeyError` when asked for
- "baz").
+ not find (the "bar" resource raises a :exc:`KeyError` when asked for "baz").
The fact that it does not find "baz" at this point does not signify an error
-condition. It signifies that:
+condition. It signifies the following:
-- the :term:`context` is the "bar" resource (the context is the last resource
+- The :term:`context` is the "bar" resource (the context is the last resource
found during traversal).
-- the :term:`view name` is ``baz``
+- The :term:`view name` is ``baz``.
-- the :term:`subpath` is ``('biz', 'buz.txt')``
+- The :term:`subpath` is ``('biz', 'buz.txt')``.
At this point, traversal has ended, and :term:`view lookup` begins.
Because it's the "context" resource, the view lookup machinery examines "bar"
-to find out what "type" it is. Let's say it finds that the context is a
-``Bar`` type (because "bar" happens to be an instance of the class ``Bar``).
-Using the :term:`view name` (``baz``) and the type, view lookup asks the
+to find out what "type" it is. Let's say it finds that the context is a ``Bar``
+type (because "bar" happens to be an instance of the class ``Bar``). Using the
+:term:`view name` (``baz``) and the type, view lookup asks the
:term:`application registry` this question:
- Please find me a :term:`view callable` registered using a :term:`view
configuration` with the name "baz" that can be used for the class ``Bar``.
-Let's say that view lookup finds no matching view type. In this
-circumstance, the :app:`Pyramid` :term:`router` returns the result of the
-:term:`Not Found View` and the request ends.
+Let's say that view lookup finds no matching view type. In this circumstance,
+the :app:`Pyramid` :term:`router` returns the result of the :term:`Not Found
+View` and the request ends.
However, for this tree:
@@ -399,59 +387,58 @@ The user asks for ``http://example.com/foo/bar/baz/biz/buz.txt``
- :term:`traversal` traverses "baz", and attempts to find "biz", which it
finds.
-- :term:`traversal` traverses "biz", and attempts to find "buz.txt" which it
+- :term:`traversal` traverses "biz", and attempts to find "buz.txt", which it
does not find.
The fact that it does not find a resource related to "buz.txt" at this point
-does not signify an error condition. It signifies that:
+does not signify an error condition. It signifies the following:
-- the :term:`context` is the "biz" resource (the context is the last resource
+- The :term:`context` is the "biz" resource (the context is the last resource
found during traversal).
-- the :term:`view name` is "buz.txt"
+- The :term:`view name` is "buz.txt".
-- the :term:`subpath` is an empty sequence ( ``()`` ).
+- The :term:`subpath` is an empty sequence ( ``()`` ).
At this point, traversal has ended, and :term:`view lookup` begins.
Because it's the "context" resource, the view lookup machinery examines the
"biz" resource to find out what "type" it is. Let's say it finds that the
resource is a ``Biz`` type (because "biz" is an instance of the Python class
-``Biz``). Using the :term:`view name` (``buz.txt``) and the type, view
-lookup asks the :term:`application registry` this question:
+``Biz``). Using the :term:`view name` (``buz.txt``) and the type, view lookup
+asks the :term:`application registry` this question:
- Please find me a :term:`view callable` registered with a :term:`view
- configuration` with the name ``buz.txt`` that can be used for class
- ``Biz``.
+ configuration` with the name ``buz.txt`` that can be used for class ``Biz``.
-Let's say that question is answered by the application registry; in such a
-situation, the application registry returns a :term:`view callable`. The
-view callable is then called with the current :term:`WebOb` :term:`request`
-as the sole argument: ``request``; it is expected to return a response.
+Let's say that question is answered by the application registry. In such a
+situation, the application registry returns a :term:`view callable`. The view
+callable is then called with the current :term:`WebOb` :term:`request` as the
+sole argument, ``request``. It is expected to return a response.
-.. sidebar:: The Example View Callables Accept Only a Request; How Do I Access the Context Resource?
+.. sidebar:: The Example View Callables Accept Only a Request; How Do I Access
+ the Context Resource?
- Most of the examples in this book assume that a view callable is typically
- passed only a :term:`request` object. Sometimes your view callables need
- access to the :term:`context` resource, especially when you use
- :term:`traversal`. You might use a supported alternate view callable
+ Most of the examples in this documentation assume that a view callable is
+ typically passed only a :term:`request` object. Sometimes your view
+ callables need access to the :term:`context` resource, especially when you
+ use :term:`traversal`. You might use a supported alternative view callable
argument list in your view callables such as the ``(context, request)``
- calling convention described in
- :ref:`request_and_context_view_definitions`. But you don't need to if you
- don't want to. In view callables that accept only a request, the
- :term:`context` resource found by traversal is available as the
- ``context`` attribute of the request object, e.g. ``request.context``.
- The :term:`view name` is available as the ``view_name`` attribute of the
- request object, e.g. ``request.view_name``. Other :app:`Pyramid`
- -specific request attributes are also available as described in
- :ref:`special_request_attributes`.
+ calling convention described in :ref:`request_and_context_view_definitions`.
+ But you don't need to if you don't want to. In view callables that accept
+ only a request, the :term:`context` resource found by traversal is available
+ as the ``context`` attribute of the request object, e.g.,
+ ``request.context``. The :term:`view name` is available as the ``view_name``
+ attribute of the request object, e.g., ``request.view_name``. Other
+ :app:`Pyramid`-specific request attributes are also available as described
+ in :ref:`special_request_attributes`.
.. index::
single: resource interfaces
.. _using_resource_interfaces:
-Using Resource Interfaces In View Configuration
+Using Resource Interfaces in View Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Instead of registering your views with a ``context`` that names a Python
@@ -460,18 +447,17 @@ resource *class*, you can optionally register a view callable with a
arbitrarily to any resource object. View lookup treats context interfaces
specially, and therefore the identity of a resource can be divorced from that
of the class which implements it. As a result, associating a view with an
-interface can provide more flexibility for sharing a single view between two
-or more different implementations of a resource type. For example, if two
-resource objects of different Python class types share the same interface,
-you can use the same view configuration to specify both of them as a
-``context``.
+interface can provide more flexibility for sharing a single view between two or
+more different implementations of a resource type. For example, if two
+resource objects of different Python class types share the same interface, you
+can use the same view configuration to specify both of them as a ``context``.
In order to make use of interfaces in your application during view dispatch,
you must create an interface and mark up your resource classes or instances
with interface declarations that refer to this interface.
-To attach an interface to a resource *class*, you define the interface and
-use the :func:`zope.interface.implementer` class decorator to associate the
+To attach an interface to a resource *class*, you define the interface and use
+the :func:`zope.interface.implementer` class decorator to associate the
interface with the class.
.. code-block:: python
@@ -488,9 +474,9 @@ interface with the class.
pass
To attach an interface to a resource *instance*, you define the interface and
-use the :func:`zope.interface.alsoProvides` function to associate the
-interface with the instance. This function mutates the instance in such a
-way that the interface is attached to it.
+use the :func:`zope.interface.alsoProvides` function to associate the interface
+with the instance. This function mutates the instance in such a way that the
+interface is attached to it.
.. code-block:: python
:linenos:
@@ -509,13 +495,13 @@ way that the interface is attached to it.
alsoProvides(hello, IHello)
return hello
-Regardless of how you associate an interface, with a resource instance, or a
-resource class, the resulting code to associate that interface with a view
+Regardless of how you associate an interface—with either a resource instance
+or a resource class—the resulting code to associate that interface with a view
callable is the same. Assuming the above code that defines an ``IHello``
interface lives in the root of your application, and its module is named
"resources.py", the interface declaration below will associate the
-``mypackage.views.hello_world`` view with resources that implement, or
-provide, this interface.
+``mypackage.views.hello_world`` view with resources that implement, or provide,
+this interface.
.. code-block:: python
:linenos:
@@ -525,20 +511,18 @@ provide, this interface.
config.add_view('mypackage.views.hello_world', name='hello.html',
context='mypackage.resources.IHello')
-Any time a resource that is determined to be the :term:`context` provides
-this interface, and a view named ``hello.html`` is looked up against it as
-per the URL, the ``mypackage.views.hello_world`` view callable will be
-invoked.
-
-Note, in cases where a view is registered against a resource class, and a
-view is also registered against an interface that the resource class
-implements, an ambiguity arises. Views registered for the resource class take
-precedence over any views registered for any interface the resource class
-implements. Thus, if one view configuration names a ``context`` of both the
-class type of a resource, and another view configuration names a ``context``
-of interface implemented by the resource's class, and both view
-configurations are otherwise identical, the view registered for the context's
-class will "win".
+Any time a resource that is determined to be the :term:`context` provides this
+interface, and a view named ``hello.html`` is looked up against it as per the
+URL, the ``mypackage.views.hello_world`` view callable will be invoked.
+
+Note, in cases where a view is registered against a resource class, and a view
+is also registered against an interface that the resource class implements, an
+ambiguity arises. Views registered for the resource class take precedence over
+any views registered for any interface the resource class implements. Thus, if
+one view configuration names a ``context`` of both the class type of a
+resource, and another view configuration names a ``context`` of interface
+implemented by the resource's class, and both view configurations are otherwise
+identical, the view registered for the context's class will "win".
For more information about defining resources with interfaces for use within
view configuration, see :ref:`resources_which_implement_interfaces`.
@@ -558,4 +542,3 @@ traversal, such as traversal invocation from within application code.
The :meth:`pyramid.request.Request.resource_url` method generates a URL when
given a resource retrieved from a resource tree.
-
diff --git a/docs/narr/upgrading.rst b/docs/narr/upgrading.rst
index eb3194a65..cacfba92a 100644
--- a/docs/narr/upgrading.rst
+++ b/docs/narr/upgrading.rst
@@ -12,26 +12,26 @@ applications keep working when you upgrade the Pyramid version you're using.
.. sidebar:: About Release Numbering
Conventionally, application version numbering in Python is described as
- ``major.minor.micro``. If your Pyramid version is "1.2.3", it means
- you're running a version of Pyramid with the major version "1", the minor
- version "2" and the micro version "3". A "major" release is one that
- increments the first-dot number; 2.X.X might follow 1.X.X. A "minor"
- release is one that increments the second-dot number; 1.3.X might follow
- 1.2.X. A "micro" release is one that increments the third-dot number;
- 1.2.3 might follow 1.2.2. In general, micro releases are "bugfix-only",
- and contain no new features, minor releases contain new features but are
- largely backwards compatible with older versions, and a major release
- indicates a large set of backwards incompatibilities.
+ ``major.minor.micro``. If your Pyramid version is "1.2.3", it means you're
+ running a version of Pyramid with the major version "1", the minor version
+ "2" and the micro version "3". A "major" release is one that increments the
+ first-dot number; 2.X.X might follow 1.X.X. A "minor" release is one that
+ increments the second-dot number; 1.3.X might follow 1.2.X. A "micro"
+ release is one that increments the third-dot number; 1.2.3 might follow
+ 1.2.2. In general, micro releases are "bugfix-only", and contain no new
+ features, minor releases contain new features but are largely backwards
+ compatible with older versions, and a major release indicates a large set of
+ backwards incompatibilities.
The Pyramid core team is conservative when it comes to removing features. We
-don't remove features unnecessarily, but we're human, and we make mistakes
-which cause some features to be evolutionary dead ends. Though we are
-willing to support dead-end features for some amount of time, some eventually
-have to be removed when the cost of supporting them outweighs the benefit of
-keeping them around, because each feature in Pyramid represents a certain
-documentation and maintenance burden.
-
-Deprecation and Removal Policy
+don't remove features unnecessarily, but we're human and we make mistakes which
+cause some features to be evolutionary dead ends. Though we are willing to
+support dead-end features for some amount of time, some eventually have to be
+removed when the cost of supporting them outweighs the benefit of keeping them
+around, because each feature in Pyramid represents a certain documentation and
+maintenance burden.
+
+Deprecation and removal policy
------------------------------
When a feature is scheduled for removal from Pyramid or any of its official
@@ -51,50 +51,70 @@ When a deprecated feature is eventually removed:
- A note is added to the :ref:`changelog` about the removal.
-Features are never removed in *micro* releases. They are only removed in
-minor and major releases. Deprecated features are kept around for at least
-*three* minor releases from the time the feature became deprecated.
-Therefore, if a feature is added in Pyramid 1.0, but it's deprecated in
-Pyramid 1.1, it will be kept around through all 1.1.X releases, all 1.2.X
-releases and all 1.3.X releases. It will finally be removed in the first
-1.4.X release.
-
-Sometimes features are "docs-deprecated" instead of formally deprecated.
-This means that the feature will be kept around indefinitely, but it will be
-removed from the documentation or a note will be added to the documentation
-telling folks to use some other newer feature. This happens when the cost of
-keeping an old feature around is very minimal and the support and
-documentation burden is very low. For example, we might rename a function
-that is an API without changing the arguments it accepts. In this case,
-we'll often rename the function, and change the docs to point at the new
-function name, but leave around a backwards compatibility alias to the old
-function name so older code doesn't break.
+Features are never removed in *micro* releases. They are only removed in minor
+and major releases. Deprecated features are kept around for at least *three*
+minor releases from the time the feature became deprecated. Therefore, if a
+feature is added in Pyramid 1.0, but it's deprecated in Pyramid 1.1, it will be
+kept around through all 1.1.X releases, all 1.2.X releases and all 1.3.X
+releases. It will finally be removed in the first 1.4.X release.
+
+Sometimes features are "docs-deprecated" instead of formally deprecated. This
+means that the feature will be kept around indefinitely, but it will be removed
+from the documentation or a note will be added to the documentation telling
+folks to use some other newer feature. This happens when the cost of keeping
+an old feature around is very minimal and the support and documentation burden
+is very low. For example, we might rename a function that is an API without
+changing the arguments it accepts. In this case, we'll often rename the
+function, and change the docs to point at the new function name, but leave
+around a backwards compatibility alias to the old function name so older code
+doesn't break.
"Docs deprecated" features tend to work "forever", meaning that they won't be
removed, and they'll never generate a deprecation warning. However, such
changes are noted in the :ref:`changelog`, so it's possible to know that you
-should change older spellings to newer ones to ensure that people reading
-your code can find the APIs you're using in the Pyramid docs.
+should change older spellings to newer ones to ensure that people reading your
+code can find the APIs you're using in the Pyramid docs.
-Consulting the Change History
+
+Python support policy
+~~~~~~~~~~~~~~~~~~~~~
+
+At the time of a Pyramid version release, each supports all versions of Python
+through the end of their lifespans. The end-of-life for a given version of
+Python is when security updates are no longer released.
+
+- `Python 3.2 Lifespan <https://www.python.org/dev/peps/pep-0392/#lifespan>`_
+ ends February 2016.
+- `Python 3.3 Lifespan <https://www.python.org/dev/peps/pep-0392/#lifespan>`_
+ ends September 2017.
+- `Python 3.4 Lifespan <https://www.python.org/dev/peps/pep-0429/>`_ TBD.
+- `Python 3.5 Lifespan <https://www.python.org/dev/peps/pep-0478/>`_ TBD.
+- `Python 3.6 Lifespan <https://www.python.org/dev/peps/pep-0494/#id4>`_
+ December 2021.
+
+To determine the Python support for a specific release of Pyramid, view its
+``tox.ini`` file at the root of the repository's version.
+
+
+Consulting the change history
-----------------------------
-Your first line of defense against application failures caused by upgrading
-to a newer Pyramid release is always to read the :ref:`changelog`. to find
-the deprecations and removals for each release between the release you're
-currently running and the one you wish to upgrade to. The change history
-notes every deprecation within a ``Deprecation`` section and every removal
-within a ``Backwards Incompatibilies`` section for each release.
+Your first line of defense against application failures caused by upgrading to
+a newer Pyramid release is always to read the :ref:`changelog` to find the
+deprecations and removals for each release between the release you're currently
+running and the one to which you wish to upgrade. The change history notes
+every deprecation within a ``Deprecation`` section and every removal within a
+``Backwards Incompatibilies`` section for each release.
-The change history often contains instructions for changing your code to
-avoid deprecation warnings and how to change docs-deprecated spellings to
-newer ones. You can follow along with each deprecation explanation in the
-change history, simply doing a grep or other code search to your application,
-using the change log examples to remediate each potential problem.
+The change history often contains instructions for changing your code to avoid
+deprecation warnings and how to change docs-deprecated spellings to newer ones.
+You can follow along with each deprecation explanation in the change history,
+simply doing a grep or other code search to your application, using the change
+log examples to remediate each potential problem.
.. _testing_under_new_release:
-Testing Your Application Under a New Pyramid Release
+Testing your application under a new Pyramid release
----------------------------------------------------
Once you've upgraded your application to a new Pyramid release and you've
@@ -106,25 +126,24 @@ you can see DeprecationWarnings printed to the console when the tests run.
$ python -Wd setup.py test -q
-The ``-Wd`` argument is an argument that tells Python to print deprecation
-warnings to the console. Note that the ``-Wd`` flag is only required for
-Python 2.7 and better: Python versions 2.6 and older print deprecation
-warnings to the console by default. See `the Python -W flag documentation
-<http://docs.python.org/using/cmdline.html#cmdoption-W>`_ for more
-information.
+The ``-Wd`` argument tells Python to print deprecation warnings to the console.
+Note that the ``-Wd`` flag is only required for Python 2.7 and better: Python
+versions 2.6 and older print deprecation warnings to the console by default.
+See `the Python -W flag documentation
+<http://docs.python.org/using/cmdline.html#cmdoption-W>`_ for more information.
As your tests run, deprecation warnings will be printed to the console
-explaining the deprecation and providing instructions about how to prevent
-the deprecation warning from being issued. For example:
+explaining the deprecation and providing instructions about how to prevent the
+deprecation warning from being issued. For example:
-.. code-block:: text
+.. code-block:: bash
$ python -Wd setup.py test -q
# .. elided ...
running build_ext
- /home/chrism/projects/pyramid/env27/myproj/myproj/views.py:3:
- DeprecationWarning: static: The "pyramid.view.static" class is deprecated
- as of Pyramid 1.1; use the "pyramid.static.static_view" class instead with
+ /home/chrism/projects/pyramid/env27/myproj/myproj/views.py:3:
+ DeprecationWarning: static: The "pyramid.view.static" class is deprecated
+ as of Pyramid 1.1; use the "pyramid.static.static_view" class instead with
the "use_subpath" argument set to True.
from pyramid.view import static
.
@@ -144,8 +163,8 @@ pyramid.view import static``) that is causing the problem:
from pyramid.view import static
myview = static('static', 'static')
-The deprecation warning tells me how to fix it, so I can change the code to
-do things the newer way:
+The deprecation warning tells me how to fix it, so I can change the code to do
+things the newer way:
.. code-block:: python
:linenos:
@@ -155,10 +174,10 @@ do things the newer way:
from pyramid.static import static_view
myview = static_view('static', 'static', use_subpath=True)
-When I run the tests again, the deprecation warning is no longer printed to
-my console:
+When I run the tests again, the deprecation warning is no longer printed to my
+console:
-.. code-block:: text
+.. code-block:: bash
$ python -Wd setup.py test -q
# .. elided ...
@@ -170,7 +189,7 @@ my console:
OK
-My Application Doesn't Have Any Tests or Has Few Tests
+My application doesn't have any tests or has few tests
------------------------------------------------------
If your application has no tests, or has only moderate test coverage, running
@@ -178,8 +197,8 @@ tests won't tell you very much, because the Pyramid codepaths that generate
deprecation warnings won't be executed.
In this circumstance, you can start your application interactively under a
-server run with the ``PYTHONWARNINGS`` environment variable set to
-``default``. On UNIX, you can do that via:
+server run with the ``PYTHONWARNINGS`` environment variable set to ``default``.
+On UNIX, you can do that via:
.. code-block:: bash
@@ -194,16 +213,15 @@ On Windows, you need to issue two commands:
At this point, it's ensured that deprecation warnings will be printed to the
console whenever a codepath is hit that generates one. You can then click
-around in your application interactively to try to generate them, and
-remediate as explained in :ref:`testing_under_new_release`.
+around in your application interactively to try to generate them, and remediate
+as explained in :ref:`testing_under_new_release`.
See `the PYTHONWARNINGS environment variable documentation
<http://docs.python.org/using/cmdline.html#envvar-PYTHONWARNINGS>`_ or `the
Python -W flag documentation
-<http://docs.python.org/using/cmdline.html#cmdoption-W>`_ for more
-information.
+<http://docs.python.org/using/cmdline.html#cmdoption-W>`_ for more information.
-Upgrading to the Very Latest Pyramid Release
+Upgrading to the very latest Pyramid release
--------------------------------------------
When you upgrade your application to the most recent Pyramid release,
@@ -220,15 +238,13 @@ advisable to do this:
:ref:`testing_under_new_release`. Note any deprecation warnings and
remediate.
-- Upgrade to the most recent 1.3 release, 1.3.3. Run your application's
- tests, note any deprecation warnings and remediate.
+- Upgrade to the most recent 1.3 release, 1.3.3. Run your application's tests,
+ note any deprecation warnings, and remediate.
- Upgrade to 1.4.4. Run your application's tests, note any deprecation
- warnings and remediate.
+ warnings, and remediate.
If you skip testing your application under each minor release (for example if
-you upgrade directly from 1.2.1 to 1.4.4), you might miss a deprecation
-warning and waste more time trying to figure out an error caused by a feature
-removal than it would take to upgrade stepwise through each minor release.
-
-
+you upgrade directly from 1.2.1 to 1.4.4), you might miss a deprecation warning
+and waste more time trying to figure out an error caused by a feature removal
+than it would take to upgrade stepwise through each minor release.
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst
index 87a962a9a..c13558008 100644
--- a/docs/narr/urldispatch.rst
+++ b/docs/narr/urldispatch.rst
@@ -8,7 +8,7 @@ URL Dispatch
:term:`URL dispatch` provides a simple way to map URLs to :term:`view` code
using a simple pattern matching language. An ordered set of patterns is
-checked one-by-one. If one of the patterns matches the path information
+checked one by one. If one of the patterns matches the path information
associated with a request, a particular :term:`view callable` is invoked. A
view callable is a specific bit of code, defined in your application, that
receives the :term:`request` and returns a :term:`response` object.
@@ -21,12 +21,12 @@ If any route configuration is present in an application, the :app:`Pyramid`
matching patterns present in a *route map*.
If any route pattern matches the information in the :term:`request`,
-:app:`Pyramid` will invoke the :term:`view lookup` process to find a
-matching view.
+:app:`Pyramid` will invoke the :term:`view lookup` process to find a matching
+view.
If no route pattern in the route map matches the information in the
-:term:`request` provided in your application, :app:`Pyramid` will fail over
-to using :term:`traversal` to perform resource location and view lookup.
+:term:`request` provided in your application, :app:`Pyramid` will fail over to
+using :term:`traversal` to perform resource location and view lookup.
.. index::
single: route configuration
@@ -35,11 +35,11 @@ Route Configuration
-------------------
:term:`Route configuration` is the act of adding a new :term:`route` to an
-application. A route has a *name*, which acts as an identifier to be used
-for URL generation. The name also allows developers to associate a view
+application. A route has a *name*, which acts as an identifier to be used for
+URL generation. The name also allows developers to associate a view
configuration with the route. A route also has a *pattern*, meant to match
against the ``PATH_INFO`` portion of a URL (the portion following the scheme
-and port, e.g. ``/foo/bar`` in the URL `<http://localhost:8080/foo/bar>`_). It
+and port, e.g., ``/foo/bar`` in the URL ``http://localhost:8080/foo/bar``). It
also optionally has a ``factory`` and a set of :term:`route predicate`
attributes.
@@ -71,8 +71,8 @@ invoked when the associated route pattern matches during a request.
More commonly, you will not use any ``add_view`` statements in your project's
"setup" code. You will instead use ``add_route`` statements, and use a
-:term:`scan` to associate view callables with routes. For example, if
-this is a portion of your project's ``__init__.py``:
+:term:`scan` to associate view callables with routes. For example, if this is
+a portion of your project's ``__init__.py``:
.. code-block:: python
@@ -85,8 +85,8 @@ setup code. However, the above :term:`scan` execution
decoration`, including any objects decorated with the
:class:`pyramid.view.view_config` decorator in the ``mypackage`` Python
package. For example, if you have a ``views.py`` in your package, a scan will
-pick up any of its configuration decorators, so we can add one there
-that references ``myroute`` as a ``route_name`` parameter:
+pick up any of its configuration decorators, so we can add one there that
+references ``myroute`` as a ``route_name`` parameter:
.. code-block:: python
@@ -97,8 +97,8 @@ that references ``myroute`` as a ``route_name`` parameter:
def myview(request):
return Response('OK')
-The above combination of ``add_route`` and ``scan`` is completely equivalent
-to using the previous combination of ``add_route`` and ``add_view``.
+The above combination of ``add_route`` and ``scan`` is completely equivalent to
+using the previous combination of ``add_route`` and ``add_view``.
.. index::
single: route path pattern syntax
@@ -109,13 +109,13 @@ to using the previous combination of ``add_route`` and ``add_view``.
Route Pattern Syntax
~~~~~~~~~~~~~~~~~~~~
-The syntax of the pattern matching language used by :app:`Pyramid` URL
-dispatch in the *pattern* argument is straightforward; it is close to that of
-the :term:`Routes` system used by :term:`Pylons`.
+The syntax of the pattern matching language used by :app:`Pyramid` URL dispatch
+in the *pattern* argument is straightforward. It is close to that of the
+:term:`Routes` system used by :term:`Pylons`.
-The *pattern* used in route configuration may start with a slash character.
-If the pattern does not start with a slash character, an implicit slash will
-be prepended to it at matching time. For example, the following patterns are
+The *pattern* used in route configuration may start with a slash character. If
+the pattern does not start with a slash character, an implicit slash will be
+prepended to it at matching time. For example, the following patterns are
equivalent:
.. code-block:: text
@@ -128,28 +128,29 @@ and:
/{foo}/bar/baz
-If a pattern is a valid URL it won't be ever matched against an incoming
-request. Instead it can be useful for generating external URLs. See
-:ref:`External routes <external_route_narr>` for details.
+If a pattern is a valid URL it won't be matched against an incoming request.
+Instead it can be useful for generating external URLs. See :ref:`External
+routes <external_route_narr>` for details.
-A pattern segment (an individual item between ``/`` characters in the
-pattern) may either be a literal string (e.g. ``foo``) *or* it may be a
-replacement marker (e.g. ``{foo}``) or a certain combination of both. A
-replacement marker does not need to be preceded by a ``/`` character.
+A pattern segment (an individual item between ``/`` characters in the pattern)
+may either be a literal string (e.g., ``foo``) *or* it may be a replacement
+marker (e.g., ``{foo}``), or a certain combination of both. A replacement
+marker does not need to be preceded by a ``/`` character.
-A replacement marker is in the format ``{name}``, where this means "accept
-any characters up to the next slash character and use this as the ``name``
+A replacement marker is in the format ``{name}``, where this means "accept any
+characters up to the next slash character and use this as the ``name``
:term:`matchdict` value."
A replacement marker in a pattern must begin with an uppercase or lowercase
ASCII letter or an underscore, and can be composed only of uppercase or
lowercase ASCII letters, underscores, and numbers. For example: ``a``,
-``a_b``, ``_b``, and ``b9`` are all valid replacement marker names, but
-``0a`` is not.
+``a_b``, ``_b``, and ``b9`` are all valid replacement marker names, but ``0a``
+is not.
-.. note:: A replacement marker could not start with an underscore until
- Pyramid 1.2. Previous versions required that the replacement marker start
- with an uppercase or lowercase letter.
+.. versionchanged:: 1.2
+ A replacement marker could not start with an underscore until Pyramid 1.2.
+ Previous versions required that the replacement marker start with an
+ uppercase or lowercase letter.
A matchdict is the dictionary representing the dynamic parts extracted from a
URL based on the routing pattern. It is available as ``request.matchdict``.
@@ -174,18 +175,18 @@ It will not match the following patterns however:
foo/1/2/ -> No match (trailing slash)
bar/abc/def -> First segment literal mismatch
-The match for a segment replacement marker in a segment will be done only up
-to the first non-alphanumeric character in the segment in the pattern. So,
-for instance, if this route pattern was used:
+The match for a segment replacement marker in a segment will be done only up to
+the first non-alphanumeric character in the segment in the pattern. So, for
+instance, if this route pattern was used:
.. code-block:: text
foo/{name}.html
-The literal path ``/foo/biz.html`` will match the above route pattern, and
-the match result will be ``{'name':u'biz'}``. However, the literal path
-``/foo/biz`` will not match, because it does not contain a literal ``.html``
-at the end of the segment represented by ``{name}.html`` (it only contains
+The literal path ``/foo/biz.html`` will match the above route pattern, and the
+match result will be ``{'name':u'biz'}``. However, the literal path
+``/foo/biz`` will not match, because it does not contain a literal ``.html`` at
+the end of the segment represented by ``{name}.html`` (it only contains
``biz``, not ``biz.html``).
To capture both segments, two replacement markers can be used:
@@ -194,28 +195,27 @@ To capture both segments, two replacement markers can be used:
foo/{name}.{ext}
-The literal path ``/foo/biz.html`` will match the above route pattern, and
-the match result will be ``{'name': 'biz', 'ext': 'html'}``. This occurs
-because there is a literal part of ``.`` (period) between the two replacement
-markers ``{name}`` and ``{ext}``.
+The literal path ``/foo/biz.html`` will match the above route pattern, and the
+match result will be ``{'name': 'biz', 'ext': 'html'}``. This occurs because
+there is a literal part of ``.`` (period) between the two replacement markers
+``{name}`` and ``{ext}``.
Replacement markers can optionally specify a regular expression which will be
-used to decide whether a path segment should match the marker. To specify
-that a replacement marker should match only a specific set of characters as
-defined by a regular expression, you must use a slightly extended form of
-replacement marker syntax. Within braces, the replacement marker name must
-be followed by a colon, then directly thereafter, the regular expression.
-The *default* regular expression associated with a replacement marker
-``[^/]+`` matches one or more characters which are not a slash. For example,
-under the hood, the replacement marker ``{foo}`` can more verbosely be
-spelled as ``{foo:[^/]+}``. You can change this to be an arbitrary regular
-expression to match an arbitrary sequence of characters, such as
-``{foo:\d+}`` to match only digits.
+used to decide whether a path segment should match the marker. To specify that
+a replacement marker should match only a specific set of characters as defined
+by a regular expression, you must use a slightly extended form of replacement
+marker syntax. Within braces, the replacement marker name must be followed by
+a colon, then directly thereafter, the regular expression. The *default*
+regular expression associated with a replacement marker ``[^/]+`` matches one
+or more characters which are not a slash. For example, under the hood, the
+replacement marker ``{foo}`` can more verbosely be spelled as ``{foo:[^/]+}``.
+You can change this to be an arbitrary regular expression to match an arbitrary
+sequence of characters, such as ``{foo:\d+}`` to match only digits.
It is possible to use two replacement markers without any literal characters
between them, for instance ``/{foo}{bar}``. However, this would be a
-nonsensical pattern without specifying a custom regular expression to
-restrict what each marker captures.
+nonsensical pattern without specifying a custom regular expression to restrict
+what each marker captures.
Segments must contain at least one character in order to match a segment
replacement marker. For example, for the URL ``/abc/``:
@@ -224,7 +224,7 @@ replacement marker. For example, for the URL ``/abc/``:
- ``/{foo}/`` will match.
-Note that values representing matched path segments will be url-unquoted and
+Note that values representing matched path segments will be URL-unquoted and
decoded from UTF-8 into Unicode within the matchdict. So for instance, the
following pattern:
@@ -244,9 +244,9 @@ The matchdict will look like so (the value is URL-decoded / UTF-8 decoded):
{'bar':u'La Pe\xf1a'}
-Literal strings in the path segment should represent the *decoded* value of
-the ``PATH_INFO`` provided to Pyramid. You don't want to use a URL-encoded
-value or a bytestring representing the literal's UTF-8 in the pattern. For
+Literal strings in the path segment should represent the *decoded* value of the
+``PATH_INFO`` provided to Pyramid. You don't want to use a URL-encoded value
+or a bytestring representing the literal encoded as UTF-8 in the pattern. For
example, rather than this:
.. code-block:: text
@@ -259,8 +259,8 @@ You'll want to use something like this:
/Foo Bar/{baz}
-For patterns that contain "high-order" characters in its literals, you'll
-want to use a Unicode value as the pattern as opposed to any URL-encoded or
+For patterns that contain "high-order" characters in its literals, you'll want
+to use a Unicode value as the pattern as opposed to any URL-encoded or
UTF-8-encoded value. For example, you might be tempted to use a bytestring
pattern like this:
@@ -268,12 +268,11 @@ pattern like this:
/La Pe\xc3\xb1a/{x}
-But this will either cause an error at startup time or it won't match
-properly. You'll want to use a Unicode value as the pattern instead rather
-than raw bytestring escapes. You can use a high-order Unicode value as the
-pattern by using `Python source file encoding
-<http://www.python.org/dev/peps/pep-0263/>`_ plus the "real" character in the
-Unicode pattern in the source, like so:
+But this will either cause an error at startup time or it won't match properly.
+You'll want to use a Unicode value as the pattern instead rather than raw
+bytestring escapes. You can use a high-order Unicode value as the pattern by
+using `Python source file encoding <http://www.python.org/dev/peps/pep-0263/>`_
+plus the "real" character in the Unicode pattern in the source, like so:
.. code-block:: text
@@ -291,8 +290,8 @@ only to literals in the pattern.
If the pattern has a ``*`` in it, the name which follows it is considered a
"remainder match". A remainder match *must* come at the end of the pattern.
-Unlike segment replacement markers, it does not need to be preceded by a
-slash. For example:
+Unlike segment replacement markers, it does not need to be preceded by a slash.
+For example:
.. code-block:: text
@@ -310,7 +309,7 @@ The above pattern will match these URLs, generating the following matchdicts:
Note that when a ``*stararg`` remainder match is matched, the value put into
the matchdict is turned into a tuple of path segments representing the
-remainder of the path. These path segments are url-unquoted and decoded from
+remainder of the path. These path segments are URL-unquoted and decoded from
UTF-8 into Unicode. For example, for the following pattern:
.. code-block:: text
@@ -357,15 +356,15 @@ Route Declaration Ordering
Route configuration declarations are evaluated in a specific order when a
request enters the system. As a result, the order of route configuration
-declarations is very important. The order that routes declarations are
+declarations is very important. The order in which route declarations are
evaluated is the order in which they are added to the application at startup
time. (This is unlike a different way of mapping URLs to code that
:app:`Pyramid` provides, named :term:`traversal`, which does not depend on
pattern ordering).
For routes added via the :mod:`~pyramid.config.Configurator.add_route` method,
-the order that routes are evaluated is the order in which they are added to
-the configuration imperatively.
+the order that routes are evaluated is the order in which they are added to the
+configuration imperatively.
For example, route configuration statements with the following patterns might
be added in the following order:
@@ -375,10 +374,9 @@ be added in the following order:
members/{def}
members/abc
-In such a configuration, the ``members/abc`` pattern would *never* be
-matched. This is because the match ordering will always match
-``members/{def}`` first; the route configuration with ``members/abc`` will
-never be evaluated.
+In such a configuration, the ``members/abc`` pattern would *never* be matched.
+This is because the match ordering will always match ``members/{def}`` first;
+the route configuration with ``members/abc`` will never be evaluated.
.. index::
single: route configuration arguments
@@ -416,19 +414,18 @@ the system, for each route configuration declaration present in the system,
declared. This checking happens in the order that the routes were declared
via :meth:`pyramid.config.Configurator.add_route`.
-When a route configuration is declared, it may contain :term:`route
-predicate` arguments. All route predicates associated with a route
-declaration must be ``True`` for the route configuration to be used for a
-given request during a check. If any predicate in the set of :term:`route
-predicate` arguments provided to a route configuration returns ``False``
-during a check, that route is skipped and route matching continues through
-the ordered set of routes.
+When a route configuration is declared, it may contain :term:`route predicate`
+arguments. All route predicates associated with a route declaration must be
+``True`` for the route configuration to be used for a given request during a
+check. If any predicate in the set of :term:`route predicate` arguments
+provided to a route configuration returns ``False`` during a check, that route
+is skipped and route matching continues through the ordered set of routes.
If any route matches, the route matching process stops and the :term:`view
-lookup` subsystem takes over to find the most reasonable view callable for
-the matched route. Most often, there's only one view that will match (a view
-configured with a ``route_name`` argument matching the matched route). To
-gain a better understanding of how routes and views are associated in a real
+lookup` subsystem takes over to find the most reasonable view callable for the
+matched route. Most often, there's only one view that will match (a view
+configured with a ``route_name`` argument matching the matched route). To gain
+a better understanding of how routes and views are associated in a real
application, you can use the ``pviews`` command, as documented in
:ref:`displaying_matching_views`.
@@ -445,11 +442,10 @@ The Matchdict
~~~~~~~~~~~~~
When the URL pattern associated with a particular route configuration is
-matched by a request, a dictionary named ``matchdict`` is added as an
-attribute of the :term:`request` object. Thus, ``request.matchdict`` will
-contain the values that match replacement patterns in the ``pattern``
-element. The keys in a matchdict will be strings. The values will be
-Unicode objects.
+matched by a request, a dictionary named ``matchdict`` is added as an attribute
+of the :term:`request` object. Thus, ``request.matchdict`` will contain the
+values that match replacement patterns in the ``pattern`` element. The keys in
+a matchdict will be strings. The values will be Unicode objects.
.. note::
@@ -466,10 +462,10 @@ The Matched Route
When the URL pattern associated with a particular route configuration is
matched by a request, an object named ``matched_route`` is added as an
-attribute of the :term:`request` object. Thus, ``request.matched_route``
-will be an object implementing the :class:`~pyramid.interfaces.IRoute`
-interface which matched the request. The most useful attribute of the route
-object is ``name``, which is the name of the route that matched.
+attribute of the :term:`request` object. Thus, ``request.matched_route`` will
+be an object implementing the :class:`~pyramid.interfaces.IRoute` interface
+which matched the request. The most useful attribute of the route object is
+``name``, which is the name of the route that matched.
.. note::
@@ -480,8 +476,8 @@ Routing Examples
----------------
Let's check out some examples of how route configuration statements might be
-commonly declared, and what will happen if they are matched by the
-information present in a request.
+commonly declared, and what will happen if they are matched by the information
+present in a request.
.. _urldispatch_example1:
@@ -495,32 +491,38 @@ result in a particular view callable being invoked:
:linenos:
config.add_route('idea', 'site/{id}')
- config.add_view('mypackage.views.site_view', route_name='idea')
+ config.scan()
When a route configuration with a ``view`` attribute is added to the system,
and an incoming request matches the *pattern* of the route configuration, the
:term:`view callable` named as the ``view`` attribute of the route
configuration will be invoked.
-In the case of the above example, when the URL of a request matches
-``/site/{id}``, the view callable at the Python dotted path name
-``mypackage.views.site_view`` will be called with the request. In other
-words, we've associated a view callable directly with a route pattern.
+Recall that the ``@view_config`` is equivalent to calling ``config.add_view``,
+because the ``config.scan()`` call will import ``mypackage.views``, shown
+below, and execute ``config.add_view`` under the hood. Each view then maps the
+route name to the matching view callable. In the case of the above example,
+when the URL of a request matches ``/site/{id}``, the view callable at the
+Python dotted path name ``mypackage.views.site_view`` will be called with the
+request. In other words, we've associated a view callable directly with a
+route pattern.
When the ``/site/{id}`` route pattern matches during a request, the
-``site_view`` view callable is invoked with that request as its sole
-argument. When this route matches, a ``matchdict`` will be generated and
-attached to the request as ``request.matchdict``. If the specific URL
-matched is ``/site/1``, the ``matchdict`` will be a dictionary with a single
-key, ``id``; the value will be the string ``'1'``, ex.: ``{'id':'1'}``.
+``site_view`` view callable is invoked with that request as its sole argument.
+When this route matches, a ``matchdict`` will be generated and attached to the
+request as ``request.matchdict``. If the specific URL matched is ``/site/1``,
+the ``matchdict`` will be a dictionary with a single key, ``id``; the value
+will be the string ``'1'``, ex.: ``{'id':'1'}``.
The ``mypackage.views`` module referred to above might look like so:
.. code-block:: python
:linenos:
+ from pyramid.view import view_config
from pyramid.response import Response
+ @view_config(route_name='idea')
def site_view(request):
return Response(request.matchdict['id'])
@@ -533,8 +535,8 @@ information about views.
Example 2
~~~~~~~~~
-Below is an example of a more complicated set of route statements you might
-add to your application:
+Below is an example of a more complicated set of route statements you might add
+to your application:
.. code-block:: python
:linenos:
@@ -542,11 +544,30 @@ add to your application:
config.add_route('idea', 'ideas/{idea}')
config.add_route('user', 'users/{user}')
config.add_route('tag', 'tags/{tag}')
+ config.scan()
- config.add_view('mypackage.views.idea_view', route_name='idea')
- config.add_view('mypackage.views.user_view', route_name='user')
- config.add_view('mypackage.views.tag_view', route_name='tag')
+Here is an example of a corresponding ``mypackage.views`` module:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.view import view_config
+ from pyramid.response import Response
+ @view_config(route_name='idea')
+ def idea_view(request):
+ return Response(request.matchdict['id'])
+
+ @view_config(route_name='user')
+ def user_view(request):
+ user = request.matchdict['user']
+ return Response(u'The user is {}.'.format(user))
+
+ @view_config(route_name='tag')
+ def tag_view(request):
+ tag = request.matchdict['tag']
+ return Response(u'The tag is {}.'.format(tag))
+
The above configuration will allow :app:`Pyramid` to service URLs in these
forms:
@@ -562,33 +583,32 @@ forms:
and attached to the :term:`request` will consist of ``{'idea':'1'}``.
- When a URL matches the pattern ``/users/{user}``, the view callable
- available at the dotted Python pathname ``mypackage.views.user_view`` will
- be called. For the specific URL ``/users/1``, the ``matchdict`` generated
- and attached to the :term:`request` will consist of ``{'user':'1'}``.
+ available at the dotted Python pathname ``mypackage.views.user_view`` will be
+ called. For the specific URL ``/users/1``, the ``matchdict`` generated and
+ attached to the :term:`request` will consist of ``{'user':'1'}``.
- When a URL matches the pattern ``/tags/{tag}``, the view callable available
at the dotted Python pathname ``mypackage.views.tag_view`` will be called.
- For the specific URL ``/tags/1``, the ``matchdict`` generated and attached
- to the :term:`request` will consist of ``{'tag':'1'}``.
+ For the specific URL ``/tags/1``, the ``matchdict`` generated and attached to
+ the :term:`request` will consist of ``{'tag':'1'}``.
In this example we've again associated each of our routes with a :term:`view
-callable` directly. In all cases, the request, which will have a
-``matchdict`` attribute detailing the information found in the URL by the
-process will be passed to the view callable.
+callable` directly. In all cases, the request, which will have a ``matchdict``
+attribute detailing the information found in the URL by the process will be
+passed to the view callable.
Example 3
~~~~~~~~~
-The :term:`context` resource object passed in to a view found as the result
-of URL dispatch will, by default, be an instance of the object returned by
-the :term:`root factory` configured at startup time (the ``root_factory``
-argument to the :term:`Configurator` used to configure the application).
+The :term:`context` resource object passed in to a view found as the result of
+URL dispatch will, by default, be an instance of the object returned by the
+:term:`root factory` configured at startup time (the ``root_factory`` argument
+to the :term:`Configurator` used to configure the application).
You can override this behavior by passing in a ``factory`` argument to the
:meth:`~pyramid.config.Configurator.add_route` method for a particular route.
-The ``factory`` should be a callable that accepts a :term:`request` and
-returns an instance of a class that will be the context resource used by the
-view.
+The ``factory`` should be a callable that accepts a :term:`request` and returns
+an instance of a class that will be the context resource used by the view.
An example of using a route with a factory:
@@ -596,7 +616,7 @@ An example of using a route with a factory:
:linenos:
config.add_route('idea', 'ideas/{idea}', factory='myproject.resources.Idea')
- config.add_view('myproject.views.idea_view', route_name='idea')
+ config.scan()
The above route will manufacture an ``Idea`` resource as a :term:`context`,
assuming that ``mypackage.resources.Idea`` resolves to a class that accepts a
@@ -610,7 +630,20 @@ request in its ``__init__``. For example:
pass
In a more complicated application, this root factory might be a class
-representing a :term:`SQLAlchemy` model.
+representing a :term:`SQLAlchemy` model. The view ``mypackage.views.idea_view``
+might look like this:
+
+.. code-block:: python
+ :linenos:
+
+ @view_config(route_name='idea')
+ def idea_view(request):
+ idea = request.context
+ return Response(idea)
+
+Here, ``request.context`` is an instance of ``Idea``. If indeed the resource
+object is a SQLAlchemy model, you do not even have to perform a query in the
+view callable, since you have access to the resource via ``request.context``.
See :ref:`route_factories` for more details about how to use route factories.
@@ -647,9 +680,9 @@ Or provide the literal string ``/`` as the pattern:
Generating Route URLs
---------------------
-Use the :meth:`pyramid.request.Request.route_url` method to generate URLs
-based on route patterns. For example, if you've configured a route with the
-``name`` "foo" and the ``pattern`` "{a}/{b}/{c}", you might do this.
+Use the :meth:`pyramid.request.Request.route_url` method to generate URLs based
+on route patterns. For example, if you've configured a route with the ``name``
+"foo" and the ``pattern`` "{a}/{b}/{c}", you might do this.
.. code-block:: python
:linenos:
@@ -669,13 +702,12 @@ To generate only the *path* portion of a URL from a route, use the
This will return the string ``/1/2/3`` rather than a full URL.
-Replacement values passed to ``route_url`` or ``route_path`` must be Unicode
-or bytestrings encoded in UTF-8. One exception to this rule exists: if
-you're trying to replace a "remainder" match value (a ``*stararg``
-replacement value), the value may be a tuple containing Unicode strings or
-UTF-8 strings.
+Replacement values passed to ``route_url`` or ``route_path`` must be Unicode or
+bytestrings encoded in UTF-8. One exception to this rule exists: if you're
+trying to replace a "remainder" match value (a ``*stararg`` replacement value),
+the value may be a tuple containing Unicode strings or UTF-8 strings.
-Note that URLs and paths generated by ``route_path`` and ``route_url`` are
+Note that URLs and paths generated by ``route_url`` and ``route_path`` are
always URL-quoted string types (they contain no non-ASCII characters).
Therefore, if you've added a route like so:
@@ -689,7 +721,7 @@ And you later generate a URL using ``route_path`` or ``route_url`` like so:
url = request.route_path('la', city=u'Québec')
-You will wind up with the path encoded to UTF-8 and URL quoted like so:
+You will wind up with the path encoded to UTF-8 and URL-quoted like so:
.. code-block:: text
@@ -721,7 +753,7 @@ You can get a similar result by passing a tuple composed of path elements:
url = request.route_path('abc', foo=(u'Québec', u'biz'))
-Each value in the tuple will be url-quoted and joined by slashes in this case:
+Each value in the tuple will be URL-quoted and joined by slashes in this case:
.. code-block:: text
@@ -755,7 +787,7 @@ ignored when ``static`` is ``True``.
:ref:`External routes <external_route_narr>` are implicitly static.
.. versionadded:: 1.1
- the ``static`` argument to :meth:`~pyramid.config.Configurator.add_route`
+ the ``static`` argument to :meth:`~pyramid.config.Configurator.add_route`.
.. _external_route_narr:
@@ -798,13 +830,15 @@ argument to :meth:`pyramid.config.Configurator.add_notfound_view` or the
equivalent ``append_slash`` argument to the
:class:`pyramid.view.notfound_view_config` decorator.
-Adding ``append_slash=True`` is a way to automatically redirect requests
-where the URL lacks a trailing slash, but requires one to match the proper
-route. When configured, along with at least one other route in your
-application, this view will be invoked if the value of ``PATH_INFO`` does not
-already end in a slash, and if the value of ``PATH_INFO`` *plus* a slash
-matches any route's pattern. In this case it does an HTTP redirect to the
-slash-appended ``PATH_INFO``.
+Adding ``append_slash=True`` is a way to automatically redirect requests where
+the URL lacks a trailing slash, but requires one to match the proper route.
+When configured, along with at least one other route in your application, this
+view will be invoked if the value of ``PATH_INFO`` does not already end in a
+slash, and if the value of ``PATH_INFO`` *plus* a slash matches any route's
+pattern. In this case it does an HTTP redirect to the slash-appended
+``PATH_INFO``. In addition you may pass anything that implements
+:class:`pyramid.interfaces.IResponse` which will then be used in place of the
+default class (:class:`pyramid.httpexceptions.HTTPFound`).
Let's use an example. If the following routes are configured in your
application:
@@ -832,12 +866,11 @@ application:
config.add_notfound_view(notfound, append_slash=True)
If a request enters the application with the ``PATH_INFO`` value of
-``/no_slash``, the first route will match and the browser will show "No
-slash". However, if a request enters the application with the ``PATH_INFO``
-value of ``/no_slash/``, *no* route will match, and the slash-appending not
-found view will not find a matching route with an appended slash. As a
-result, the ``notfound`` view will be called and it will return a "Not found,
-bro." body.
+``/no_slash``, the first route will match and the browser will show "No slash".
+However, if a request enters the application with the ``PATH_INFO`` value of
+``/no_slash/``, *no* route will match, and the slash-appending not found view
+will not find a matching route with an appended slash. As a result, the
+``notfound`` view will be called and it will return a "Not found, bro." body.
If a request enters the application with the ``PATH_INFO`` value of
``/has_slash/``, the second route will match. If a request enters the
@@ -894,10 +927,10 @@ Debugging Route Matching
It's useful to be able to take a peek under the hood when requests that enter
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
-:app:`Pyramid` application will be printed to the ``stderr`` of the console
+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 :app:`Pyramid` application will be printed to the ``stderr`` of the console
which you started the application from. For example:
.. code-block:: text
@@ -914,11 +947,11 @@ which you started the application from. For example:
http://localhost:6543/static/logo.png; \
route_name: 'static/', ....
-See :ref:`environment_chapter` for more information about how, and where to
-set these values.
+See :ref:`environment_chapter` for more information about how and where to set
+these values.
-You can also use the ``proutes`` command to see a display of all the
-routes configured in your application; for more information, see
+You can also use the ``proutes`` command to see a display of all the routes
+configured in your application. For more information, see
:ref:`displaying_application_routes`.
.. _route_prefix:
@@ -939,11 +972,11 @@ named ``route_prefix`` which can be useful to authors of URL-dispatch-based
applications. If ``route_prefix`` is supplied to the include method, it must
be a string. This string represents a route prefix that will be prepended to
all route patterns added by the *included* configuration. Any calls to
-:meth:`pyramid.config.Configurator.add_route` within the included callable
-will have their pattern prefixed with the value of ``route_prefix``. This can
-be used to help mount a set of routes at a different location than the
-included callable's author intended while still maintaining the same route
-names. For example:
+:meth:`pyramid.config.Configurator.add_route` within the included callable will
+have their pattern prefixed with the value of ``route_prefix``. This can be
+used to help mount a set of routes at a different location than the included
+callable's author intended while still maintaining the same route names. For
+example:
.. code-block:: python
:linenos:
@@ -958,15 +991,15 @@ names. For example:
config.include(users_include, route_prefix='/users')
In the above configuration, the ``show_users`` route will have an effective
-route pattern of ``/users/show``, instead of ``/show`` because the
+route pattern of ``/users/show`` instead of ``/show`` because the
``route_prefix`` argument will be prepended to the pattern. The route will
then only match if the URL path is ``/users/show``, and when the
:meth:`pyramid.request.Request.route_url` function is called with the route
name ``show_users``, it will generate a URL with that same path.
Route prefixes are recursive, so if a callable executed via an include itself
-turns around and includes another callable, the second-level route prefix
-will be prepended with the first:
+turns around and includes another callable, the second-level route prefix will
+be prepended with the first:
.. code-block:: python
:linenos:
@@ -985,15 +1018,15 @@ will be prepended with the first:
config.include(users_include, route_prefix='/users')
In the above configuration, the ``show_users`` route will still have an
-effective route pattern of ``/users/show``. The ``show_times`` route
-however, will have an effective pattern of ``/users/timing/times``.
+effective route pattern of ``/users/show``. The ``show_times`` route, however,
+will have an effective pattern of ``/users/timing/times``.
-Route prefixes have no impact on the requirement that the set of route
-*names* in any given Pyramid configuration must be entirely unique. If you
-compose your URL dispatch application out of many small subapplications using
-:meth:`pyramid.config.Configurator.include`, it's wise to use a dotted name
-for your route names, so they'll be unlikely to conflict with other packages
-that may be added in the future. For example:
+Route prefixes have no impact on the requirement that the set of route *names*
+in any given Pyramid configuration must be entirely unique. If you compose
+your URL dispatch application out of many small subapplications using
+:meth:`pyramid.config.Configurator.include`, it's wise to use a dotted name for
+your route names so they'll be unlikely to conflict with other packages that
+may be added in the future. For example:
.. code-block:: python
:linenos:
@@ -1020,15 +1053,16 @@ Custom Route Predicates
-----------------------
Each of the predicate callables fed to the ``custom_predicates`` argument of
-:meth:`~pyramid.config.Configurator.add_route` must be a callable accepting
-two arguments. The first argument passed to a custom predicate is a
-dictionary conventionally named ``info``. The second argument is the current
+:meth:`~pyramid.config.Configurator.add_route` must be a callable accepting two
+arguments. The first argument passed to a custom predicate is a dictionary
+conventionally named ``info``. The second argument is the current
:term:`request` object.
-The ``info`` dictionary has a number of contained values: ``match`` is a
-dictionary: it represents the arguments matched in the URL by the route.
-``route`` is an object representing the route which was matched (see
-:class:`pyramid.interfaces.IRoute` for the API of such a route object).
+The ``info`` dictionary has a number of contained values, including ``match``
+and ``route``. ``match`` is a dictionary which represents the arguments matched
+in the URL by the route. ``route`` is an object representing the route which
+was matched (see :class:`pyramid.interfaces.IRoute` for the API of such a route
+object).
``info['match']`` is useful when predicates need access to the route match.
For example:
@@ -1078,9 +1112,9 @@ instance, a predicate might do some type conversion of values:
config.add_route('ymd', '/{year}/{month}/{day}',
custom_predicates=(ymd_to_int,))
-Note that a conversion predicate is still a predicate so it must return
-``True`` or ``False``; a predicate that does *only* conversion, such as the
-one we demonstrate above should unconditionally return ``True``.
+Note that a conversion predicate is still a predicate, so it must return
+``True`` or ``False``. A predicate that does *only* conversion, such as the one
+we demonstrate above, should unconditionally return ``True``.
To avoid the try/except uncertainty, the route pattern can contain regular
expressions specifying requirements for that marker. For instance:
@@ -1101,31 +1135,31 @@ expressions specifying requirements for that marker. For instance:
config.add_route('ymd', '/{year:\d+}/{month:\d+}/{day:\d+}',
custom_predicates=(ymd_to_int,))
-Now the try/except is no longer needed because the route will not match at
-all unless these markers match ``\d+`` which requires them to be valid digits
-for an ``int`` type conversion.
+Now the try/except is no longer needed because the route will not match at all
+unless these markers match ``\d+`` which requires them to be valid digits for
+an ``int`` type conversion.
-The ``match`` dictionary passed within ``info`` to each predicate attached to
-a route will be the same dictionary. Therefore, when registering a custom
-predicate which modifies the ``match`` dict, the code registering the
-predicate should usually arrange for the predicate to be the *last* custom
-predicate in the custom predicate list. Otherwise, custom predicates which
-fire subsequent to the predicate which performs the ``match`` modification
-will receive the *modified* match dictionary.
+The ``match`` dictionary passed within ``info`` to each predicate attached to a
+route will be the same dictionary. Therefore, when registering a custom
+predicate which modifies the ``match`` dict, the code registering the predicate
+should usually arrange for the predicate to be the *last* custom predicate in
+the custom predicate list. Otherwise, custom predicates which fire subsequent
+to the predicate which performs the ``match`` modification will receive the
+*modified* match dictionary.
.. warning::
It is a poor idea to rely on ordering of custom predicates to build a
conversion pipeline, where one predicate depends on the side effect of
- another. For instance, it's a poor idea to register two custom
- predicates, one which handles conversion of a value to an int, the next
- which handles conversion of that integer to some custom object. Just do
- all that in a single custom predicate.
+ another. For instance, it's a poor idea to register two custom predicates,
+ one which handles conversion of a value to an int, the next which handles
+ conversion of that integer to some custom object. Just do all that in a
+ single custom predicate.
The ``route`` object in the ``info`` dict is an object that has two useful
-attributes: ``name`` and ``pattern``. The ``name`` attribute is the route
-name. The ``pattern`` attribute is the route pattern. An example of using
-the route in a set of route predicates:
+attributes: ``name`` and ``pattern``. The ``name`` attribute is the route name.
+The ``pattern`` attribute is the route pattern. Here's an example of using the
+route in a set of route predicates:
.. code-block:: python
:linenos:
@@ -1140,14 +1174,14 @@ the route in a set of route predicates:
custom_predicates=(twenty_ten,))
The above predicate, when added to a number of route configurations ensures
-that the year match argument is '2010' if and only if the route name is
-'ymd', 'ym', or 'y'.
+that the year match argument is '2010' if and only if the route name is 'ymd',
+'ym', or 'y'.
-You can also caption the predicates by setting the ``__text__``
-attribute. This will help you with the ``pviews`` command (see
+You can also caption the predicates by setting the ``__text__`` attribute. This
+will help you with the ``pviews`` command (see
:ref:`displaying_application_routes`) and the ``pyramid_debugtoolbar``.
-If a predicate is a class just add __text__ property in a standard manner.
+If a predicate is a class, just add ``__text__`` property in a standard manner.
.. code-block:: python
:linenos:
@@ -1159,8 +1193,8 @@ If a predicate is a class just add __text__ property in a standard manner.
class DummyCustomPredicate2(object):
__text__ = 'my custom class predicate'
-If a predicate is a method you'll need to assign it after method declaration
-(see `PEP 232 <http://www.python.org/dev/peps/pep-0232/>`_)
+If a predicate is a method, you'll need to assign it after method declaration
+(see `PEP 232 <http://www.python.org/dev/peps/pep-0232/>`_).
.. code-block:: python
:linenos:
@@ -1169,8 +1203,8 @@ If a predicate is a method you'll need to assign it after method declaration
pass
custom_predicate.__text__ = 'my custom method predicate'
-If a predicate is a classmethod using @classmethod will not work, but you can
-still easily do it by wrapping it in classmethod call.
+If a predicate is a classmethod, using ``@classmethod`` will not work, but you
+can still easily do it by wrapping it in a classmethod call.
.. code-block:: python
:linenos:
@@ -1180,7 +1214,7 @@ still easily do it by wrapping it in classmethod call.
classmethod_predicate.__text__ = 'my classmethod predicate'
classmethod_predicate = classmethod(classmethod_predicate)
-Same will work with staticmethod, just use ``staticmethod`` instead of
+The same will work with ``staticmethod``, using ``staticmethod`` instead of
``classmethod``.
.. seealso::
@@ -1196,10 +1230,10 @@ Same will work with staticmethod, just use ``staticmethod`` instead of
Route Factories
---------------
-Although it is not a particular common need in basic applications, a "route"
-configuration declaration can mention a "factory". When that route matches a
-request, and a factory is attached to a route, the :term:`root factory`
-passed at startup time to the :term:`Configurator` is ignored; instead the
+Although it is not a particularly common need in basic applications, a "route"
+configuration declaration can mention a "factory". When a route matches a
+request, and a factory is attached to the route, the :term:`root factory`
+passed at startup time to the :term:`Configurator` is ignored. Instead the
factory associated with the route is used to generate a :term:`root` object.
This object will usually be used as the :term:`context` resource of the view
callable ultimately found via :term:`view lookup`.
@@ -1215,8 +1249,8 @@ The factory can either be a Python object or a :term:`dotted Python name` (a
string) which points to such a Python object, as it is above.
In this way, each route can use a different factory, making it possible to
-supply a different :term:`context` resource object to the view related to
-each particular route.
+supply a different :term:`context` resource object to the view related to each
+particular route.
A factory must be a callable which accepts a request and returns an arbitrary
Python object. For example, the below class can be used as a factory:
@@ -1228,33 +1262,31 @@ Python object. For example, the below class can be used as a factory:
def __init__(self, request):
pass
-A route factory is actually conceptually identical to the :term:`root
-factory` described at :ref:`the_resource_tree`.
+A route factory is actually conceptually identical to the :term:`root factory`
+described at :ref:`the_resource_tree`.
Supplying a different resource factory for each route is useful when you're
trying to use a :app:`Pyramid` :term:`authorization policy` to provide
-declarative, "context sensitive" security checks; each resource can maintain
-a separate :term:`ACL`, as documented in
-:ref:`using_security_with_urldispatch`. It is also useful when you wish to
-combine URL dispatch with :term:`traversal` as documented within
-:ref:`hybrid_chapter`.
+declarative, "context sensitive" security checks. Each resource can maintain a
+separate :term:`ACL`, as documented in :ref:`using_security_with_urldispatch`.
+It is also useful when you wish to combine URL dispatch with :term:`traversal`
+as documented within :ref:`hybrid_chapter`.
.. index::
pair: URL dispatch; security
.. _using_security_with_urldispatch:
-Using :app:`Pyramid` Security With URL Dispatch
---------------------------------------------------
+Using :app:`Pyramid` Security with URL Dispatch
+-----------------------------------------------
:app:`Pyramid` provides its own security framework which consults an
-:term:`authorization policy` before allowing any application code to be
-called. This framework operates in terms of an access control list, which is
-stored as an ``__acl__`` attribute of a resource object. A common thing to
-want to do is to attach an ``__acl__`` to the resource object dynamically for
-declarative security purposes. You can use the ``factory`` argument that
-points at a factory which attaches a custom ``__acl__`` to an object at its
-creation time.
+:term:`authorization policy` before allowing any application code to be called.
+This framework operates in terms of an access control list, which is stored as
+an ``__acl__`` attribute of a resource object. A common thing to want to do is
+to attach an ``__acl__`` to the resource object dynamically for declarative
+security purposes. You can use the ``factory`` argument that points at a
+factory which attaches a custom ``__acl__`` to an object at its creation time.
Such a ``factory`` might look like so:
@@ -1270,15 +1302,15 @@ Such a ``factory`` might look like so:
If the route ``archives/{article}`` is matched, and the article number is
``1``, :app:`Pyramid` will generate an ``Article`` :term:`context` resource
-with an ACL on it that allows the ``editor`` principal the ``view``
-permission. Obviously you can do more generic things than inspect the routes
-match dict to see if the ``article`` argument matches a particular string;
-our sample ``Article`` factory class is not very ambitious.
+with an ACL on it that allows the ``editor`` principal the ``view`` permission.
+Obviously you can do more generic things than inspect the route's match dict to
+see if the ``article`` argument matches a particular string. Our sample
+``Article`` factory class is not very ambitious.
.. note::
- See :ref:`security_chapter` for more information about
- :app:`Pyramid` security and ACLs.
+ See :ref:`security_chapter` for more information about :app:`Pyramid`
+ security and ACLs.
.. index::
pair: route; view callable lookup details
@@ -1290,10 +1322,9 @@ When a request enters the system which matches the pattern of the route, the
usual result is simple: the view callable associated with the route is
invoked with the request that caused the invocation.
-For most usage, you needn't understand more than this; how it works is an
-implementation detail. In the interest of completeness, however, we'll
-explain how it *does* work in this section. You can skip it if you're
-uninterested.
+For most usage, you needn't understand more than this. How it works is an
+implementation detail. In the interest of completeness, however, we'll explain
+how it *does* work in this section. You can skip it if you're uninterested.
When a view is associated with a route configuration, :app:`Pyramid` ensures
that a :term:`view configuration` is registered that will always be found
@@ -1309,26 +1340,25 @@ when the route pattern is matched during a request. To do so:
- At runtime, when a request causes any route to match, the :term:`request`
object is decorated with the route-specific interface.
-- The fact that the request is decorated with a route-specific interface
- causes the :term:`view lookup` machinery to always use the view callable
- registered using that interface by the route configuration to service
- requests that match the route pattern.
+- The fact that the request is decorated with a route-specific interface causes
+ the :term:`view lookup` machinery to always use the view callable registered
+ using that interface by the route configuration to service requests that
+ match the route pattern.
As we can see from the above description, technically, URL dispatch doesn't
-actually map a URL pattern directly to a view callable. Instead, URL
-dispatch is a :term:`resource location` mechanism. A :app:`Pyramid`
-:term:`resource location` subsystem (i.e., :term:`URL dispatch` or
-:term:`traversal`) finds a :term:`resource` object that is the
-:term:`context` of a :term:`request`. Once the :term:`context` is determined,
-a separate subsystem named :term:`view lookup` is then responsible for
-finding and invoking a :term:`view callable` based on information available
-in the context and the request. When URL dispatch is used, the resource
-location and view lookup subsystems provided by :app:`Pyramid` are still
-being utilized, but in a way which does not require a developer to understand
-either of them in detail.
-
-If no route is matched using :term:`URL dispatch`, :app:`Pyramid` falls back
-to :term:`traversal` to handle the :term:`request`.
+actually map a URL pattern directly to a view callable. Instead URL dispatch
+is a :term:`resource location` mechanism. A :app:`Pyramid` :term:`resource
+location` subsystem (i.e., :term:`URL dispatch` or :term:`traversal`) finds a
+:term:`resource` object that is the :term:`context` of a :term:`request`. Once
+the :term:`context` is determined, a separate subsystem named :term:`view
+lookup` is then responsible for finding and invoking a :term:`view callable`
+based on information available in the context and the request. When URL
+dispatch is used, the resource location and view lookup subsystems provided by
+:app:`Pyramid` are still being utilized, but in a way which does not require a
+developer to understand either of them in detail.
+
+If no route is matched using :term:`URL dispatch`, :app:`Pyramid` falls back to
+:term:`traversal` to handle the :term:`request`.
References
----------
diff --git a/docs/narr/vhosting.rst b/docs/narr/vhosting.rst
index 53f6888b3..0edf03353 100644
--- a/docs/narr/vhosting.rst
+++ b/docs/narr/vhosting.rst
@@ -6,13 +6,13 @@
Virtual Hosting
===============
-"Virtual hosting" is, loosely, the act of serving a :app:`Pyramid`
-application or a portion of a :app:`Pyramid` application under a
-URL space that it does not "naturally" inhabit.
+"Virtual hosting" is, loosely, the act of serving a :app:`Pyramid` application
+or a portion of a :app:`Pyramid` application under a URL space that it does not
+"naturally" inhabit.
-:app:`Pyramid` provides facilities for serving an application under
-a URL "prefix", as well as serving a *portion* of a :term:`traversal`
-based application under a root URL.
+:app:`Pyramid` provides facilities for serving an application under a URL
+"prefix", as well as serving a *portion* of a :term:`traversal` based
+application under a root URL.
.. index::
single: hosting an app under a prefix
@@ -20,27 +20,26 @@ based application under a root URL.
Hosting an Application Under a URL Prefix
-----------------------------------------
-:app:`Pyramid` supports a common form of virtual hosting whereby you
-can host a :app:`Pyramid` application as a "subset" of some other site
-(e.g. under ``http://example.com/mypyramidapplication/`` as opposed to
-under ``http://example.com/``).
+:app:`Pyramid` supports a common form of virtual hosting whereby you can host a
+:app:`Pyramid` application as a "subset" of some other site (e.g., under
+``http://example.com/mypyramidapplication/`` as opposed to under
+``http://example.com/``).
If you use a "pure Python" environment, this functionality can be provided by
-Paste's `urlmap <http://pythonpaste.org/modules/urlmap.html>`_ "composite"
-WSGI application. Alternately, you can use :term:`mod_wsgi` to serve your
-application, which handles this virtual hosting translation for you "under
-the hood".
-
-If you use the ``urlmap`` composite application "in front" of a
-:app:`Pyramid` application or if you use :term:`mod_wsgi` to serve
-up a :app:`Pyramid` application, nothing special needs to be done
-within the application for URLs to be generated that contain a
-prefix. :mod:`paste.urlmap` and :term:`mod_wsgi` manipulate the
-:term:`WSGI` environment in such a way that the ``PATH_INFO`` and
-``SCRIPT_NAME`` variables are correct for some given prefix.
-
-Here's an example of a PasteDeploy configuration snippet that includes
-a ``urlmap`` composite.
+Paste's `urlmap <http://pythonpaste.org/modules/urlmap.html>`_ "composite" WSGI
+application. Alternatively, you can use :term:`mod_wsgi` to serve your
+application, which handles this virtual hosting translation for you "under the
+hood".
+
+If you use the ``urlmap`` composite application "in front" of a :app:`Pyramid`
+application or if you use :term:`mod_wsgi` to serve up a :app:`Pyramid`
+application, nothing special needs to be done within the application for URLs
+to be generated that contain a prefix. :mod:`paste.urlmap` and :term:`mod_wsgi`
+manipulate the :term:`WSGI` environment in such a way that the ``PATH_INFO``
+and ``SCRIPT_NAME`` variables are correct for some given prefix.
+
+Here's an example of a PasteDeploy configuration snippet that includes a
+``urlmap`` composite.
.. code-block:: ini
:linenos:
@@ -52,23 +51,21 @@ a ``urlmap`` composite.
use = egg:Paste#urlmap
/pyramidapp = mypyramidapp
-This "roots" the :app:`Pyramid` application at the prefix
-``/pyramidapp`` and serves up the composite as the "main" application
-in the file.
+This "roots" the :app:`Pyramid` application at the prefix ``/pyramidapp`` and
+serves up the composite as the "main" application in the file.
-.. note:: If you're using an Apache server to proxy to a Paste
- ``urlmap`` composite, you may have to use the `ProxyPreserveHost
+.. note:: If you're using an Apache server to proxy to a Paste ``urlmap``
+ composite, you may have to use the `ProxyPreserveHost
<http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost>`_
directive to pass the original ``HTTP_HOST`` header along to the
- application, so URLs get generated properly. As of this writing
- the ``urlmap`` composite does not seem to respect the
- ``HTTP_X_FORWARDED_HOST`` parameter, which will contain the
- original host header even if ``HTTP_HOST`` is incorrect.
+ application, so URLs get generated properly. As of this writing the
+ ``urlmap`` composite does not seem to respect the ``HTTP_X_FORWARDED_HOST``
+ parameter, which will contain the original host header even if ``HTTP_HOST``
+ is incorrect.
-If you use :term:`mod_wsgi`, you do not need to use a ``composite``
-application in your ``.ini`` file. The ``WSGIScriptAlias``
-configuration setting in a :term:`mod_wsgi` configuration does the
-work for you:
+If you use :term:`mod_wsgi`, you do not need to use a ``composite`` application
+in your ``.ini`` file. The ``WSGIScriptAlias`` configuration setting in a
+:term:`mod_wsgi` configuration does the work for you:
.. code-block:: apache
:linenos:
@@ -87,8 +84,7 @@ Virtual Root Support
--------------------
:app:`Pyramid` also supports "virtual roots", which can be used in
-:term:`traversal` -based (but not :term:`URL dispatch` -based)
-applications.
+:term:`traversal`-based (but not :term:`URL dispatch`-based) applications.
Virtual root support is useful when you'd like to host some resource in a
:app:`Pyramid` resource tree as an application under a URL pathname that does
@@ -98,15 +94,14 @@ object at the traversal path ``/cms`` as an application reachable via
To specify a virtual root, cause an environment variable to be inserted into
the WSGI environ named ``HTTP_X_VHM_ROOT`` with a value that is the absolute
-pathname to the resource object in the resource tree that should behave as
-the "root" resource. As a result, the traversal machinery will respect this
-value during traversal (prepending it to the PATH_INFO before traversal
-starts), and the :meth:`pyramid.request.Request.resource_url` API will
-generate the "correct" virtually-rooted URLs.
+pathname to the resource object in the resource tree that should behave as the
+"root" resource. As a result, the traversal machinery will respect this value
+during traversal (prepending it to the PATH_INFO before traversal starts), and
+the :meth:`pyramid.request.Request.resource_url` API will generate the
+"correct" virtually-rooted URLs.
-An example of an Apache ``mod_proxy`` configuration that will host the
-``/cms`` subobject as ``http://www.example.com/`` using this facility
-is below:
+An example of an Apache ``mod_proxy`` configuration that will host the ``/cms``
+subobject as ``http://www.example.com/`` using this facility is below:
.. code-block:: apache
:linenos:
@@ -121,13 +116,12 @@ is below:
RequestHeader add X-Vhm-Root /cms
</VirtualHost>
-.. note:: Use of the ``RequestHeader`` directive requires that the
- Apache `mod_headers
- <http://httpd.apache.org/docs/2.2/mod/mod_headers.html>`_ module be
- available in the Apache environment you're using.
+.. note:: Use of the ``RequestHeader`` directive requires that the Apache
+ `mod_headers <http://httpd.apache.org/docs/2.2/mod/mod_headers.html>`_
+ module be available in the Apache environment you're using.
-For a :app:`Pyramid` application running under :term:`mod_wsgi`,
-the same can be achieved using ``SetEnv``:
+For a :app:`Pyramid` application running under :term:`mod_wsgi`, the same can
+be achieved using ``SetEnv``:
.. code-block:: apache
:linenos:
@@ -136,17 +130,16 @@ the same can be achieved using ``SetEnv``:
SetEnv HTTP_X_VHM_ROOT /cms
</Location>
-Setting a virtual root has no effect when using an application based
-on :term:`URL dispatch`.
+Setting a virtual root has no effect when using an application based on
+:term:`URL dispatch`.
Further Documentation and Examples
----------------------------------
The API documentation in :ref:`traversal_module` documents a
-:func:`pyramid.traversal.virtual_root` API. When called, it
-returns the virtual root object (or the physical root object if no
-virtual root has been specified).
-
-:ref:`modwsgi_tutorial` has detailed information about using
-:term:`mod_wsgi` to serve :app:`Pyramid` applications.
+:func:`pyramid.traversal.virtual_root` API. When called, it returns the
+virtual root object (or the physical root object if no virtual root has been
+specified).
+:ref:`modwsgi_tutorial` has detailed information about using :term:`mod_wsgi`
+to serve :app:`Pyramid` applications.
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst
index a0feef8d7..0bd52b6e2 100644
--- a/docs/narr/viewconfig.rst
+++ b/docs/narr/viewconfig.rst
@@ -10,8 +10,8 @@ View Configuration
.. index::
single: view lookup
-:term:`View lookup` is the :app:`Pyramid` subsystem responsible for finding
-and invoking a :term:`view callable`. :term:`View configuration` controls how
+:term:`View lookup` is the :app:`Pyramid` subsystem responsible for finding and
+invoking a :term:`view callable`. :term:`View configuration` controls how
:term:`view lookup` operates in your application. During any given request,
view configuration information is compared against request data by the view
lookup subsystem in order to find the "best" view callable for that request.
@@ -30,8 +30,8 @@ Mapping a Resource or URL Pattern to a View Callable
A developer makes a :term:`view callable` available for use within a
:app:`Pyramid` application via :term:`view configuration`. A view
configuration associates a view callable with a set of statements that
-determine the set of circumstances which must be true for the view callable
-to be invoked.
+determine the set of circumstances which must be true for the view callable to
+be invoked.
A view configuration statement is made about information present in the
:term:`context` resource and the :term:`request`.
@@ -56,35 +56,34 @@ View Configuration Parameters
All forms of view configuration accept the same general types of arguments.
Many arguments supplied during view configuration are :term:`view predicate`
-arguments. View predicate arguments used during view configuration are used
-to narrow the set of circumstances in which :term:`view lookup` will find a
+arguments. View predicate arguments used during view configuration are used to
+narrow the set of circumstances in which :term:`view lookup` will find a
particular view callable.
:term:`View predicate` attributes are an important part of view configuration
that enables the :term:`view lookup` subsystem to find and invoke the
-appropriate view. The greater the number of predicate attributes possessed by a
-view's configuration, the more specific the circumstances need to be before
-the registered view callable will be invoked. The fewer the number of predicates
-which are supplied to a particular view configuration, the more likely it is
-that the associated view callable will be invoked. A view with five
-predicates will always be found and evaluated before a view with two, for
+appropriate view. The greater the number of predicate attributes possessed by
+a view's configuration, the more specific the circumstances need to be before
+the registered view callable will be invoked. The fewer the number of
+predicates which are supplied to a particular view configuration, the more
+likely it is that the associated view callable will be invoked. A view with
+five predicates will always be found and evaluated before a view with two, for
example.
-This does not mean however, that :app:`Pyramid` "stops looking" when it
-finds a view registration with predicates that don't match. If one set
-of view predicates does not match, the "next most specific" view (if
-any) is consulted for predicates, and so on, until a view is found, or
-no view can be matched up with the request. The first view with a set
-of predicates all of which match the request environment will be
-invoked.
+This does not mean however, that :app:`Pyramid` "stops looking" when it finds a
+view registration with predicates that don't match. If one set of view
+predicates does not match, the "next most specific" view (if any) is consulted
+for predicates, and so on, until a view is found, or no view can be matched up
+with the request. The first view with a set of predicates all of which match
+the request environment will be invoked.
If no view can be found with predicates which allow it to be matched up with
the request, :app:`Pyramid` will return an error to the user's browser,
representing a "not found" (404) page. See :ref:`changing_the_notfound_view`
for more information about changing the default :term:`Not Found View`.
-Other view configuration arguments are non-predicate arguments. These tend
-to modify the response of the view callable or prevent the view callable from
+Other view configuration arguments are non-predicate arguments. These tend to
+modify the response of the view callable or prevent the view callable from
being invoked due to an authorization policy. The presence of non-predicate
arguments in a view configuration does not narrow the circumstances in which
the view callable will be invoked.
@@ -96,56 +95,55 @@ Non-Predicate Arguments
``permission``
The name of a :term:`permission` that the user must possess in order to
- invoke the :term:`view callable`. See :ref:`view_security_section` for
- more information about view security and permissions.
+ invoke the :term:`view callable`. See :ref:`view_security_section` for more
+ information about view security and permissions.
- If ``permission`` is not supplied, no permission is registered for this
- view (it's accessible by any caller).
+ If ``permission`` is not supplied, no permission is registered for this view
+ (it's accessible by any caller).
``attr``
The view machinery defaults to using the ``__call__`` method of the
:term:`view callable` (or the function itself, if the view callable is a
function) to obtain a response. The ``attr`` value allows you to vary the
- method attribute used to obtain the response. For example, if your view
- was a class, and the class has a method named ``index`` and you wanted to
- use this method instead of the class' ``__call__`` method to return the
- response, you'd say ``attr="index"`` in the view configuration for the
- view. This is most useful when the view definition is a class.
+ method attribute used to obtain the response. For example, if your view was
+ a class, and the class has a method named ``index`` and you wanted to use
+ this method instead of the class's ``__call__`` method to return the
+ response, you'd say ``attr="index"`` in the view configuration for the view.
+ This is most useful when the view definition is a class.
If ``attr`` is not supplied, ``None`` is used (implying the function itself
- if the view is a function, or the ``__call__`` callable attribute if the
- view is a class).
+ if the view is a function, or the ``__call__`` callable attribute if the view
+ is a class).
``renderer``
- Denotes the :term:`renderer` implementation which will be used to construct
- a :term:`response` from the associated view callable's return value.
-
+ Denotes the :term:`renderer` implementation which will be used to construct a
+ :term:`response` from the associated view callable's return value.
+
.. seealso:: See also :ref:`renderers_chapter`.
- This is either a single string term (e.g. ``json``) or a string implying a
- path or :term:`asset specification` (e.g. ``templates/views.pt``) naming a
- :term:`renderer` implementation. If the ``renderer`` value does not
- contain a dot (``.``), the specified string will be used to look up a
- renderer implementation, and that renderer implementation will be used to
- construct a response from the view return value. If the ``renderer`` value
- contains a dot (``.``), the specified term will be treated as a path, and
- the filename extension of the last element in the path will be used to look
- up the renderer implementation, which will be passed the full path.
-
- When the renderer is a path, although a path is usually just a simple
- relative pathname (e.g. ``templates/foo.pt``, implying that a template
- named "foo.pt" is in the "templates" directory relative to the directory of
- the current :term:`package`), a path can be absolute, starting with a slash
- on UNIX or a drive letter prefix on Windows. The path can alternately be a
- :term:`asset specification` in the form
- ``some.dotted.package_name:relative/path``, making it possible to address
- template assets which live in a separate package.
+ This is either a single string term (e.g., ``json``) or a string implying a
+ path or :term:`asset specification` (e.g., ``templates/views.pt``) naming a
+ :term:`renderer` implementation. If the ``renderer`` value does not contain
+ a dot (``.``), the specified string will be used to look up a renderer
+ implementation, and that renderer implementation will be used to construct a
+ response from the view return value. If the ``renderer`` value contains a
+ dot (``.``), the specified term will be treated as a path, and the filename
+ extension of the last element in the path will be used to look up the
+ renderer implementation, which will be passed the full path.
+
+ When the renderer is a path—although a path is usually just a simple relative
+ pathname (e.g., ``templates/foo.pt``, implying that a template named "foo.pt"
+ is in the "templates" directory relative to the directory of the current
+ :term:`package`)—the path can be absolute, starting with a slash on UNIX or a
+ drive letter prefix on Windows. The path can alternatively be a :term:`asset
+ specification` in the form ``some.dotted.package_name:relative/path``, making
+ it possible to address template assets which live in a separate package.
The ``renderer`` attribute is optional. If it is not defined, the "null"
renderer is assumed (no rendering is performed and the value is passed back
- to the upstream :app:`Pyramid` machinery unchanged). Note that if the
- view callable itself returns a :term:`response` (see :ref:`the_response`),
- the specified renderer implementation is never called.
+ to the upstream :app:`Pyramid` machinery unchanged). Note that if the view
+ callable itself returns a :term:`response` (see :ref:`the_response`), the
+ specified renderer implementation is never called.
``http_cache``
When you supply an ``http_cache`` value to a view configuration, the
@@ -153,38 +151,36 @@ Non-Predicate Arguments
associated view callable are modified. The value for ``http_cache`` may be
one of the following:
- - A nonzero integer. If it's a nonzero integer, it's treated as a number
- of seconds. This number of seconds will be used to compute the
- ``Expires`` header and the ``Cache-Control: max-age`` parameter of
- responses to requests which call this view. For example:
- ``http_cache=3600`` instructs the requesting browser to 'cache this
- response for an hour, please'.
+ - A nonzero integer. If it's a nonzero integer, it's treated as a number of
+ seconds. This number of seconds will be used to compute the ``Expires``
+ header and the ``Cache-Control: max-age`` parameter of responses to
+ requests which call this view. For example: ``http_cache=3600`` instructs
+ the requesting browser to 'cache this response for an hour, please'.
- A ``datetime.timedelta`` instance. If it's a ``datetime.timedelta``
- instance, it will be converted into a number of seconds, and that number
- of seconds will be used to compute the ``Expires`` header and the
+ instance, it will be converted into a number of seconds, and that number of
+ seconds will be used to compute the ``Expires`` header and the
``Cache-Control: max-age`` parameter of responses to requests which call
this view. For example: ``http_cache=datetime.timedelta(days=1)``
instructs the requesting browser to 'cache this response for a day,
please'.
- - Zero (``0``). If the value is zero, the ``Cache-Control`` and
- ``Expires`` headers present in all responses from this view will be
- composed such that client browser cache (and any intermediate caches) are
- instructed to never cache the response.
-
- - A two-tuple. If it's a two tuple (e.g. ``http_cache=(1,
- {'public':True})``), the first value in the tuple may be a nonzero
- integer or a ``datetime.timedelta`` instance; in either case this value
- will be used as the number of seconds to cache the response. The second
- value in the tuple must be a dictionary. The values present in the
- dictionary will be used as input to the ``Cache-Control`` response
- header. For example: ``http_cache=(3600, {'public':True})`` means 'cache
- for an hour, and add ``public`` to the Cache-Control header of the
- response'. All keys and values supported by the
- ``webob.cachecontrol.CacheControl`` interface may be added to the
- dictionary. Supplying ``{'public':True}`` is equivalent to calling
- ``response.cache_control.public = True``.
+ - Zero (``0``). If the value is zero, the ``Cache-Control`` and ``Expires``
+ headers present in all responses from this view will be composed such that
+ client browser cache (and any intermediate caches) are instructed to never
+ cache the response.
+
+ - A two-tuple. If it's a two-tuple (e.g., ``http_cache=(1,
+ {'public':True})``), the first value in the tuple may be a nonzero integer
+ or a ``datetime.timedelta`` instance. In either case this value will be
+ used as the number of seconds to cache the response. The second value in
+ the tuple must be a dictionary. The values present in the dictionary will
+ be used as input to the ``Cache-Control`` response header. For example:
+ ``http_cache=(3600, {'public':True})`` means 'cache for an hour, and add
+ ``public`` to the Cache-Control header of the response'. All keys and
+ values supported by the ``webob.cachecontrol.CacheControl`` interface may
+ be added to the dictionary. Supplying ``{'public':True}`` is equivalent to
+ calling ``response.cache_control.public = True``.
Providing a non-tuple value as ``http_cache`` is equivalent to calling
``response.cache_expires(value)`` within your view's body.
@@ -192,9 +188,9 @@ Non-Predicate Arguments
Providing a two-tuple value as ``http_cache`` is equivalent to calling
``response.cache_expires(value[0], **value[1])`` within your view's body.
- If you wish to avoid influencing, the ``Expires`` header, and instead wish
- to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache``
- with the first element of ``None``, e.g.: ``(None, {'public':True})``.
+ If you wish to avoid influencing the ``Expires`` header, and instead wish to
+ only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` with
+ the first element of ``None``, i.e., ``(None, {'public':True})``.
``wrapper``
The :term:`view name` of a different :term:`view configuration` which will
@@ -203,24 +199,24 @@ Non-Predicate Arguments
this view as the ``request.wrapped_response`` attribute of its own request.
Using a wrapper makes it possible to "chain" views together to form a
composite response. The response of the outermost wrapper view will be
- returned to the user. The wrapper view will be found as any view is found:
- see :ref:`view_lookup`. The "best" wrapper view will be found based on the
- lookup ordering: "under the hood" this wrapper view is looked up via
+ returned to the user. The wrapper view will be found as any view is found.
+ See :ref:`view_lookup`. The "best" wrapper view will be found based on the
+ lookup ordering. "Under the hood" this wrapper view is looked up via
``pyramid.view.render_view_to_response(context, request,
- 'wrapper_viewname')``. The context and request of a wrapper view is the
- same context and request of the inner view.
+ 'wrapper_viewname')``. The context and request of a wrapper view is the same
+ context and request of the inner view.
If ``wrapper`` is not supplied, no wrapper view is used.
``decorator``
A :term:`dotted Python name` to a function (or the function itself) which
- will be used to decorate the registered :term:`view callable`. The
- decorator function will be called with the view callable as a single
- argument. The view callable it is passed will accept ``(context,
- request)``. The decorator must return a replacement view callable which
- also accepts ``(context, request)``. The ``decorator`` may also be an
- iterable of decorators, in which case they will be applied one after the
- other to the view, in reverse order. For example::
+ will be used to decorate the registered :term:`view callable`. The decorator
+ function will be called with the view callable as a single argument. The
+ view callable it is passed will accept ``(context, request)``. The decorator
+ must return a replacement view callable which also accepts ``(context,
+ request)``. The ``decorator`` may also be an iterable of decorators, in which
+ case they will be applied one after the other to the view, in reverse order.
+ For example::
@view_config(..., decorator=(decorator2, decorator1))
def myview(request):
@@ -234,37 +230,51 @@ 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
view should use the default view mapper. This plug-point is useful for
- Pyramid extension developers, but it's not very useful for 'civilians' who
+ Pyramid extension developers, but it's not very useful for "civilians" who
are just developing stock Pyramid applications. Pay no attention to the man
behind the curtain.
Predicate Arguments
+++++++++++++++++++
-These arguments modify view lookup behavior. In general, the more predicate
-arguments that are supplied, the more specific, and narrower the usage of the
+These arguments modify view lookup behavior. In general the more predicate
+arguments that are supplied, the more specific and narrower the usage of the
configured view.
``name``
The :term:`view name` required to match this view callable. A ``name``
- argument is typically only used when your application uses
- :term:`traversal`. Read :ref:`traversal_chapter` to understand the concept
- of a view name.
+ argument is typically only used when your application uses :term:`traversal`.
+ Read :ref:`traversal_chapter` to understand the concept of a view name.
If ``name`` is not supplied, the empty string is used (implying the default
view).
``context``
- An object representing a Python class that the :term:`context` resource
- must be an instance of *or* the :term:`interface` that the :term:`context`
+ An object representing a Python class of which the :term:`context` resource
+ must be an instance *or* the :term:`interface` that the :term:`context`
resource must provide in order for this view to be found and called. This
predicate is true when the :term:`context` resource is an instance of the
- represented class or if the :term:`context` resource provides the
- represented interface; it is otherwise false.
+ represented class or if the :term:`context` resource provides the represented
+ interface; it is otherwise false.
If ``context`` is not supplied, the value ``None``, which matches any
resource, is used.
@@ -274,67 +284,67 @@ configured view.
the named route has matched.
This value must match the ``name`` of a :term:`route configuration`
- declaration (see :ref:`urldispatch_chapter`) that must match before this
- view will be called. Note that the ``route`` configuration referred to by
+ declaration (see :ref:`urldispatch_chapter`) that must match before this view
+ will be called. Note that the ``route`` configuration referred to by
``route_name`` will usually have a ``*traverse`` token in the value of its
``pattern``, representing a part of the path that will be used by
:term:`traversal` against the result of the route's :term:`root factory`.
If ``route_name`` is not supplied, the view callable will only have a chance
of being invoked if no other route was matched. This is when the
- request/context pair found via :term:`resource location` does not indicate
- it matched any configured route.
+ request/context pair found via :term:`resource location` does not indicate it
+ matched any configured route.
``request_type``
This value should be an :term:`interface` that the :term:`request` must
provide in order for this view to be found and called.
- If ``request_type`` is not supplied, the value ``None`` is used, implying
- any request type.
+ If ``request_type`` is not supplied, the value ``None`` is used, implying any
+ request type.
*This is an advanced feature, not often used by "civilians"*.
``request_method``
This value can be either a string (such as ``"GET"``, ``"POST"``,
- ``"PUT"``, ``"DELETE"``, ``"HEAD"`` or ``"OPTIONS"``) representing an
- HTTP ``REQUEST_METHOD``, or a tuple containing one or more of these
- strings. A view declaration with this argument ensures that the
- view will only be called when the ``method`` attribute of the
- request (aka the ``REQUEST_METHOD`` of the WSGI environment) matches
- a supplied value. Note that use of ``"GET"`` also implies that the
- view will respond to ``"HEAD"`` as of Pyramid 1.4.
+ ``"PUT"``, ``"DELETE"``, ``"HEAD"``, or ``"OPTIONS"``) representing an HTTP
+ ``REQUEST_METHOD`` or a tuple containing one or more of these strings. A
+ view declaration with this argument ensures that the view will only be called
+ when the ``method`` attribute of the request (i.e., the ``REQUEST_METHOD`` of
+ the WSGI environment) matches a supplied value.
+
+ .. versionchanged:: 1.4
+ The use of ``"GET"`` also implies that the view will respond to ``"HEAD"``.
- If ``request_method`` is not supplied, the view will be invoked regardless
- of the ``REQUEST_METHOD`` of the :term:`WSGI` environment.
+ If ``request_method`` is not supplied, the view will be invoked regardless of
+ the ``REQUEST_METHOD`` of the :term:`WSGI` environment.
``request_param``
This value can be any string or a sequence of strings. A view declaration
with this argument ensures that the view will only be called when the
:term:`request` has a key in the ``request.params`` dictionary (an HTTP
- ``GET`` or ``POST`` variable) that has a name which matches the
- supplied value.
+ ``GET`` or ``POST`` variable) that has a name which matches the supplied
+ value.
- If any value supplied has a ``=`` sign in it,
- e.g. ``request_param="foo=123"``, then the key (``foo``) must both exist
- in the ``request.params`` dictionary, *and* the value must match the right
- hand side of the expression (``123``) for the view to "match" the current
- request.
+ If any value supplied has an ``=`` sign in it, e.g.,
+ ``request_param="foo=123"``, then the key (``foo``) must both exist in the
+ ``request.params`` dictionary, *and* the value must match the right hand side
+ of the expression (``123``) for the view to "match" the current request.
If ``request_param`` is not supplied, the view will be invoked without
consideration of keys and values in the ``request.params`` dictionary.
``match_param``
- This param may be either a single string of the format "key=value" or a
- dict of key/value pairs.
+ This param may be either a single string of the format "key=value" or a tuple
+ containing one or more of these strings.
This argument ensures that the view will only be called when the
- :term:`request` has key/value pairs in its :term:`matchdict` that equal
- those supplied in the predicate. e.g. ``match_param="action=edit"`` would
+ :term:`request` has key/value pairs in its :term:`matchdict` that equal those
+ supplied in the predicate. For example, ``match_param="action=edit"`` would
require the ``action`` parameter in the :term:`matchdict` match the right
hand side of the expression (``edit``) for the view to "match" the current
request.
- If the ``match_param`` is a dict, every key/value pair must match for the
+ If the ``match_param`` is a tuple, every key/value pair must match for the
predicate to pass.
If ``match_param`` is not supplied, the view will be invoked without
@@ -343,41 +353,40 @@ configured view.
.. versionadded:: 1.2
``containment``
- This value should be a reference to a Python class or :term:`interface`
- that a parent object in the context resource's :term:`lineage` must provide
- in order for this view to be found and called. The resources in your
- resource tree must be "location-aware" to use this feature.
+ This value should be a reference to a Python class or :term:`interface` that
+ a parent object in the context resource's :term:`lineage` must provide in
+ order for this view to be found and called. The resources in your resource
+ tree must be "location-aware" to use this feature.
- If ``containment`` is not supplied, the interfaces and classes in the
- lineage are not considered when deciding whether or not to invoke the view
- callable.
+ If ``containment`` is not supplied, the interfaces and classes in the lineage
+ are not considered when deciding whether or not to invoke the view callable.
See :ref:`location_aware` for more information about location-awareness.
``xhr``
This value should be either ``True`` or ``False``. If this value is
specified and is ``True``, the :term:`WSGI` environment must possess an
- ``HTTP_X_REQUESTED_WITH`` (aka ``X-Requested-With``) header that has the
+ ``HTTP_X_REQUESTED_WITH`` header (i.e., ``X-Requested-With``) that has the
value ``XMLHttpRequest`` for the associated view callable to be found and
called. This is useful for detecting AJAX requests issued from jQuery,
- Prototype and other Javascript libraries.
+ Prototype, and other Javascript libraries.
- If ``xhr`` is not specified, the ``HTTP_X_REQUESTED_WITH`` HTTP header is
- not taken into consideration when deciding whether or not to invoke the
+ If ``xhr`` is not specified, the ``HTTP_X_REQUESTED_WITH`` HTTP header is not
+ taken into consideration when deciding whether or not to invoke the
associated view callable.
``accept``
- The value of this argument represents a match query for one or more
- mimetypes in the ``Accept`` HTTP request header. If this value is
- specified, it must be in one of the following forms: a mimetype match token
- in the form ``text/plain``, a wildcard mimetype match token in the form
- ``text/*`` or a match-all wildcard mimetype match token in the form
- ``*/*``. If any of the forms matches the ``Accept`` header of the request,
- this predicate will be true.
-
- If ``accept`` is not specified, the ``HTTP_ACCEPT`` HTTP header is not
- taken into consideration when deciding whether or not to invoke the
- associated view callable.
+ The value of this argument represents a match query for one or more mimetypes
+ in the ``Accept`` HTTP request header. If this value is specified, it must
+ be in one of the following forms: a mimetype match token in the form
+ ``text/plain``, a wildcard mimetype match token in the form ``text/*``, or a
+ match-all wildcard mimetype match token in the form ``*/*``. If any of the
+ forms matches the ``Accept`` header of the request, this predicate will be
+ true.
+
+ If ``accept`` is not specified, the ``HTTP_ACCEPT`` HTTP header is not taken
+ into consideration when deciding whether or not to invoke the associated view
+ callable.
``header``
This value represents an HTTP header name or a header name/value pair.
@@ -385,94 +394,92 @@ configured view.
If ``header`` is specified, it must be a header name or a
``headername:headervalue`` pair.
- If ``header`` is specified without a value (a bare header name only,
- e.g. ``If-Modified-Since``), the view will only be invoked if the HTTP
- header exists with any value in the request.
+ If ``header`` is specified without a value (a bare header name only, e.g.,
+ ``If-Modified-Since``), the view will only be invoked if the HTTP header
+ exists with any value in the request.
- If ``header`` is specified, and possesses a name/value pair
- (e.g. ``User-Agent:Mozilla/.*``), the view will only be invoked if the HTTP
- header exists *and* the HTTP header matches the value requested. When the
- ``headervalue`` contains a ``:`` (colon), it will be considered a
- name/value pair (e.g. ``User-Agent:Mozilla/.*`` or ``Host:localhost``).
- The value portion should be a regular expression.
+ If ``header`` is specified, and possesses a name/value pair (e.g.,
+ ``User-Agent:Mozilla/.*``), the view will only be invoked if the HTTP header
+ exists *and* the HTTP header matches the value requested. When the
+ ``headervalue`` contains a ``:`` (colon), it will be considered a name/value
+ pair (e.g., ``User-Agent:Mozilla/.*`` or ``Host:localhost``). The value
+ portion should be a regular expression.
Whether or not the value represents a header name or a header name/value
pair, the case of the header name is not significant.
- If ``header`` is not specified, the composition, presence or absence of
- HTTP headers is not taken into consideration when deciding whether or not
- to invoke the associated view callable.
+ If ``header`` is not specified, the composition, presence, or absence of HTTP
+ headers is not taken into consideration when deciding whether or not to
+ invoke the associated view callable.
``path_info``
This value represents a regular expression pattern that will be tested
- against the ``PATH_INFO`` WSGI environment variable to decide whether or
- not to call the associated view callable. If the regex matches, this
- predicate will be ``True``.
+ against the ``PATH_INFO`` WSGI environment variable to decide whether or not
+ to call the associated view callable. If the regex matches, this predicate
+ will be ``True``.
If ``path_info`` is not specified, the WSGI ``PATH_INFO`` is not taken into
consideration when deciding whether or not to invoke the associated view
callable.
``check_csrf``
- If specified, this value should be one of ``None``, ``True``, ``False``, or
- a string representing the 'check name'. If the value is ``True`` or a
- string, CSRF checking will be performed. If the value is ``False`` or
- ``None``, CSRF checking will not be performed.
+ If specified, this value should be one of ``None``, ``True``, ``False``, or a
+ string representing the "check name". If the value is ``True`` or a string,
+ CSRF checking will be performed. If the value is ``False`` or ``None``, CSRF
+ checking will not be performed.
- If the value provided is a string, that string will be used as the 'check
- name'. If the value provided is ``True``, ``csrf_token`` will be used as
- the check name.
+ If the value provided is a string, that string will be used as the "check
+ name". If the value provided is ``True``, ``csrf_token`` will be used as the
+ check name.
If CSRF checking is performed, the checked value will be the value of
``request.params[check_name]``. This value will be compared against the
value of ``request.session.get_csrf_token()``, and the check will pass if
- these two values are the same. If the check passes, the associated view
- will be permitted to execute. If the check fails, the associated view
- will not be permitted to execute.
+ these two values are the same. If the check passes, the associated view will
+ be permitted to execute. If the check fails, the associated view will not be
+ permitted to execute.
- Note that using this feature requires a :term:`session factory` to have
- been configured.
+ Note that using this feature requires a :term:`session factory` to have been
+ configured.
.. versionadded:: 1.4a2
``physical_path``
If specified, this value should be a string or a tuple representing the
:term:`physical path` of the context found via traversal for this predicate
- to match as true. For example: ``physical_path='/'`` or
- ``physical_path='/a/b/c'`` or ``physical_path=('', 'a', 'b', 'c')``. This is
- not a path prefix match or a regex, it's a whole-path match. It's useful
+ to match as true. For example, ``physical_path='/'``,
+ ``physical_path='/a/b/c'``, or ``physical_path=('', 'a', 'b', 'c')``. This
+ is not a path prefix match or a regex, but a whole-path match. It's useful
when you want to always potentially show a view when some object is traversed
to, but you can't be sure about what kind of object it will be, so you can't
- use the ``context`` predicate. The individual path elements inbetween slash
+ use the ``context`` predicate. The individual path elements between slash
characters or in tuple elements should be the Unicode representation of the
name of the resource and should not be encoded in any way.
.. versionadded:: 1.4a3
``effective_principals``
-
If specified, this value should be a :term:`principal` identifier or a
sequence of principal identifiers. If the
- :meth:`pyramid.request.Request.effective_principals` method indicates that every
- principal named in the argument list is present in the current request, this
- predicate will return True; otherwise it will return False. For example:
- ``effective_principals=pyramid.security.Authenticated`` or
+ :meth:`pyramid.request.Request.effective_principals` method indicates that
+ every principal named in the argument list is present in the current request,
+ this predicate will return True; otherwise it will return False. For
+ example: ``effective_principals=pyramid.security.Authenticated`` or
``effective_principals=('fred', 'group:admins')``.
.. versionadded:: 1.4a4
``custom_predicates``
- If ``custom_predicates`` is specified, it must be a sequence of references
- to custom predicate callables. Use custom predicates when no set of
- predefined predicates do 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 ``False`` after doing arbitrary evaluation of the
- context resource and/or the request. If all callables return ``True``, the
+ If ``custom_predicates`` is specified, it must be a sequence of references to
+ custom predicate callables. Use custom predicates when no set of predefined
+ predicates do 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 ``False`` after doing arbitrary evaluation of the context
+ resource and/or the request. If all callables return ``True``, the
associated view callable will be considered viable for a given request.
- If ``custom_predicates`` is not specified, no custom predicates are
- used.
+ If ``custom_predicates`` is not specified, no custom predicates are used.
``predicates``
Pass a key/value pair here to use a third-party predicate registered via
@@ -500,8 +507,8 @@ You can invert the meaning of any predicate value by wrapping it in a call to
request_method=not_('POST')
)
-The above example will ensure that the view is called if the request method
-is *not* ``POST``, at least if no other view is more specific.
+The above example will ensure that the view is called if the request method is
+*not* ``POST``, at least if no other view is more specific.
This technique of wrapping a predicate value in ``not_`` can be used anywhere
predicate values are accepted:
@@ -523,11 +530,11 @@ Adding View Configuration Using the ``@view_config`` Decorator
.. warning::
- Using this feature tends to slow down application startup slightly, as
- more work is performed at application startup to scan for view
- configuration declarations. For maximum startup performance, use the view
- configuration method described in
- :ref:`mapping_views_using_imperative_config_section` instead.
+ Using this feature tends to slow down application startup slightly, as more
+ work is performed at application startup to scan for view configuration
+ declarations. For maximum startup performance, use the view configuration
+ method described in :ref:`mapping_views_using_imperative_config_section`
+ instead.
The :class:`~pyramid.view.view_config` decorator can be used to associate
:term:`view configuration` information with a function, method, or class that
@@ -577,9 +584,8 @@ request method, request type, request param, route name, or containment.
The mere existence of a ``@view_config`` decorator doesn't suffice to perform
view configuration. All that the decorator does is "annotate" the function
with your configuration declarations, it doesn't process them. To make
-:app:`Pyramid` process your :class:`pyramid.view.view_config` declarations,
-you *must* use the ``scan`` method of a
-:class:`pyramid.config.Configurator`:
+:app:`Pyramid` process your :class:`pyramid.view.view_config` declarations, you
+*must* use the ``scan`` method of a :class:`pyramid.config.Configurator`:
.. code-block:: python
:linenos:
@@ -588,9 +594,9 @@ you *must* use the ``scan`` method of a
# pyramid.config.Configurator class
config.scan()
-Please see :ref:`decorations_and_code_scanning` for detailed information
-about what happens when code is scanned for configuration declarations
-resulting from use of decorators like :class:`~pyramid.view.view_config`.
+Please see :ref:`decorations_and_code_scanning` for detailed information about
+what happens when code is scanned for configuration declarations resulting from
+use of decorators like :class:`~pyramid.view.view_config`.
See :ref:`configuration_module` for additional API arguments to the
:meth:`~pyramid.config.Configurator.scan` method. For example, the method
@@ -598,10 +604,10 @@ allows you to supply a ``package`` argument to better control exactly *which*
code will be scanned.
All arguments to the :class:`~pyramid.view.view_config` decorator mean
-precisely the same thing as they would if they were passed as arguments to
-the :meth:`pyramid.config.Configurator.add_view` method save for the ``view``
-argument. Usage of the :class:`~pyramid.view.view_config` decorator is a
-form of :term:`declarative configuration`, while
+precisely the same thing as they would if they were passed as arguments to the
+:meth:`pyramid.config.Configurator.add_view` method save for the ``view``
+argument. Usage of the :class:`~pyramid.view.view_config` decorator is a form
+of :term:`declarative configuration`, while
:meth:`pyramid.config.Configurator.add_view` is a form of :term:`imperative
configuration`. However, they both do the same thing.
@@ -629,8 +635,8 @@ If your view callable is a function, it may be used as a function decorator:
return Response('edited!')
If your view callable is a class, the decorator can also be used as a class
-decorator. All the arguments to the decorator are the same when applied
-against a class as when they are applied against a function. For example:
+decorator. All the arguments to the decorator are the same when applied against
+a class as when they are applied against a function. For example:
.. code-block:: python
:linenos:
@@ -681,15 +687,15 @@ The decorator can also be used against a method of a class:
When the decorator is used against a method of a class, a view is registered
for the *class*, so the class constructor must accept an argument list in one
-of two forms: either it must accept a single argument ``request`` or it must
-accept two arguments, ``context, request``.
+of two forms: either a single argument, ``request``, or two arguments,
+``context, request``.
The method which is decorated must return a :term:`response`.
Using the decorator against a particular method of a class is equivalent to
-using the ``attr`` parameter in a decorator attached to the class itself.
-For example, the above registration implied by the decorator being used
-against the ``amethod`` method could be spelled equivalently as the below:
+using the ``attr`` parameter in a decorator attached to the class itself. For
+example, the above registration implied by the decorator being used against the
+``amethod`` method could be written equivalently as follows:
.. code-block:: python
:linenos:
@@ -715,9 +721,9 @@ Adding View Configuration Using :meth:`~pyramid.config.Configurator.add_view`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The :meth:`pyramid.config.Configurator.add_view` method within
-:ref:`configuration_module` is used to configure a view "imperatively"
-(without a :class:`~pyramid.view.view_config` decorator). The arguments to
-this method are very similar to the arguments that you provide to the
+:ref:`configuration_module` is used to configure a view "imperatively" (without
+a :class:`~pyramid.view.view_config` decorator). The arguments to this method
+are very similar to the arguments that you provide to the
:class:`~pyramid.view.view_config` decorator. For example:
.. code-block:: python
@@ -732,10 +738,10 @@ this method are very similar to the arguments that you provide to the
# pyramid.config.Configurator class
config.add_view(hello_world, route_name='hello')
-The first argument, a :term:`view callable`, is the only required argument.
-It must either be a Python object which is the view itself or a
-:term:`dotted Python name` to such an object.
-In the above example, the ``view callable`` is the ``hello_world`` function.
+The first argument, a :term:`view callable`, is the only required argument. It
+must either be a Python object which is the view itself or a :term:`dotted
+Python name` to such an object. In the above example, the ``view callable`` is
+the ``hello_world`` function.
When you use only :meth:`~pyramid.config.Configurator.add_view` to add view
configurations, you don't need to issue a :term:`scan` in order for the view
@@ -757,7 +763,7 @@ defaults to the view configuration information used by every ``@view_config``
decorator that decorates a method of that class.
For instance, if you've got a class that has methods that represent "REST
-actions", all which are mapped to the same route, but different request
+actions", all of which are mapped to the same route but different request
methods, instead of this:
.. code-block:: python
@@ -809,17 +815,17 @@ You can do this:
return Response('delete')
In the above example, we were able to take the ``route_name='rest'`` argument
-out of the call to each individual ``@view_config`` statement, because we
-used a ``@view_defaults`` class decorator to provide the argument as a
-default to each view method it possessed.
+out of the call to each individual ``@view_config`` statement because we used a
+``@view_defaults`` class decorator to provide the argument as a default to each
+view method it possessed.
Arguments passed to ``@view_config`` will override any default passed to
``@view_defaults``.
The ``view_defaults`` class decorator can also provide defaults to the
:meth:`pyramid.config.Configurator.add_view` directive when a decorated class
-is passed to that directive as its ``view`` argument. For example, instead
-of this:
+is passed to that directive as its ``view`` argument. For example, instead of
+this:
.. code-block:: python
:linenos:
@@ -853,7 +859,7 @@ of this:
To reduce the amount of repetition in the ``config.add_view`` statements, we
can move the ``route_name='rest'`` argument to a ``@view_defaults`` class
-decorator on the RESTView class:
+decorator on the ``RESTView`` class:
.. code-block:: python
:linenos:
@@ -889,8 +895,8 @@ decorator on the RESTView class:
argument passed to ``view_defaults`` provides a default for the view
configurations of methods of the class it's decorating.
-Normal Python inheritance rules apply to defaults added via
-``view_defaults``. For example:
+Normal Python inheritance rules apply to defaults added via ``view_defaults``.
+For example:
.. code-block:: python
:linenos:
@@ -904,8 +910,8 @@ Normal Python inheritance rules apply to defaults added via
The ``Bar`` class above will inherit its view defaults from the arguments
passed to the ``view_defaults`` decorator of the ``Foo`` class. To prevent
-this from happening, use a ``view_defaults`` decorator without any arguments
-on the subclass:
+this from happening, use a ``view_defaults`` decorator without any arguments on
+the subclass:
.. code-block:: python
:linenos:
@@ -931,11 +937,11 @@ Configuring View Security
~~~~~~~~~~~~~~~~~~~~~~~~~
If an :term:`authorization policy` is active, any :term:`permission` attached
-to a :term:`view configuration` found during view lookup will be verified.
-This will ensure that the currently authenticated user possesses that
-permission against the :term:`context` resource before the view function is
-actually called. Here's an example of specifying a permission in a view
-configuration using :meth:`~pyramid.config.Configurator.add_view`:
+to a :term:`view configuration` found during view lookup will be verified. This
+will ensure that the currently authenticated user possesses that permission
+against the :term:`context` resource before the view function is actually
+called. Here's an example of specifying a permission in a view configuration
+using :meth:`~pyramid.config.Configurator.add_view`:
.. code-block:: python
:linenos:
@@ -949,8 +955,8 @@ configuration using :meth:`~pyramid.config.Configurator.add_view`:
When an :term:`authorization policy` is enabled, this view will be protected
with the ``add`` permission. The view will *not be called* if the user does
not possess the ``add`` permission relative to the current :term:`context`.
-Instead the :term:`forbidden view` result will be returned to the client as
-per :ref:`protecting_views`.
+Instead the :term:`forbidden view` result will be returned to the client as per
+:ref:`protecting_views`.
.. index::
single: debugging not found errors
@@ -961,14 +967,14 @@ per :ref:`protecting_views`.
:exc:`~pyramid.exceptions.NotFound` Errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-It's useful to be able to debug :exc:`~pyramid.exceptions.NotFound`
-error responses when they
-occur unexpectedly due to an application registry misconfiguration. To debug
-these errors, use the ``PYRAMID_DEBUG_NOTFOUND`` environment variable or the
-``pyramid.debug_notfound`` configuration file setting. Details of why a view
-was not 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.
+It's useful to be able to debug :exc:`~pyramid.exceptions.NotFound` error
+responses when they occur unexpectedly due to an application registry
+misconfiguration. To debug these errors, use the ``PYRAMID_DEBUG_NOTFOUND``
+environment variable or the ``pyramid.debug_notfound`` configuration file
+setting. Details of why a view was not 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::
single: HTTP caching
@@ -980,23 +986,23 @@ Influencing HTTP Caching
.. versionadded:: 1.1
-When a non-``None`` ``http_cache`` argument is passed to a view
-configuration, Pyramid will set ``Expires`` and ``Cache-Control`` response
-headers in the resulting response, causing browsers to cache the response
-data for some time. See ``http_cache`` in :ref:`nonpredicate_view_args` for
-the allowable values and what they mean.
-
-Sometimes it's undesirable to have these headers set as the result of
-returning a response from a view, even though you'd like to decorate the view
-with a view configuration decorator that has ``http_cache``. Perhaps there's
-an alternate branch in your view code that returns a response that should
-never be cacheable, while the "normal" branch returns something that should
-always be cacheable. If this is the case, set the ``prevent_auto`` attribute
-of the ``response.cache_control`` object to a non-``False`` value. For
-example, the below view callable is configured with a ``@view_config``
-decorator that indicates any response from the view should be cached for 3600
-seconds. However, the view itself prevents caching from taking place unless
-there's a ``should_cache`` GET or POST variable:
+When a non-``None`` ``http_cache`` argument is passed to a view configuration,
+Pyramid will set ``Expires`` and ``Cache-Control`` response headers in the
+resulting response, causing browsers to cache the response data for some time.
+See ``http_cache`` in :ref:`nonpredicate_view_args` for the allowable values
+and what they mean.
+
+Sometimes it's undesirable to have these headers set as the result of returning
+a response from a view, even though you'd like to decorate the view with a view
+configuration decorator that has ``http_cache``. Perhaps there's an
+alternative branch in your view code that returns a response that should never
+be cacheable, while the "normal" branch returns something that should always be
+cacheable. If this is the case, set the ``prevent_auto`` attribute of the
+``response.cache_control`` object to a non-``False`` value. For example, the
+below view callable is configured with a ``@view_config`` decorator that
+indicates any response from the view should be cached for 3600 seconds.
+However, the view itself prevents caching from taking place unless there's a
+``should_cache`` GET or POST variable:
.. code-block:: python
@@ -1005,23 +1011,23 @@ there's a ``should_cache`` GET or POST variable:
@view_config(http_cache=3600)
def view(request):
response = Response()
- if not 'should_cache' in request.params:
+ if 'should_cache' not in request.params:
response.cache_control.prevent_auto = True
return response
-Note that the ``http_cache`` machinery will overwrite or add to caching
-headers you set within the view itself unless you use ``prevent_auto``.
+Note that the ``http_cache`` machinery will overwrite or add to caching headers
+you set within the view itself, unless you use ``prevent_auto``.
-You can also turn off the effect of ``http_cache`` entirely for the duration
-of a Pyramid application lifetime. To do so, set the
+You can also turn off the effect of ``http_cache`` entirely for the duration of
+a Pyramid application lifetime. To do so, set the
``PYRAMID_PREVENT_HTTP_CACHE`` environment variable or the
-``pyramid.prevent_http_cache`` configuration value setting to a true value.
-For more information, see :ref:`preventing_http_caching`.
+``pyramid.prevent_http_cache`` configuration value setting to a true value. For
+more information, see :ref:`preventing_http_caching`.
Note that setting ``pyramid.prevent_http_cache`` will have no effect on caching
headers that your application code itself sets. It will only prevent caching
-headers that would have been set by the Pyramid HTTP caching machinery
-invoked as the result of the ``http_cache`` argument to view configuration.
+headers that would have been set by the Pyramid HTTP caching machinery invoked
+as the result of the ``http_cache`` argument to view configuration.
.. index::
pair: view configuration; debugging
diff --git a/docs/narr/views.rst b/docs/narr/views.rst
index a746eb043..770d27919 100644
--- a/docs/narr/views.rst
+++ b/docs/narr/views.rst
@@ -4,23 +4,22 @@ Views
=====
One of the primary jobs of :app:`Pyramid` is to find and invoke a :term:`view
-callable` when a :term:`request` reaches your application. View callables
-are bits of code which do something interesting in response to a request made
-to your application. They are the "meat" of any interesting web application.
+callable` when a :term:`request` reaches your application. View callables are
+bits of code which do something interesting in response to a request made to
+your application. They are the "meat" of any interesting web application.
-.. note::
+.. note::
A :app:`Pyramid` :term:`view callable` is often referred to in
- conversational shorthand as a :term:`view`. In this documentation,
- however, we need to use less ambiguous terminology because there
- are significant differences between view *configuration*, the code
- that implements a view *callable*, and the process of view
- *lookup*.
+ conversational shorthand as a :term:`view`. In this documentation, however,
+ we need to use less ambiguous terminology because there are significant
+ differences between view *configuration*, the code that implements a view
+ *callable*, and the process of view *lookup*.
-This chapter describes how view callables should be defined. We'll have to
-wait until a following chapter (entitled :ref:`view_config_chapter`) to find
-out how we actually tell :app:`Pyramid` to wire up view callables to
-particular URL patterns and other request circumstances.
+This chapter describes how view callables should be defined. We'll have to wait
+until a following chapter (entitled :ref:`view_config_chapter`) to find out how
+we actually tell :app:`Pyramid` to wire up view callables to particular URL
+patterns and other request circumstances.
.. index::
single: view callables
@@ -28,21 +27,21 @@ particular URL patterns and other request circumstances.
View Callables
--------------
-View callables are, at the risk of sounding obvious, callable Python
-objects. Specifically, view callables can be functions, classes, or instances
-that implement a ``__call__`` method (making the instance callable).
+View callables are, at the risk of sounding obvious, callable Python objects.
+Specifically, view callables can be functions, classes, or instances that
+implement a ``__call__`` method (making the instance callable).
-View callables must, at a minimum, accept a single argument named
-``request``. This argument represents a :app:`Pyramid` :term:`Request`
-object. A request object represents a :term:`WSGI` environment provided to
-:app:`Pyramid` by the upstream WSGI server. As you might expect, the request
-object contains everything your application needs to know about the specific
-HTTP request being made.
+View callables must, at a minimum, accept a single argument named ``request``.
+This argument represents a :app:`Pyramid` :term:`Request` object. A request
+object represents a :term:`WSGI` environment provided to :app:`Pyramid` by the
+upstream WSGI server. As you might expect, the request object contains
+everything your application needs to know about the specific HTTP request being
+made.
A view callable's ultimate responsibility is to create a :app:`Pyramid`
-:term:`Response` object. This can be done by creating a :term:`Response`
-object in the view callable code and returning it directly or by raising
-special kinds of exceptions from within the body of a view callable.
+:term:`Response` object. This can be done by creating a :term:`Response` object
+in the view callable code and returning it directly or by raising special kinds
+of exceptions from within the body of a view callable.
.. index::
single: view calling convention
@@ -76,17 +75,17 @@ Defining a View Callable as a Class
-----------------------------------
A view callable may also be represented by a Python class instead of a
-function. When a view callable is a class, the calling semantics are
-slightly different than when it is a function or another non-class callable.
-When a view callable is a class, the class' ``__init__`` method is called with a
+function. When a view callable is a class, the calling semantics are slightly
+different than when it is a function or another non-class callable. When a view
+callable is a class, the class's ``__init__`` method is called with a
``request`` parameter. As a result, an instance of the class is created.
Subsequently, that instance's ``__call__`` method is invoked with no
-parameters. Views defined as classes must have the following traits:
+parameters. Views defined as classes must have the following traits.
-- an ``__init__`` method that accepts a ``request`` argument.
+- an ``__init__`` method that accepts a ``request`` argument
-- a ``__call__`` (or other) method that accepts no parameters and which
- returns a response.
+- a ``__call__`` (or other) method that accepts no parameters and which returns
+ a response
For example:
@@ -106,12 +105,12 @@ The request object passed to ``__init__`` is the same type of request object
described in :ref:`function_as_view`.
If you'd like to use a different attribute than ``__call__`` to represent the
-method expected to return a response, you can use an ``attr`` value as part
-of the configuration for the view. See :ref:`view_configuration_parameters`.
-The same view callable class can be used in different view configuration
-statements with different ``attr`` values, each pointing at a different
-method of the class if you'd like the class to represent a collection of
-related view callables.
+method expected to return a response, you can use an ``attr`` value as part of
+the configuration for the view. See :ref:`view_configuration_parameters`. The
+same view callable class can be used in different view configuration statements
+with different ``attr`` values, each pointing at a different method of the
+class if you'd like the class to represent a collection of related view
+callables.
.. index::
single: view response
@@ -135,11 +134,11 @@ implements the :term:`Response` interface is to return a
def view(request):
return Response('OK')
-:app:`Pyramid` provides a range of different "exception" classes which
-inherit from :class:`pyramid.response.Response`. For example, an instance of
-the class :class:`pyramid.httpexceptions.HTTPFound` is also a valid response
-object because it inherits from :class:`~pyramid.response.Response`. For
-examples, see :ref:`http_exceptions` and :ref:`http_redirect`.
+:app:`Pyramid` provides a range of different "exception" classes which inherit
+from :class:`pyramid.response.Response`. For example, an instance of the class
+:class:`pyramid.httpexceptions.HTTPFound` is also a valid response object
+because it inherits from :class:`~pyramid.response.Response`. For examples,
+see :ref:`http_exceptions` and :ref:`http_redirect`.
.. note::
@@ -155,7 +154,7 @@ examples, see :ref:`http_exceptions` and :ref:`http_redirect`.
.. _special_exceptions_in_callables:
-Using Special Exceptions In View Callables
+Using Special Exceptions in View Callables
------------------------------------------
Usually when a Python exception is raised within a view callable,
@@ -176,14 +175,14 @@ exception` objects.
HTTP Exceptions
~~~~~~~~~~~~~~~
-All :mod:`pyramid.httpexceptions` classes which are documented
-as inheriting from the :class:`pyramid.httpexceptions.HTTPException` are
-:term:`http exception` objects. Instances of an HTTP exception object may
-either be *returned* or *raised* from within view code. In either case
-(return or raise) the instance will be used as the view's response.
+All :mod:`pyramid.httpexceptions` classes which are documented as inheriting
+from the :class:`pyramid.httpexceptions.HTTPException` are :term:`http
+exception` objects. Instances of an HTTP exception object may either be
+*returned* or *raised* from within view code. In either case (return or raise)
+the instance will be used as the view's response.
-For example, the :class:`pyramid.httpexceptions.HTTPUnauthorized` exception
-can be raised. This will cause a response to be generated with a ``401
+For example, the :class:`pyramid.httpexceptions.HTTPUnauthorized` exception can
+be raised. This will cause a response to be generated with a ``401
Unauthorized`` status:
.. code-block:: python
@@ -194,8 +193,8 @@ Unauthorized`` status:
def aview(request):
raise HTTPUnauthorized()
-An HTTP exception, instead of being raised, can alternately be *returned*
-(HTTP exceptions are also valid response objects):
+An HTTP exception, instead of being raised, can alternately be *returned* (HTTP
+exceptions are also valid response objects):
.. code-block:: python
:linenos:
@@ -207,11 +206,11 @@ An HTTP exception, instead of being raised, can alternately be *returned*
A shortcut for creating an HTTP exception is the
:func:`pyramid.httpexceptions.exception_response` function. This function
-accepts an HTTP status code and returns the corresponding HTTP exception.
-For example, instead of importing and constructing a
-:class:`~pyramid.httpexceptions.HTTPUnauthorized` response object, you can
-use the :func:`~pyramid.httpexceptions.exception_response` function to
-construct and return the same object.
+accepts an HTTP status code and returns the corresponding HTTP exception. For
+example, instead of importing and constructing a
+:class:`~pyramid.httpexceptions.HTTPUnauthorized` response object, you can use
+the :func:`~pyramid.httpexceptions.exception_response` function to construct
+and return the same object.
.. code-block:: python
:linenos:
@@ -223,8 +222,8 @@ construct and return the same object.
This is the case because ``401`` is the HTTP status code for "HTTP
Unauthorized". Therefore, ``raise exception_response(401)`` is functionally
-equivalent to ``raise HTTPUnauthorized()``. Documentation which maps each
-HTTP response code to its purpose and its associated HTTP exception object is
+equivalent to ``raise HTTPUnauthorized()``. Documentation which maps each HTTP
+response code to its purpose and its associated HTTP exception object is
provided within :mod:`pyramid.httpexceptions`.
.. versionadded:: 1.1
@@ -233,22 +232,22 @@ provided within :mod:`pyramid.httpexceptions`.
How Pyramid Uses HTTP Exceptions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-HTTP exceptions are meant to be used directly by application
-developers. However, Pyramid itself will raise two HTTP exceptions at
-various points during normal operations:
+HTTP exceptions are meant to be used directly by application developers.
+However, Pyramid itself will raise two HTTP exceptions at various points during
+normal operations.
-* :exc:`~pyramid.httpexceptions.HTTPNotFound`
- gets raised when a view to service a request is not found.
-* :exc:`~pyramid.httpexceptions.HTTPForbidden`
- gets raised when authorization was forbidden by a security policy.
+* :exc:`~pyramid.httpexceptions.HTTPNotFound` gets raised when a view to
+ service a request is not found.
+* :exc:`~pyramid.httpexceptions.HTTPForbidden` gets raised when authorization
+ was forbidden by a security policy.
If :exc:`~pyramid.httpexceptions.HTTPNotFound` is raised by Pyramid itself or
-within view code, the result of the :term:`Not Found View` will be returned
-to the user agent which performed the request.
+within view code, the result of the :term:`Not Found View` will be returned to
+the user agent which performed the request.
If :exc:`~pyramid.httpexceptions.HTTPForbidden` is raised by Pyramid itself
-within view code, the result of the :term:`Forbidden View` will be returned
-to the user agent which performed the request.
+within view code, the result of the :term:`Forbidden View` will be returned to
+the user agent which performed the request.
.. index::
single: exception views
@@ -266,7 +265,7 @@ responses.
To register a view that should be called whenever a particular exception is
raised from within :app:`Pyramid` view code, use the exception class (or one of
its superclasses) as the :term:`context` of a view configuration which points
-at a view callable you'd like to generate a response for.
+at a view callable for which you'd like to generate a response.
For example, given the following exception class in a module named
``helloworld.exceptions``:
@@ -300,8 +299,8 @@ view callable will be invoked whenever a
view code. The same exception raised by a custom root factory, a custom
traverser, or a custom view or route predicate is also caught and hooked.
-Other normal view predicates can also be used in combination with an
-exception view registration:
+Other normal view predicates can also be used in combination with an exception
+view registration:
.. code-block:: python
:linenos:
@@ -315,24 +314,24 @@ exception view registration:
response.status_int = 500
return response
-The above exception view names the ``route_name`` of ``home``, meaning that
-it will only be called when the route matched has a name of ``home``. You
-can therefore have more than one exception view for any given exception in
-the system: the "most specific" one will be called when the set of request
+The above exception view names the ``route_name`` of ``home``, meaning that it
+will only be called when the route matched has a name of ``home``. You can
+therefore have more than one exception view for any given exception in the
+system: the "most specific" one will be called when the set of request
circumstances match the view registration.
-The only view predicate that cannot be used successfully when creating
-an exception view configuration is ``name``. The name used to look up
-an exception view is always the empty string. Views registered as
-exception views which have a name will be ignored.
+The only view predicate that cannot be used successfully when creating an
+exception view configuration is ``name``. The name used to look up an
+exception view is always the empty string. Views registered as exception views
+which have a name will be ignored.
.. note::
- Normal (i.e., non-exception) views registered against a context resource
- type which inherits from :exc:`Exception` will work normally. When an
- exception view configuration is processed, *two* views are registered. One
- as a "normal" view, the other as an "exception" view. This means that you
- can use an exception as ``context`` for a normal view.
+ Normal (i.e., non-exception) views registered against a context resource type
+ which inherits from :exc:`Exception` will work normally. When an exception
+ view configuration is processed, *two* views are registered. One as a
+ "normal" view, the other as an "exception" view. This means that you can use
+ an exception as ``context`` for a normal view.
Exception views can be configured with any view registration mechanism:
``@view_config`` decorator or imperative ``add_view`` styles.
@@ -340,9 +339,9 @@ Exception views can be configured with any view registration mechanism:
.. note::
Pyramid's :term:`exception view` handling logic is implemented as a tween
- factory function: :func:`pyramid.tweens.excview_tween_factory`. If
- Pyramid exception view handling is desired, and tween factories are
- specified via the ``pyramid.tweens`` configuration setting, the
+ factory function: :func:`pyramid.tweens.excview_tween_factory`. If Pyramid
+ exception view handling is desired, and tween factories are specified via
+ the ``pyramid.tweens`` configuration setting, the
:func:`pyramid.tweens.excview_tween_factory` function must be added to the
``pyramid.tweens`` configuration setting list explicitly. If it is not
present, Pyramid will not perform exception view handling.
@@ -358,11 +357,9 @@ Using a View Callable to do an HTTP Redirect
You can issue an HTTP redirect by using the
:class:`pyramid.httpexceptions.HTTPFound` class. Raising or returning an
-instance of this class will cause the client to receive a "302 Found"
-response.
+instance of this class will cause the client to receive a "302 Found" response.
-To do so, you can *return* a :class:`pyramid.httpexceptions.HTTPFound`
-instance.
+To do so, you can *return* a :class:`pyramid.httpexceptions.HTTPFound` instance.
.. code-block:: python
:linenos:
@@ -400,32 +397,31 @@ submission data using the :term:`WebOb` API, see :ref:`webob_chapter` and
`"Query and POST variables" within the WebOb documentation
<http://docs.webob.org/en/latest/reference.html#query-post-variables>`_.
:app:`Pyramid` defers to WebOb for its request and response implementations,
-and handling form submission data is a property of the request
-implementation. Understanding WebOb's request API is the key to
-understanding how to process form submission data.
-
-There are some defaults that you need to be aware of when trying to handle
-form submission data in a :app:`Pyramid` view. Having high-order (i.e.,
-non-ASCII) characters in data contained within form submissions is
-exceedingly common, and the UTF-8 encoding is the most common encoding used
-on the web for character data. Since Unicode values are much saner than
-working with and storing bytestrings, :app:`Pyramid` configures the
-:term:`WebOb` request machinery to attempt to decode form submission values
-into Unicode from UTF-8 implicitly. This implicit decoding happens when view
-code obtains form field values via the ``request.params``, ``request.GET``,
-or ``request.POST`` APIs (see :ref:`request_module` for details about these
-APIs).
+and handling form submission data is a property of the request implementation.
+Understanding WebOb's request API is the key to understanding how to process
+form submission data.
+
+There are some defaults that you need to be aware of when trying to handle form
+submission data in a :app:`Pyramid` view. Having high-order (i.e., non-ASCII)
+characters in data contained within form submissions is exceedingly common, and
+the UTF-8 encoding is the most common encoding used on the web for character
+data. Since Unicode values are much saner than working with and storing
+bytestrings, :app:`Pyramid` configures the :term:`WebOb` request machinery to
+attempt to decode form submission values into Unicode from UTF-8 implicitly.
+This implicit decoding happens when view code obtains form field values via the
+``request.params``, ``request.GET``, or ``request.POST`` APIs (see
+:ref:`request_module` for details about these APIs).
.. note::
- Many people find the difference between Unicode and UTF-8 confusing.
- Unicode is a standard for representing text that supports most of the
- world's writing systems. However, there are many ways that Unicode data
- can be encoded into bytes for transit and storage. UTF-8 is a specific
- encoding for Unicode, that is backwards-compatible with ASCII. This makes
- UTF-8 very convenient for encoding data where a large subset of that data
- is ASCII characters, which is largely true on the web. UTF-8 is also the
- standard character encoding for URLs.
+ Many people find the difference between Unicode and UTF-8 confusing. Unicode
+ is a standard for representing text that supports most of the world's
+ writing systems. However, there are many ways that Unicode data can be
+ encoded into bytes for transit and storage. UTF-8 is a specific encoding for
+ Unicode that is backwards-compatible with ASCII. This makes UTF-8 very
+ convenient for encoding data where a large subset of that data is ASCII
+ characters, which is largely true on the web. UTF-8 is also the standard
+ character encoding for URLs.
As an example, let's assume that the following form page is served up to a
browser client, and its ``action`` points at some :app:`Pyramid` view code:
@@ -450,8 +446,8 @@ browser client, and its ``action`` points at some :app:`Pyramid` view code:
The ``myview`` view code in the :app:`Pyramid` application *must* expect that
the values returned by ``request.params`` will be of type ``unicode``, as
-opposed to type ``str``. The following will work to accept a form post from
-the above form:
+opposed to type ``str``. The following will work to accept a form post from the
+above form:
.. code-block:: python
:linenos:
@@ -479,31 +475,31 @@ encoding of UTF-8. This can be done via a response that has a
with a ``meta http-equiv`` tag that implies that the charset is UTF-8 within
the HTML ``head`` of the page containing the form. This must be done
explicitly because all known browser clients assume that they should encode
-form data in the same character set implied by ``Content-Type`` value of the
-response containing the form when subsequently submitting that form. There is
-no other generally accepted way to tell browser clients which charset to use
-to encode form data. If you do not specify an encoding explicitly, the
-browser client will choose to encode form data in its default character set
-before submitting it, which may not be UTF-8 as the server expects. If a
-request containing form data encoded in a non-UTF8 charset is handled by your
-view code, eventually the request code accessed within your view will throw
-an error when it can't decode some high-order character encoded in another
-character set within form data, e.g., when ``request.params['somename']`` is
-accessed.
+form data in the same character set implied by the ``Content-Type`` value of
+the response containing the form when subsequently submitting that form. There
+is no other generally accepted way to tell browser clients which charset to use
+to encode form data. If you do not specify an encoding explicitly, the browser
+client will choose to encode form data in its default character set before
+submitting it, which may not be UTF-8 as the server expects. If a request
+containing form data encoded in a non-UTF-8 ``charset`` is handled by your view
+code, eventually the request code accessed within your view will throw an error
+when it can't decode some high-order character encoded in another character set
+within form data, e.g., when ``request.params['somename']`` is accessed.
If you are using the :class:`~pyramid.response.Response` class to generate a
response, or if you use the ``render_template_*`` templating APIs, the UTF-8
-charset is set automatically as the default via the ``Content-Type`` header.
-If you return a ``Content-Type`` header without an explicit charset, a
-request will add a ``;charset=utf-8`` trailer to the ``Content-Type`` header
-value for you, for response content types that are textual
-(e.g. ``text/html``, ``application/xml``, etc) as it is rendered. If you are
-using your own response object, you will need to ensure you do this yourself.
+``charset`` is set automatically as the default via the ``Content-Type``
+header. If you return a ``Content-Type`` header without an explicit
+``charset``, a request will add a ``;charset=utf-8`` trailer to the
+``Content-Type`` header value for you for response content types that are
+textual (e.g., ``text/html`` or ``application/xml``) as it is rendered. If you
+are using your own response object, you will need to ensure you do this
+yourself.
-.. note:: Only the *values* of request params obtained via
- ``request.params``, ``request.GET`` or ``request.POST`` are decoded
- to Unicode objects implicitly in the :app:`Pyramid` default
- configuration. The keys are still (byte) strings.
+.. note:: Only the *values* of request params obtained via ``request.params``,
+ ``request.GET`` or ``request.POST`` are decoded to Unicode objects
+ implicitly in the :app:`Pyramid` default configuration. The keys are still
+ (byte) strings.
.. index::
@@ -514,7 +510,7 @@ using your own response object, you will need to ensure you do this yourself.
Alternate View Callable Argument/Calling Conventions
----------------------------------------------------
-Usually, view callables are defined to accept only a single argument:
+Usually view callables are defined to accept only a single argument:
``request``. However, view callables may alternately be defined as classes,
functions, or any callable that accept *two* positional arguments: a
:term:`context` resource as the first argument and a :term:`request` as the
@@ -532,8 +528,7 @@ request
The following types work as view callables in this style:
-#. Functions that accept two arguments: ``context``, and ``request``,
- e.g.:
+#. Functions that accept two arguments: ``context`` and ``request``, e.g.:
.. code-block:: python
:linenos:
@@ -543,8 +538,8 @@ The following types work as view callables in this style:
def view(context, request):
return Response('OK')
-#. Classes that have an ``__init__`` method that accepts ``context,
- request`` and a ``__call__`` method which accepts no arguments, e.g.:
+#. Classes that have an ``__init__`` method that accepts ``context, request``,
+ and a ``__call__`` method which accepts no arguments, e.g.:
.. code-block:: python
:linenos:
@@ -559,8 +554,8 @@ The following types work as view callables in this style:
def __call__(self):
return Response('OK')
-#. Arbitrary callables that have a ``__call__`` method that accepts
- ``context, request``, e.g.:
+#. Arbitrary callables that have a ``__call__`` method that accepts ``context,
+ request``, e.g.:
.. code-block:: python
:linenos:
@@ -597,7 +592,6 @@ Pylons-1.0-Style "Controller" Dispatch
--------------------------------------
A package named :term:`pyramid_handlers` (available from PyPI) provides an
-analogue of :term:`Pylons` -style "controllers", which are a special kind of
-view class which provides more automation when your application uses
-:term:`URL dispatch` solely.
-
+analogue of :term:`Pylons`-style "controllers", which are a special kind of
+view class which provides more automation when your application uses :term:`URL
+dispatch` solely.
diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst
index 6a331e4bf..cfcf532bc 100644
--- a/docs/narr/webob.rst
+++ b/docs/narr/webob.rst
@@ -13,26 +13,26 @@ Request and Response Objects
:app:`Pyramid` uses the :term:`WebOb` package as a basis for its
:term:`request` and :term:`response` object implementations. The
:term:`request` object that is passed to a :app:`Pyramid` :term:`view` is an
-instance of the :class:`pyramid.request.Request` class, which is a subclass
-of :class:`webob.Request`. The :term:`response` returned from a
-:app:`Pyramid` :term:`view` :term:`renderer` is an instance of the
+instance of the :class:`pyramid.request.Request` class, which is a subclass of
+:class:`webob.Request`. The :term:`response` returned from a :app:`Pyramid`
+:term:`view` :term:`renderer` is an instance of the
:mod:`pyramid.response.Response` class, which is a subclass of the
:class:`webob.Response` class. Users can also return an instance of
:class:`pyramid.response.Response` directly from a view as necessary.
-WebOb is a project separate from :app:`Pyramid` with a separate set of
-authors and a fully separate `set of documentation
-<http://docs.webob.org/en/latest/index.html>`_. Pyramid adds some
+WebOb is a project separate from :app:`Pyramid` with a separate set of authors
+and a fully separate `set of documentation
+<http://docs.webob.org/en/latest/index.html>`_. :app:`Pyramid` adds some
functionality to the standard WebOb request, which is documented in the
:ref:`request_module` API documentation.
WebOb provides objects for HTTP requests and responses. Specifically it does
-this by wrapping the `WSGI <http://wsgi.org>`_ request environment and
-response status, header list, and app_iter (body) values.
+this by wrapping the `WSGI <http://wsgi.org>`_ request environment and response
+status, header list, and app_iter (body) values.
WebOb request and response objects provide many conveniences for parsing WSGI
requests and forming WSGI responses. WebOb is a nice way to represent "raw"
-WSGI requests and responses; however, we won't cover that use case in this
+WSGI requests and responses. However, we won't cover that use case in this
document, as users of :app:`Pyramid` don't typically need to use the
WSGI-related features of WebOb directly. The `reference documentation
<http://docs.webob.org/en/latest/reference.html>`_ shows many examples of
@@ -47,64 +47,58 @@ Request
The request object is a wrapper around the `WSGI environ dictionary
<http://www.python.org/dev/peps/pep-0333/#environ-variables>`_. This
-dictionary contains keys for each header, keys that describe the
-request (including the path and query string), a file-like object for
-the request body, and a variety of custom keys. You can always access
-the environ with ``req.environ``.
+dictionary contains keys for each header, keys that describe the request
+(including the path and query string), a file-like object for the request body,
+and a variety of custom keys. You can always access the environ with
+``req.environ``.
-Some of the most important/interesting attributes of a request
-object:
+Some of the most important and interesting attributes of a request object are
+below.
-``req.method``:
- The request method, e.g., ``'GET'``, ``'POST'``
+``req.method``
+ The request method, e.g., ``GET``, ``POST``
-``req.GET``:
- A :term:`multidict` with all the variables in the query
- string.
+``req.GET``
+ A :term:`multidict` with all the variables in the query string.
-``req.POST``:
- A :term:`multidict` with all the variables in the request
- body. This only has variables if the request was a ``POST`` and
- it is a form submission.
+``req.POST``
+ A :term:`multidict` with all the variables in the request body. This only
+ has variables if the request was a ``POST`` and it is a form submission.
-``req.params``:
- A :term:`multidict` with a combination of everything in
- ``req.GET`` and ``req.POST``.
+``req.params``
+ A :term:`multidict` with a combination of everything in ``req.GET`` and
+ ``req.POST``.
-``req.body``:
- The contents of the body of the request. This contains the entire
- request body as a string. This is useful when the request is a
- ``POST`` that is *not* a form submission, or a request like a
- ``PUT``. You can also get ``req.body_file`` for a file-like
- object.
+``req.body``
+ The contents of the body of the request. This contains the entire request
+ body as a string. This is useful when the request is a ``POST`` that is
+ *not* a form submission, or a request like a ``PUT``. You can also get
+ ``req.body_file`` for a file-like object.
``req.json_body``
The JSON-decoded contents of the body of the request. See
:ref:`request_json_body`.
-``req.cookies``:
+``req.cookies``
A simple dictionary of all the cookies.
-``req.headers``:
+``req.headers``
A dictionary of all the headers. This dictionary is case-insensitive.
-``req.urlvars`` and ``req.urlargs``:
- ``req.urlvars`` are the keyword parameters associated with the
- request URL. ``req.urlargs`` are the positional parameters.
- These are set by products like `Routes
- <http://routes.groovie.org/>`_ and `Selector
- <http://lukearno.com/projects/selector/>`_.
+``req.urlvars`` and ``req.urlargs``
+ ``req.urlvars`` are the keyword parameters associated with the request URL.
+ ``req.urlargs`` are the positional parameters. These are set by products
+ like `Routes <http://routes.readthedocs.org/en/latest/>`_ and `Selector
+ <https://github.com/lukearno/selector>`_.
-Also, for standard HTTP request headers there are usually attributes,
-for instance: ``req.accept_language``, ``req.content_length``,
-``req.user_agent``, as an example. These properties expose the
-*parsed* form of each header, for whatever parsing makes sense. For
-instance, ``req.if_modified_since`` returns a `datetime
-<http://python.org/doc/current/lib/datetime-datetime.html>`_ object
-(or None if the header is was not provided).
+Also for standard HTTP request headers, there are usually attributes such as
+``req.accept_language``, ``req.content_length``, and ``req.user_agent``. These
+properties expose the *parsed* form of each header, for whatever parsing makes
+sense. For instance, ``req.if_modified_since`` returns a :mod:`datetime`
+object (or None if the header is was not provided).
-.. note:: Full API documentation for the :app:`Pyramid` request
- object is available in :ref:`request_module`.
+.. note:: Full API documentation for the :app:`Pyramid` request object is
+ available in :ref:`request_module`.
.. index::
single: request attributes (special)
@@ -112,14 +106,14 @@ instance, ``req.if_modified_since`` returns a `datetime
.. _special_request_attributes:
Special Attributes Added to the Request by :app:`Pyramid`
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
In addition to the standard :term:`WebOb` attributes, :app:`Pyramid` adds
special attributes to every request: ``context``, ``registry``, ``root``,
``subpath``, ``traversed``, ``view_name``, ``virtual_root``,
-``virtual_root_path``, ``session``, ``matchdict``, and ``matched_route``.
-These attributes are documented further within the
-:class:`pyramid.request.Request` API documentation.
+``virtual_root_path``, ``session``, ``matchdict``, and ``matched_route``. These
+attributes are documented further within the :class:`pyramid.request.Request`
+API documentation.
.. index::
single: request URLs
@@ -127,45 +121,43 @@ These attributes are documented further within the
URLs
++++
-In addition to these attributes, there are several ways to get the URL
-of the request. I'll show various values for an example URL
+In addition to these attributes, there are several ways to get the URL of the
+request and its parts. We'll show various values for an example URL
``http://localhost/app/blog?id=10``, where the application is mounted at
``http://localhost/app``.
-``req.url``:
- The full request URL, with query string, e.g.,
+``req.url``
+ The full request URL with query string, e.g.,
``http://localhost/app/blog?id=10``
-``req.host``:
- The host information in the URL, e.g.,
- ``localhost``
+``req.host``
+ The host information in the URL, e.g., ``localhost``
-``req.host_url``:
+``req.host_url``
The URL with the host, e.g., ``http://localhost``
-``req.application_url``:
- The URL of the application (just the SCRIPT_NAME portion of the
- path, not PATH_INFO). E.g., ``http://localhost/app``
+``req.application_url``
+ The URL of the application (just the ``SCRIPT_NAME`` portion of the path,
+ not ``PATH_INFO``), e.g., ``http://localhost/app``
-``req.path_url``:
- The URL of the application including the PATH_INFO. e.g.,
+``req.path_url``
+ The URL of the application including the ``PATH_INFO``, e.g.,
``http://localhost/app/blog``
-``req.path``:
- The URL including PATH_INFO without the host or scheme. e.g.,
+``req.path``
+ The URL including ``PATH_INFO`` without the host or scheme, e.g.,
``/app/blog``
-``req.path_qs``:
- The URL including PATH_INFO and the query string. e.g,
+``req.path_qs``
+ The URL including ``PATH_INFO`` and the query string, e.g,
``/app/blog?id=10``
-``req.query_string``:
- The query string in the URL, e.g.,
- ``id=10``
+``req.query_string``
+ The query string in the URL, e.g., ``id=10``
-``req.relative_url(url, to_application=False)``:
- Gives a URL, relative to the current URL. If ``to_application``
- is True, then resolves it relative to ``req.application_url``.
+``req.relative_url(url, to_application=False)``
+ Gives a URL relative to the current URL. If ``to_application`` is True,
+ then resolves it relative to ``req.application_url``.
.. index::
single: request methods
@@ -177,39 +169,34 @@ There are methods of request objects documented in
:class:`pyramid.request.Request` but you'll find that you won't use very many
of them. Here are a couple that might be useful:
-``Request.blank(base_url)``:
- Creates a new request with blank information, based at the given
- URL. This can be useful for subrequests and artificial requests.
- You can also use ``req.copy()`` to copy an existing request, or
- for subrequests ``req.copy_get()`` which copies the request but
- always turns it into a GET (which is safer to share for
- subrequests).
+``Request.blank(base_url)``
+ Creates a new request with blank information, based at the given URL. This
+ can be useful for subrequests and artificial requests. You can also use
+ ``req.copy()`` to copy an existing request, or for subrequests
+ ``req.copy_get()`` which copies the request but always turns it into a GET
+ (which is safer to share for subrequests).
-``req.get_response(wsgi_application)``:
- This method calls the given WSGI application with this request, and
- returns a :class:`pyramid.response.Response` object. You can also use
- this for subrequests, or testing.
+``req.get_response(wsgi_application)``
+ This method calls the given WSGI application with this request, and returns
+ a :class:`pyramid.response.Response` object. You can also use this for
+ subrequests or testing.
.. index::
- single: request (and unicode)
- single: unicode (and the request)
+ single: request (and text/unicode)
+ single: unicode and text (and the request)
-Unicode
-+++++++
+Text (Unicode)
+++++++++++++++
-Many of the properties in the request object will return unicode
-values if the request encoding/charset is provided. The client *can*
+Many of the properties of the request object will be text values (``unicode``
+under Python 2 or ``str`` under Python 3) if the request encoding/charset is
+provided. If it is provided, the values in ``req.POST``, ``req.GET``,
+``req.params``, and ``req.cookies`` will contain text. The client *can*
indicate the charset with something like ``Content-Type:
-application/x-www-form-urlencoded; charset=utf8``, but browsers seldom
-set this. You can set the charset with ``req.charset = 'utf8'``, or
-during instantiation with ``Request(environ, charset='utf8')``. If
-you subclass ``Request`` you can also set ``charset`` as a class-level
-attribute.
-
-If it is set, then ``req.POST``, ``req.GET``, ``req.params``, and
-``req.cookies`` will contain unicode strings. Each has a
-corresponding ``req.str_*`` (e.g., ``req.str_POST``) that is always
-a ``str``, and never unicode.
+application/x-www-form-urlencoded; charset=utf8``, but browsers seldom set
+this. You can reset the charset of an existing request with ``newreq =
+req.decode('utf-8')``, or during instantiation with ``Request(environ,
+charset='utf8')``.
.. index::
single: multidict (WebOb)
@@ -219,26 +206,25 @@ a ``str``, and never unicode.
Multidict
+++++++++
-Several attributes of a WebOb request are "multidict"; structures (such as
+Several attributes of a WebOb request are multidict structures (such as
``request.GET``, ``request.POST``, and ``request.params``). A multidict is a
-dictionary where a key can have multiple values. The quintessential example
-is a query string like ``?pref=red&pref=blue``; the ``pref`` variable has two
+dictionary where a key can have multiple values. The quintessential example is
+a query string like ``?pref=red&pref=blue``; the ``pref`` variable has two
values: ``red`` and ``blue``.
-In a multidict, when you do ``request.GET['pref']`` you'll get back
-only ``'blue'`` (the last value of ``pref``). Sometimes returning a
-string, and sometimes returning a list, is the cause of frequent
-exceptions. If you want *all* the values back, use
-``request.GET.getall('pref')``. If you want to be sure there is *one
-and only one* value, use ``request.GET.getone('pref')``, which will
-raise an exception if there is zero or more than one value for
-``pref``.
-
-When you use operations like ``request.GET.items()`` you'll get back
-something like ``[('pref', 'red'), ('pref', 'blue')]``. All the
-key/value pairs will show up. Similarly ``request.GET.keys()``
-returns ``['pref', 'pref']``. Multidict is a view on a list of
-tuples; all the keys are ordered, and all the values are ordered.
+In a multidict, when you do ``request.GET['pref']``, you'll get back only
+``"blue"`` (the last value of ``pref``). This returned result might not be
+expected—sometimes returning a string, and sometimes returning a list—and may
+be cause of frequent exceptions. If you want *all* the values back, use
+``request.GET.getall('pref')``. If you want to be sure there is *one and only
+one* value, use ``request.GET.getone('pref')``, which will raise an exception
+if there is zero or more than one value for ``pref``.
+
+When you use operations like ``request.GET.items()``, you'll get back something
+like ``[('pref', 'red'), ('pref', 'blue')]``. All the key/value pairs will
+show up. Similarly ``request.GET.keys()`` returns ``['pref', 'pref']``.
+Multidict is a view on a list of tuples; all the keys are ordered, and all the
+values are ordered.
API documentation for a multidict exists as
:class:`pyramid.interfaces.IMultiDict`.
@@ -248,19 +234,19 @@ API documentation for a multidict exists as
.. _request_json_body:
-Dealing With A JSON-Encoded Request Body
+Dealing with a JSON-Encoded Request Body
++++++++++++++++++++++++++++++++++++++++
.. versionadded:: 1.1
:attr:`pyramid.request.Request.json_body` is a property that returns a
-:term:`JSON` -decoded representation of the request body. If the request
-does not have a body, or the body is not a properly JSON-encoded value, an
-exception will be raised when this attribute is accessed.
+:term:`JSON`-decoded representation of the request body. If the request does
+not have a body, or the body is not a properly JSON-encoded value, an exception
+will be raised when this attribute is accessed.
-This attribute is useful when you invoke a Pyramid view callable via
-e.g. jQuery's ``$.ajax`` function, which has the potential to send a request
-with a JSON-encoded body.
+This attribute is useful when you invoke a :app:`Pyramid` view callable via,
+for example, jQuery's ``$.ajax`` function, which has the potential to send a
+request with a JSON-encoded body.
Using ``request.json_body`` is equivalent to:
@@ -269,21 +255,21 @@ Using ``request.json_body`` is equivalent to:
from json import loads
loads(request.body, encoding=request.charset)
-Here's how to construct an AJAX request in Javascript using :term:`jQuery`
-that allows you to use the ``request.json_body`` attribute when the request
-is sent to a Pyramid application:
+Here's how to construct an AJAX request in JavaScript using :term:`jQuery` that
+allows you to use the ``request.json_body`` attribute when the request is sent
+to a :app:`Pyramid` application:
.. code-block:: javascript
- jQuery.ajax({type:'POST',
+ jQuery.ajax({type:'POST',
url: 'http://localhost:6543/', // the pyramid server
- data: JSON.stringify({'a':1}),
+ data: JSON.stringify({'a':1}),
contentType: 'application/json; charset=utf-8'});
When such a request reaches a view in your application, the
``request.json_body`` attribute will be available in the view callable body.
-.. code-block:: javascript
+.. code-block:: python
@view_config(renderer='string')
def aview(request):
@@ -296,30 +282,38 @@ For the above view, printed to the console will be:
{u'a': 1}
-For bonus points, here's a bit of client-side code that will produce a
-request that has a body suitable for reading via ``request.json_body`` using
-Python's ``urllib2`` instead of a Javascript AJAX request:
+For bonus points, here's a bit of client-side code that will produce a request
+that has a body suitable for reading via ``request.json_body`` using Python's
+``urllib2`` instead of a JavaScript AJAX request:
.. code-block:: python
import urllib2
- import json
+ import json
json_payload = json.dumps({'a':1})
headers = {'Content-Type':'application/json; charset=utf-8'}
req = urllib2.Request('http://localhost:6543/', json_payload, headers)
resp = urllib2.urlopen(req)
+If you are doing Cross-origin resource sharing (CORS), then the standard
+requires the browser to do a pre-flight HTTP OPTIONS request. The easiest way
+to handle this is to add an extra ``view_config`` for the same route, with
+``request_method`` set to ``OPTIONS``, and set the desired response header
+before returning. You can find examples of response headers `Access control
+CORS, Preflighted requests
+<https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Preflighted_requests>`_.
+
.. index::
single: cleaning up after request
.. _cleaning_up_after_a_request:
-Cleaning Up After a Request
+Cleaning up after a Request
+++++++++++++++++++++++++++
-Sometimes it's required that some cleanup be performed at the end of a
-request when a database connection is involved.
+Sometimes it's required to perform some cleanup at the end of a request when a
+database connection is involved.
For example, let's say you have a ``mypackage`` :app:`Pyramid` application
package that uses SQLAlchemy, and you'd like the current SQLAlchemy database
@@ -344,29 +338,28 @@ session to be removed after each request. Put the following in the
Registering the ``cleanup_callback`` finished callback at the start of a
request (by causing the ``add_cleanup_callback`` to receive a
:class:`pyramid.events.NewRequest` event at the start of each request) will
-cause the DBSession to be removed whenever request processing has ended.
-Note that in the example above, for the :class:`pyramid.events.subscriber`
-decorator to "work", the :meth:`pyramid.config.Configurator.scan` method must
-be called against your ``mypackage`` package during application
-initialization.
-
-.. note:: This is only an example. In particular, it is not necessary to
- cause ``DBSession.remove`` to be called in an application generated from
- any :app:`Pyramid` scaffold, because these all use the ``pyramid_tm``
- package. The cleanup done by ``DBSession.remove`` is unnecessary when
- ``pyramid_tm`` :term:`middleware` is configured into the application.
+cause the DBSession to be removed whenever request processing has ended. Note
+that in the example above, for the :class:`pyramid.events.subscriber` decorator
+to work, the :meth:`pyramid.config.Configurator.scan` method must be called
+against your ``mypackage`` package during application initialization.
+
+.. note::
+ This is only an example. In particular, it is not necessary to cause
+ ``DBSession.remove`` to be called in an application generated from any
+ :app:`Pyramid` scaffold, because these all use the ``pyramid_tm`` package.
+ The cleanup done by ``DBSession.remove`` is unnecessary when ``pyramid_tm``
+ :term:`middleware` is configured into the application.
More Details
++++++++++++
-More detail about the request object API is available in:
+More detail about the request object API is available as follows.
-- The :class:`pyramid.request.Request` API documentation.
+- :class:`pyramid.request.Request` API documentation
-- The `WebOb documentation <http://docs.webob.org/en/latest/index.html>`_.
- All methods and attributes of a ``webob.Request`` documented within the
- WebOb documentation will work with request objects created by
- :app:`Pyramid`.
+- `WebOb documentation <http://docs.webob.org/en/latest/index.html>`_. All
+ methods and attributes of a ``webob.Request`` documented within the WebOb
+ documentation will work with request objects created by :app:`Pyramid`.
.. index::
single: response object
@@ -377,67 +370,62 @@ Response
The :app:`Pyramid` response object can be imported as
:class:`pyramid.response.Response`. This class is a subclass of the
``webob.Response`` class. The subclass does not add or change any
-functionality, so the WebOb Response documentation will be completely
-relevant for this class as well.
+functionality, so the WebOb Response documentation will be completely relevant
+for this class as well.
A response object has three fundamental parts:
-``response.status``:
- The response code plus reason message, like ``'200 OK'``. To set
- the code without a message, use ``status_int``, i.e.:
- ``response.status_int = 200``.
-
-``response.headerlist``:
- A list of all the headers, like ``[('Content-Type',
- 'text/html')]``. There's a case-insensitive :term:`multidict`
- in ``response.headers`` that also allows you to access
- these same headers.
-
-``response.app_iter``:
- An iterable (such as a list or generator) that will produce the
- content of the response. This is also accessible as
- ``response.body`` (a string), ``response.unicode_body`` (a
- unicode object, informed by ``response.charset``), and
- ``response.body_file`` (a file-like object; writing to it appends
- to ``app_iter``).
+``response.status``
+ The response code plus reason message, like ``200 OK``. To set the code
+ without a message, use ``status_int``, i.e., ``response.status_int = 200``.
+
+``response.headerlist``
+ A list of all the headers, like ``[('Content-Type', 'text/html')]``.
+ There's a case-insensitive :term:`multidict` in ``response.headers`` that
+ also allows you to access these same headers.
+
+``response.app_iter``
+ An iterable (such as a list or generator) that will produce the content of
+ the response. This is also accessible as ``response.body`` (a string),
+ ``response.text`` (a unicode object, informed by ``response.charset``), and
+ ``response.body_file`` (a file-like object; writing to it appends to
+ ``app_iter``).
Everything else in the object typically derives from this underlying state.
Here are some highlights:
``response.content_type``
The content type *not* including the ``charset`` parameter.
+
Typical use: ``response.content_type = 'text/html'``.
Default value: ``response.content_type = 'text/html'``.
-``response.charset``:
- The ``charset`` parameter of the content-type, it also informs
- encoding in ``response.unicode_body``.
- ``response.content_type_params`` is a dictionary of all the
- parameters.
-
-``response.set_cookie(key, value, max_age=None, path='/', ...)``:
- Set a cookie. The keyword arguments control the various cookie
- parameters. The ``max_age`` argument is the length for the cookie
- to live in seconds (you may also use a timedelta object). The
- ``Expires`` key will also be set based on the value of
- ``max_age``.
-
-``response.delete_cookie(key, path='/', domain=None)``:
- Delete a cookie from the client. This sets ``max_age`` to 0 and
- the cookie value to ``''``.
-
-``response.cache_expires(seconds=0)``:
- This makes this response cacheable for the given number of seconds,
- or if ``seconds`` is 0 then the response is uncacheable (this also
- sets the ``Expires`` header).
-
-``response(environ, start_response)``:
- The response object is a WSGI application. As an application, it
- acts according to how you create it. It *can* do conditional
- responses if you pass ``conditional_response=True`` when
- instantiating (or set that attribute later). It can also do HEAD
- and Range requests.
+``response.charset``
+ The ``charset`` parameter of the content-type, it also informs encoding in
+ ``response.text``. ``response.content_type_params`` is a dictionary of all
+ the parameters.
+
+``response.set_cookie(key, value, max_age=None, path='/', ...)``
+ Set a cookie. The keyword arguments control the various cookie parameters.
+ The ``max_age`` argument is the length for the cookie to live in seconds
+ (you may also use a timedelta object). The ``Expires`` key will also be
+ set based on the value of ``max_age``.
+
+``response.delete_cookie(key, path='/', domain=None)``
+ Delete a cookie from the client. This sets ``max_age`` to 0 and the cookie
+ value to ``''``.
+
+``response.cache_expires(seconds=0)``
+ This makes the response cacheable for the given number of seconds, or if
+ ``seconds`` is ``0`` then the response is uncacheable (this also sets the
+ ``Expires`` header).
+
+``response(environ, start_response)``
+ The response object is a WSGI application. As an application, it acts
+ according to how you create it. It *can* do conditional responses if you
+ pass ``conditional_response=True`` when instantiating (or set that
+ attribute later). It can also do HEAD and Range requests.
.. index::
single: response headers
@@ -445,12 +433,11 @@ Here are some highlights:
Headers
+++++++
-Like the request, most HTTP response headers are available as
-properties. These are parsed, so you can do things like
-``response.last_modified = os.path.getmtime(filename)``.
+Like the request, most HTTP response headers are available as properties. These
+are parsed, so you can do things like ``response.last_modified =
+os.path.getmtime(filename)``.
-The details are available in the `extracted Response documentation
-<http://docs.webob.org/en/latest/modules/webob.html#headers>`_.
+The details are available in the :mod:`webob.response` API documentation.
.. index::
single: response (creating)
@@ -458,9 +445,9 @@ The details are available in the `extracted Response documentation
Instantiating the Response
++++++++++++++++++++++++++
-Of course most of the time you just want to *make* a response.
-Generally any attribute of the response can be passed in as a keyword
-argument to the class; e.g.:
+Of course most of the time you just want to *make* a response. Generally any
+attribute of the response can be passed in as a keyword argument to the class,
+e.g.:
.. code-block:: python
:linenos:
@@ -470,9 +457,9 @@ argument to the class; e.g.:
The status defaults to ``'200 OK'``.
-The value of content_type defaults to
-``webob.response.Response.default_content_type``; which is `text/html`.
-You can subclass :class:`pyramid.response.Response` and set
+The value of ``content_type`` defaults to
+``webob.response.Response.default_content_type``, which is ``text/html``. You
+can subclass :class:`pyramid.response.Response` and set
``default_content_type`` to override this behavior.
.. index::
@@ -482,18 +469,16 @@ Exception Responses
+++++++++++++++++++
To facilitate error responses like ``404 Not Found``, the module
-:mod:`pyramid.httpexceptions` contains classes for each kind of error
-response. These include boring, but appropriate error bodies. The
-exceptions exposed by this module, when used under :app:`Pyramid`, should be
-imported from the :mod:`pyramid.httpexceptions` module. This import location
-contains subclasses and replacements that mirror those in the ``webob.exc``
-module.
-
-Each class is named ``pyramid.httpexceptions.HTTP*``, where ``*`` is the
-reason for the error. For instance,
-:class:`pyramid.httpexceptions.HTTPNotFound` subclasses
-:class:`pyramid.response.Response`, so you can manipulate the instances in the same
-way. A typical example is:
+:mod:`pyramid.httpexceptions` contains classes for each kind of error response.
+These include boring but appropriate error bodies. The exceptions exposed by
+this module, when used under :app:`Pyramid`, should be imported from the
+:mod:`pyramid.httpexceptions` module. This import location contains subclasses
+and replacements that mirror those in the ``webob.exc`` module.
+
+Each class is named ``pyramid.httpexceptions.HTTP*``, where ``*`` is the reason
+for the error. For instance, :class:`pyramid.httpexceptions.HTTPNotFound`
+subclasses :class:`pyramid.response.Response`, so you can manipulate the
+instances in the same way. A typical example is:
.. code-block:: python
:linenos:
@@ -509,8 +494,6 @@ More Details
++++++++++++
More details about the response object API are available in the
-:mod:`pyramid.response` documentation. More details about exception
-responses are in the :mod:`pyramid.httpexceptions` API documentation. The
-`WebOb documentation <http://docs.webob.org/en/latest/index.html>`_ is also
-useful.
-
+:mod:`pyramid.response` documentation. More details about exception responses
+are in the :mod:`pyramid.httpexceptions` API documentation. The `WebOb
+documentation <http://docs.webob.org/en/latest/index.html>`_ is also useful.
diff --git a/docs/narr/zca.rst b/docs/narr/zca.rst
index b0e9b1709..784886563 100644
--- a/docs/narr/zca.rst
+++ b/docs/narr/zca.rst
@@ -9,17 +9,16 @@
.. _zca_chapter:
Using the Zope Component Architecture in :app:`Pyramid`
-==========================================================
+=======================================================
-Under the hood, :app:`Pyramid` uses a :term:`Zope Component
-Architecture` component registry as its :term:`application registry`.
-The Zope Component Architecture is referred to colloquially as the
-"ZCA."
+Under the hood, :app:`Pyramid` uses a :term:`Zope Component Architecture`
+component registry as its :term:`application registry`. The Zope Component
+Architecture is referred to colloquially as the "ZCA."
The ``zope.component`` API used to access data in a traditional Zope
-application can be opaque. For example, here is a typical "unnamed
-utility" lookup using the :func:`zope.component.getUtility` global API
-as it might appear in a traditional Zope application:
+application can be opaque. For example, here is a typical "unnamed utility"
+lookup using the :func:`zope.component.getUtility` global API as it might
+appear in a traditional Zope application:
.. code-block:: python
:linenos:
@@ -28,23 +27,21 @@ as it might appear in a traditional Zope application:
from zope.component import getUtility
settings = getUtility(ISettings)
-After this code runs, ``settings`` will be a Python dictionary. But
-it's unlikely that any "civilian" will be able to figure this out just
-by reading the code casually. When the ``zope.component.getUtility``
-API is used by a developer, the conceptual load on a casual reader of
-code is high.
+After this code runs, ``settings`` will be a Python dictionary. But it's
+unlikely that any "civilian" will be able to figure this out just by reading
+the code casually. When the ``zope.component.getUtility`` API is used by a
+developer, the conceptual load on a casual reader of code is high.
-While the ZCA is an excellent tool with which to build a *framework*
-such as :app:`Pyramid`, it is not always the best tool with which
-to build an *application* due to the opacity of the ``zope.component``
-APIs. Accordingly, :app:`Pyramid` tends to hide the presence of the
-ZCA from application developers. You needn't understand the ZCA to
-create a :app:`Pyramid` application; its use is effectively only a
-framework implementation detail.
+While the ZCA is an excellent tool with which to build a *framework* such as
+:app:`Pyramid`, it is not always the best tool with which to build an
+*application* due to the opacity of the ``zope.component`` APIs. Accordingly,
+:app:`Pyramid` tends to hide the presence of the ZCA from application
+developers. You needn't understand the ZCA to create a :app:`Pyramid`
+application; its use is effectively only a framework implementation detail.
-However, developers who are already used to writing :term:`Zope`
-applications often still wish to use the ZCA while building a
-:app:`Pyramid` application; :app:`Pyramid` makes this possible.
+However, developers who are already used to writing :term:`Zope` applications
+often still wish to use the ZCA while building a :app:`Pyramid` application.
+:app:`Pyramid` makes this possible.
.. index::
single: get_current_registry
@@ -52,87 +49,81 @@ applications often still wish to use the ZCA while building a
single: getSiteManager
single: ZCA global API
-Using the ZCA Global API in a :app:`Pyramid` Application
------------------------------------------------------------
-
-:term:`Zope` uses a single ZCA registry -- the "global" ZCA registry
--- for all Zope applications that run in the same Python process,
-effectively making it impossible to run more than one Zope application
-in a single process.
-
-However, for ease of deployment, it's often useful to be able to run more
-than a single application per process. For example, use of a
-:term:`PasteDeploy` "composite" allows you to run separate individual WSGI
-applications in the same process, each answering requests for some URL
-prefix. This makes it possible to run, for example, a TurboGears application
-at ``/turbogears`` and a :app:`Pyramid` application at ``/pyramid``, both
-served up using the same :term:`WSGI` server within a single Python process.
-
-Most production Zope applications are relatively large, making it
-impractical due to memory constraints to run more than one Zope
-application per Python process. However, a :app:`Pyramid` application
-may be very small and consume very little memory, so it's a reasonable
-goal to be able to run more than one :app:`Pyramid` application per
-process.
-
-In order to make it possible to run more than one :app:`Pyramid`
-application in a single process, :app:`Pyramid` defaults to using a
-separate ZCA registry *per application*.
-
-While this services a reasonable goal, it causes some issues when
-trying to use patterns which you might use to build a typical
-:term:`Zope` application to build a :app:`Pyramid` application.
-Without special help, ZCA "global" APIs such as
-:func:`zope.component.getUtility` and :func:`zope.component.getSiteManager`
-will use the ZCA "global" registry. Therefore, these APIs
-will appear to fail when used in a :app:`Pyramid` application,
-because they'll be consulting the ZCA global registry rather than the
-component registry associated with your :app:`Pyramid` application.
-
-There are three ways to fix this: by disusing the ZCA global API
-entirely, by using
-:meth:`pyramid.config.Configurator.hook_zca` or by passing
-the ZCA global registry to the :term:`Configurator` constructor at
-startup time. We'll describe all three methods in this section.
+Using the ZCA global API in a :app:`Pyramid` application
+--------------------------------------------------------
+
+:term:`Zope` uses a single ZCA registry—the "global" ZCA registry—for all Zope
+applications that run in the same Python process, effectively making it
+impossible to run more than one Zope application in a single process.
+
+However, for ease of deployment, it's often useful to be able to run more than
+a single application per process. For example, use of a :term:`PasteDeploy`
+"composite" allows you to run separate individual WSGI applications in the same
+process, each answering requests for some URL prefix. This makes it possible
+to run, for example, a TurboGears application at ``/turbogears`` and a
+:app:`Pyramid` application at ``/pyramid``, both served up using the same
+:term:`WSGI` server within a single Python process.
+
+Most production Zope applications are relatively large, making it impractical
+due to memory constraints to run more than one Zope application per Python
+process. However, a :app:`Pyramid` application may be very small and consume
+very little memory, so it's a reasonable goal to be able to run more than one
+:app:`Pyramid` application per process.
+
+In order to make it possible to run more than one :app:`Pyramid` application in
+a single process, :app:`Pyramid` defaults to using a separate ZCA registry *per
+application*.
+
+While this services a reasonable goal, it causes some issues when trying to use
+patterns which you might use to build a typical :term:`Zope` application to
+build a :app:`Pyramid` application. Without special help, ZCA "global" APIs
+such as :func:`zope.component.getUtility` and
+:func:`zope.component.getSiteManager` will use the ZCA "global" registry.
+Therefore, these APIs will appear to fail when used in a :app:`Pyramid`
+application, because they'll be consulting the ZCA global registry rather than
+the component registry associated with your :app:`Pyramid` application.
+
+There are three ways to fix this: by disusing the ZCA global API entirely, by
+using :meth:`pyramid.config.Configurator.hook_zca` or by passing the ZCA global
+registry to the :term:`Configurator` constructor at startup time. We'll
+describe all three methods in this section.
.. index::
single: request.registry
.. _disusing_the_global_zca_api:
-Disusing the Global ZCA API
+Disusing the global ZCA API
+++++++++++++++++++++++++++
ZCA "global" API functions such as ``zope.component.getSiteManager``,
``zope.component.getUtility``, :func:`zope.component.getAdapter`, and
:func:`zope.component.getMultiAdapter` aren't strictly necessary. Every
-component registry has a method API that offers the same
-functionality; it can be used instead. For example, presuming the
-``registry`` value below is a Zope Component Architecture component
-registry, the following bit of code is equivalent to
-``zope.component.getUtility(IFoo)``:
+component registry has a method API that offers the same functionality; it can
+be used instead. For example, presuming the ``registry`` value below is a Zope
+Component Architecture component registry, the following bit of code is
+equivalent to ``zope.component.getUtility(IFoo)``:
.. code-block:: python
registry.getUtility(IFoo)
-The full method API is documented in the ``zope.component`` package,
-but it largely mirrors the "global" API almost exactly.
+The full method API is documented in the ``zope.component`` package, but it
+largely mirrors the "global" API almost exactly.
-If you are willing to disuse the "global" ZCA APIs and use the method
-interface of a registry instead, you need only know how to obtain the
-:app:`Pyramid` component registry.
+If you are willing to disuse the "global" ZCA APIs and use the method interface
+of a registry instead, you need only know how to obtain the :app:`Pyramid`
+component registry.
There are two ways of doing so:
-- use the :func:`pyramid.threadlocal.get_current_registry`
- function within :app:`Pyramid` view or resource code. This will
- always return the "current" :app:`Pyramid` application registry.
+- use the :func:`pyramid.threadlocal.get_current_registry` function within
+ :app:`Pyramid` view or resource code. This will always return the "current"
+ :app:`Pyramid` application registry.
-- use the attribute of the :term:`request` object named ``registry``
- in your :app:`Pyramid` view code, eg. ``request.registry``. This
- is the ZCA component registry related to the running
- :app:`Pyramid` application.
+- use the attribute of the :term:`request` object named ``registry`` in your
+ :app:`Pyramid` view code, e.g., ``request.registry``. This is the ZCA
+ component registry related to the running :app:`Pyramid` application.
See :ref:`threadlocals_chapter` for more information about
:func:`pyramid.threadlocal.get_current_registry`.
@@ -142,7 +133,7 @@ See :ref:`threadlocals_chapter` for more information about
.. _hook_zca:
-Enabling the ZCA Global API by Using ``hook_zca``
+Enabling the ZCA global API by using ``hook_zca``
+++++++++++++++++++++++++++++++++++++++++++++++++
Consider the following bit of idiomatic :app:`Pyramid` startup code:
@@ -157,34 +148,31 @@ Consider the following bit of idiomatic :app:`Pyramid` startup code:
config.include('some.other.package')
return config.make_wsgi_app()
-When the ``app`` function above is run, a :term:`Configurator` is
-constructed. When the configurator is created, it creates a *new*
-:term:`application registry` (a ZCA component registry). A new
-registry is constructed whenever the ``registry`` argument is omitted
-when a :term:`Configurator` constructor is called, or when a
-``registry`` argument with a value of ``None`` is passed to a
-:term:`Configurator` constructor.
-
-During a request, the application registry created by the Configurator
-is "made current". This means calls to
-:func:`~pyramid.threadlocal.get_current_registry` in the thread
-handling the request will return the component registry associated
-with the application.
-
-As a result, application developers can use ``get_current_registry``
-to get the registry and thus get access to utilities and such, as per
-:ref:`disusing_the_global_zca_api`. But they still cannot use the
-global ZCA API. Without special treatment, the ZCA global APIs will
-always return the global ZCA registry (the one in
-``zope.component.globalregistry.base``).
-
-To "fix" this and make the ZCA global APIs use the "current"
-:app:`Pyramid` registry, you need to call
-:meth:`~pyramid.config.Configurator.hook_zca` within your setup code.
-For example:
+When the ``app`` function above is run, a :term:`Configurator` is constructed.
+When the configurator is created, it creates a *new* :term:`application
+registry` (a ZCA component registry). A new registry is constructed whenever
+the ``registry`` argument is omitted, when a :term:`Configurator` constructor
+is called, or when a ``registry`` argument with a value of ``None`` is passed
+to a :term:`Configurator` constructor.
+
+During a request, the application registry created by the Configurator is "made
+current". This means calls to
+:func:`~pyramid.threadlocal.get_current_registry` in the thread handling the
+request will return the component registry associated with the application.
+
+As a result, application developers can use ``get_current_registry`` to get the
+registry and thus get access to utilities and such, as per
+:ref:`disusing_the_global_zca_api`. But they still cannot use the global ZCA
+API. Without special treatment, the ZCA global APIs will always return the
+global ZCA registry (the one in ``zope.component.globalregistry.base``).
+
+To "fix" this and make the ZCA global APIs use the "current" :app:`Pyramid`
+registry, you need to call :meth:`~pyramid.config.Configurator.hook_zca` within
+your setup code. For example:
.. code-block:: python
:linenos:
+ :emphasize-lines: 5
from pyramid.config import Configurator
@@ -194,9 +182,9 @@ For example:
config.include('some.other.application')
return config.make_wsgi_app()
-We've added a line to our original startup code, line number 6, which
-calls ``config.hook_zca()``. The effect of this line under the hood
-is that an analogue of the following code is executed:
+We've added a line to our original startup code, line number 5, which calls
+``config.hook_zca()``. The effect of this line under the hood is that an
+analogue of the following code is executed:
.. code-block:: python
:linenos:
@@ -205,17 +193,15 @@ is that an analogue of the following code is executed:
from pyramid.threadlocal import get_current_registry
getSiteManager.sethook(get_current_registry)
-This causes the ZCA global API to start using the :app:`Pyramid`
-application registry in threads which are running a :app:`Pyramid`
-request.
+This causes the ZCA global API to start using the :app:`Pyramid` application
+registry in threads which are running a :app:`Pyramid` request.
-Calling ``hook_zca`` is usually sufficient to "fix" the problem of
-being able to use the global ZCA API within a :app:`Pyramid`
-application. However, it also means that a Zope application that is
-running in the same process may start using the :app:`Pyramid`
-global registry instead of the Zope global registry, effectively
-inverting the original problem. In such a case, follow the steps in
-the next section, :ref:`using_the_zca_global_registry`.
+Calling ``hook_zca`` is usually sufficient to "fix" the problem of being able
+to use the global ZCA API within a :app:`Pyramid` application. However, it
+also means that a Zope application that is running in the same process may
+start using the :app:`Pyramid` global registry instead of the Zope global
+registry, effectively inverting the original problem. In such a case, follow
+the steps in the next section, :ref:`using_the_zca_global_registry`.
.. index::
single: get_current_registry
@@ -224,14 +210,15 @@ the next section, :ref:`using_the_zca_global_registry`.
.. _using_the_zca_global_registry:
-Enabling the ZCA Global API by Using The ZCA Global Registry
+Enabling the ZCA global API by using the ZCA global registry
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-You can tell your :app:`Pyramid` application to use the ZCA global
-registry at startup time instead of constructing a new one:
+You can tell your :app:`Pyramid` application to use the ZCA global registry at
+startup time instead of constructing a new one:
.. code-block:: python
:linenos:
+ :emphasize-lines: 5-7
from zope.component import getGlobalSiteManager
from pyramid.config import Configurator
@@ -243,16 +230,14 @@ registry at startup time instead of constructing a new one:
config.include('some.other.application')
return config.make_wsgi_app()
-Lines 5, 6, and 7 above are the interesting ones. Line 5 retrieves
-the global ZCA component registry. Line 6 creates a
-:term:`Configurator`, passing the global ZCA registry into its
-constructor as the ``registry`` argument. Line 7 "sets up" the global
-registry with Pyramid-specific registrations; this is code that is
-normally executed when a registry is constructed rather than created,
+Lines 5, 6, and 7 above are the interesting ones. Line 5 retrieves the global
+ZCA component registry. Line 6 creates a :term:`Configurator`, passing the
+global ZCA registry into its constructor as the ``registry`` argument. Line 7
+"sets up" the global registry with Pyramid-specific registrations; this is code
+that is normally executed when a registry is constructed rather than created,
but we must call it "by hand" when we pass an explicit registry.
-At this point, :app:`Pyramid` will use the ZCA global registry
-rather than creating a new application-specific registry; since by
-default the ZCA global API will use this registry, things will work as
-you might expect a Zope app to when you use the global ZCA API.
-
+At this point, :app:`Pyramid` will use the ZCA global registry rather than
+creating a new application-specific registry. Since by default the ZCA global
+API will use this registry, things will work as you might expect in a Zope app
+when you use the global ZCA API.
diff --git a/docs/pscripts/index.rst b/docs/pscripts/index.rst
new file mode 100644
index 000000000..857e0564f
--- /dev/null
+++ b/docs/pscripts/index.rst
@@ -0,0 +1,12 @@
+.. _pscripts_documentation:
+
+``p*`` Scripts Documentation
+============================
+
+Command line programs (``p*`` scripts) included with :app:`Pyramid`.
+
+.. toctree::
+ :maxdepth: 1
+ :glob:
+
+ *
diff --git a/docs/pscripts/pcreate.rst b/docs/pscripts/pcreate.rst
new file mode 100644
index 000000000..b5ec3f4e2
--- /dev/null
+++ b/docs/pscripts/pcreate.rst
@@ -0,0 +1,13 @@
+.. index::
+ single: pcreate; --help
+
+.. _pcreate_script:
+
+``pcreate``
+-----------
+
+.. program-output:: pcreate --help
+ :prompt:
+ :shell:
+
+.. seealso:: :ref:`creating_a_project`
diff --git a/docs/pscripts/pdistreport.rst b/docs/pscripts/pdistreport.rst
new file mode 100644
index 000000000..1c53fb6e9
--- /dev/null
+++ b/docs/pscripts/pdistreport.rst
@@ -0,0 +1,13 @@
+.. index::
+ single: pdistreport; --help
+
+.. _pdistreport_script:
+
+``pdistreport``
+---------------
+
+.. program-output:: pdistreport --help
+ :prompt:
+ :shell:
+
+.. seealso:: :ref:`showing_distributions`
diff --git a/docs/pscripts/prequest.rst b/docs/pscripts/prequest.rst
new file mode 100644
index 000000000..a15827767
--- /dev/null
+++ b/docs/pscripts/prequest.rst
@@ -0,0 +1,13 @@
+.. index::
+ single: prequest; --help
+
+.. _prequest_script:
+
+``prequest``
+------------
+
+.. program-output:: prequest --help
+ :prompt:
+ :shell:
+
+.. seealso:: :ref:`invoking_a_request`
diff --git a/docs/pscripts/proutes.rst b/docs/pscripts/proutes.rst
new file mode 100644
index 000000000..09ed013e1
--- /dev/null
+++ b/docs/pscripts/proutes.rst
@@ -0,0 +1,13 @@
+.. index::
+ single: proutes; --help
+
+.. _proutes_script:
+
+``proutes``
+-----------
+
+.. program-output:: proutes --help
+ :prompt:
+ :shell:
+
+.. seealso:: :ref:`displaying_application_routes`
diff --git a/docs/pscripts/pserve.rst b/docs/pscripts/pserve.rst
new file mode 100644
index 000000000..d33d4a484
--- /dev/null
+++ b/docs/pscripts/pserve.rst
@@ -0,0 +1,13 @@
+.. index::
+ single: pserve; --help
+
+.. _pserve_script:
+
+``pserve``
+----------
+
+.. program-output:: pserve --help
+ :prompt:
+ :shell:
+
+.. seealso:: :ref:`running_the_project_application`
diff --git a/docs/pscripts/pshell.rst b/docs/pscripts/pshell.rst
new file mode 100644
index 000000000..cfd84d4f8
--- /dev/null
+++ b/docs/pscripts/pshell.rst
@@ -0,0 +1,13 @@
+.. index::
+ single: pshell; --help
+
+.. _pshell_script:
+
+``pshell``
+----------
+
+.. program-output:: pshell --help
+ :prompt:
+ :shell:
+
+.. seealso:: :ref:`interactive_shell`
diff --git a/docs/pscripts/ptweens.rst b/docs/pscripts/ptweens.rst
new file mode 100644
index 000000000..02e23e49a
--- /dev/null
+++ b/docs/pscripts/ptweens.rst
@@ -0,0 +1,13 @@
+.. index::
+ single: ptweens; --help
+
+.. _ptweens_script:
+
+``ptweens``
+-----------
+
+.. program-output:: ptweens --help
+ :prompt:
+ :shell:
+
+.. seealso:: :ref:`displaying_tweens`
diff --git a/docs/pscripts/pviews.rst b/docs/pscripts/pviews.rst
new file mode 100644
index 000000000..b4de5c054
--- /dev/null
+++ b/docs/pscripts/pviews.rst
@@ -0,0 +1,13 @@
+.. index::
+ single: pviews; --help
+
+.. _pviews_script:
+
+``pviews``
+----------
+
+.. program-output:: pviews --help
+ :prompt:
+ :shell:
+
+.. seealso:: :ref:`displaying_matching_views`
diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst
index 4ab39bb11..a7c184776 100644
--- a/docs/quick_tour.rst
+++ b/docs/quick_tour.rst
@@ -5,20 +5,20 @@ Quick Tour of Pyramid
=====================
Pyramid lets you start small and finish big. This *Quick Tour* of Pyramid is
-for those who want to evaluate Pyramid, whether you are new to Python
-web frameworks, or a pro in a hurry. For more detailed treatment of
-each topic, give the :ref:`quick_tutorial` a try.
+for those who want to evaluate Pyramid, whether you are new to Python web
+frameworks, or a pro in a hurry. For more detailed treatment of each topic,
+give the :ref:`quick_tutorial` a try.
+
Installation
============
-Once you have a standard Python environment setup, getting started with
-Pyramid is a breeze. Unfortunately "standard" is not so simple in Python.
-For this Quick Tour, it means:
-`Python <http://www.python.org/download/releases/>`_, a
-`virtual environment <http://docs.python.org/dev/library/venv.html>`_
-(or `virtualenv for Python 2.7 <https://pypi.python.org/pypi/virtualenv>`_),
-and `setuptools <https://pypi.python.org/pypi/setuptools/>`_.
+Once you have a standard Python environment setup, getting started with Pyramid
+is a breeze. Unfortunately "standard" is not so simple in Python. For this
+Quick Tour, it means `Python <https://www.python.org/downloads/>`_, a `virtual
+environment <http://docs.python.org/dev/library/venv.html>`_ (or `virtualenv
+for Python 2.7 <https://pypi.python.org/pypi/virtualenv>`_), and `setuptools
+<https://pypi.python.org/pypi/setuptools/>`_.
As an example, for Python 3.3+ on Linux:
@@ -38,28 +38,32 @@ For Windows:
c:\\> env33\\Scripts\\python ez_setup.py
c:\\> env33\\Scripts\\easy_install "pyramid==\ |release|\ "
-Of course Pyramid runs fine on Python 2.6+, as do the examples in this
-*Quick Tour*. We're just showing Python 3 a little love (Pyramid had
-production support in October 2011.)
+Of course Pyramid runs fine on Python 2.6+, as do the examples in this *Quick
+Tour*. We're just showing Python 3 a little love (Pyramid had production
+support for Python 3 in October 2011).
.. note::
- Why ``easy_install`` and not ``pip``? Pyramid encourages use of namespace
- packages which, until recently, ``pip`` didn't permit. Also, Pyramid has
- some optional C extensions for performance. With ``easy_install``, Windows
- users can get these extensions without needing a C compiler.
+ Why ``easy_install`` and not ``pip``? Some distributions upon which
+ Pyramid depends have optional C extensions for performance. ``pip`` cannot
+ install some binary Python distributions. With ``easy_install``, Windows
+ users are able to obtain binary Python distributions, so they get the
+ benefit of the C extensions without needing a C compiler. Also there can
+ be issues when ``pip`` and ``easy_install`` are used side-by-side in the
+ same environment, so we chose to recommend ``easy_install`` for the sake of
+ reducing the complexity of these instructions.
.. seealso:: See also:
:ref:`Quick Tutorial section on Requirements <qtut_requirements>`,
- :ref:`installing_unix`,
- :ref:`Before You Install <installing_chapter>`, and
- :ref:`Installing Pyramid on a Windows System <installing_windows>`
+ :ref:`installing_unix`, :ref:`Before You Install <installing_chapter>`, and
+ :ref:`Installing Pyramid on a Windows System <installing_windows>`.
+
Hello World
===========
-Microframeworks have shown that learning starts best from a very small
-first step. Here's a tiny application in Pyramid:
+Microframeworks have shown that learning starts best from a very small first
+step. Here's a tiny application in Pyramid:
.. literalinclude:: quick_tour/hello_world/app.py
:linenos:
@@ -70,72 +74,69 @@ This simple example is easy to run. Save this as ``app.py`` and run it:
$ python ./app.py
-Next, open `http://localhost:6543/ <http://localhost:6543/>`_ in a
-browser and you will see the ``Hello World!`` message.
+Next open http://localhost:6543/ in a browser, and you will see the ``Hello
+World!`` message.
New to Python web programming? If so, some lines in the module merit
explanation:
-#. *Line 10*. The ``if __name__ == '__main__':`` is Python's way of
- saying "Start here when running from the command line".
+#. *Line 10*. ``if __name__ == '__main__':`` is Python's way of saying "Start
+ here when running from the command line".
-#. *Lines 11-13*. Use Pyramid's :term:`configurator` to connect
- :term:`view` code to a particular URL :term:`route`.
+#. *Lines 11-13*. Use Pyramid's :term:`configurator` to connect :term:`view`
+ code to a particular URL :term:`route`.
-#. *Lines 6-7*. Implement the view code that generates the
- :term:`response`.
+#. *Lines 6-7*. Implement the view code that generates the :term:`response`.
#. *Lines 14-16*. Publish a :term:`WSGI` app using an HTTP server.
-As shown in this example, the :term:`configurator` plays a central role
-in Pyramid development. Building an application from loosely-coupled
-parts via :doc:`../narr/configuration` is a central idea in Pyramid,
-one that we will revisit regurlarly in this *Quick Tour*.
+As shown in this example, the :term:`configurator` plays a central role in
+Pyramid development. Building an application from loosely-coupled parts via
+:doc:`../narr/configuration` is a central idea in Pyramid, one that we will
+revisit regurlarly in this *Quick Tour*.
.. seealso:: See also:
:ref:`Quick Tutorial Hello World <qtut_hello_world>`,
- :ref:`firstapp_chapter`, and
- :ref:`Single File Tasks tutorial <tutorials:single-file-tutorial>`
+ :ref:`firstapp_chapter`, and :ref:`Todo List Application in One File
+ <cookbook:single-file-tutorial>`.
-Handling Web Requests and Responses
+
+Handling web requests and responses
===================================
-Developing for the web means processing web requests. As this is a
-critical part of a web application, web developers need a robust,
-mature set of software for web requests.
+Developing for the web means processing web requests. As this is a critical
+part of a web application, web developers need a robust, mature set of software
+for web requests.
-Pyramid has always fit nicely into the existing world of Python web
-development (virtual environments, packaging, scaffolding,
-first to embrace Python 3, etc.) For request handling, Pyramid turned
-to the well-regarded :term:`WebOb` Python library for request and
-response handling. In our example
-above, Pyramid hands ``hello_world`` a ``request`` that is
-:ref:`based on WebOb <webob_chapter>`.
+Pyramid has always fit nicely into the existing world of Python web development
+(virtual environments, packaging, scaffolding, one of the first to embrace
+Python 3, etc.). Pyramid turned to the well-regarded :term:`WebOb` Python
+library for request and response handling. In our example above, Pyramid hands
+``hello_world`` a ``request`` that is :ref:`based on WebOb <webob_chapter>`.
Let's see some features of requests and responses in action:
.. literalinclude:: quick_tour/requests/app.py
:pyobject: hello_world
-In this Pyramid view, we get the URL being visited from ``request.url``.
-Also, if you visited ``http://localhost:6543/?name=alice``,
-the name is included in the body of the response::
+In this Pyramid view, we get the URL being visited from ``request.url``. Also
+if you visited http://localhost:6543/?name=alice in a browser, the name is
+included in the body of the response::
URL http://localhost:6543/?name=alice with name: alice
-Finally, we set the response's content type and return the Response.
+Finally we set the response's content type, and return the Response.
.. seealso:: See also:
- :ref:`Quick Tutorial Request and Response <qtut_request_response>`
- and
- :ref:`webob_chapter`
+ :ref:`Quick Tutorial Request and Response <qtut_request_response>` and
+ :ref:`webob_chapter`.
+
Views
=====
-For the examples above, the ``hello_world`` function is a "view". In
-Pyramid, views are the primary way to accept web requests and return
-responses.
+For the examples above, the ``hello_world`` function is a "view". In Pyramid
+views are the primary way to accept web requests and return responses.
So far our examples place everything in one file:
@@ -143,171 +144,173 @@ So far our examples place everything in one file:
- its registration with the configurator
-- the route to map it to a URL
+- the route to map it to an URL
- the WSGI application launcher
-Let's move the views out to their own ``views.py`` module and change
-the ``app.py`` to scan that module, looking for decorators that set up
-the views. First, our revised ``app.py``:
+Let's move the views out to their own ``views.py`` module and change the
+``app.py`` to scan that module, looking for decorators that set up the views.
+
+First our revised ``app.py``:
.. literalinclude:: quick_tour/views/app.py
:linenos:
-We added some more routes, but we also removed the view code.
-Our views and their registrations (via decorators) are now in a module
-``views.py``, which is scanned via ``config.scan('views')``.
+We added some more routes, but we also removed the view code. Our views and
+their registrations (via decorators) are now in a module ``views.py``, which is
+scanned via ``config.scan('views')``.
-We now have a ``views.py`` module that is focused on handling requests
-and responses:
+We now have a ``views.py`` module that is focused on handling requests and
+responses:
.. literalinclude:: quick_tour/views/views.py
:linenos:
-We have 4 views, each leading to the other. If you start at
-``http://localhost:6543/``, you get a response with a link to the next
-view. The ``hello_view`` (available at the URL ``/howdy``) has a link
-to the ``redirect_view``, which issues a redirect to the final
-view.
+We have four views, each leading to the other. If you start at
+http://localhost:6543/, you get a response with a link to the next view. The
+``hello_view`` (available at the URL ``/howdy``) has a link to the
+``redirect_view``, which issues a redirect to the final view.
-Earlier we saw ``config.add_view`` as one way to configure a view. This
-section introduces ``@view_config``. Pyramid's configuration supports
-:term:`imperative configuration`, such as the ``config.add_view`` in
-the previous example. You can also use :term:`declarative
-configuration`, in which a Python :term:`decorator` is placed on the
-line above the view. Both approaches result in the same final
-configuration, thus usually, it is simply a matter of taste.
+Earlier we saw ``config.add_view`` as one way to configure a view. This section
+introduces ``@view_config``. Pyramid's configuration supports :term:`imperative
+configuration`, such as the ``config.add_view`` in the previous example. You
+can also use :term:`declarative configuration` in which a Python
+:term:`decorator` is placed on the line above the view. Both approaches result
+in the same final configuration, thus usually it is simply a matter of taste.
.. seealso:: See also:
- :ref:`Quick Tutorial Views <qtut_views>`,
- :doc:`../narr/views`,
- :doc:`../narr/viewconfig`, and
- :ref:`debugging_view_configuration`
+ :ref:`Quick Tutorial Views <qtut_views>`, :doc:`../narr/views`,
+ :doc:`../narr/viewconfig`, and :ref:`debugging_view_configuration`.
+
Routing
=======
-Writing web applications usually means sophisticated URL design. We
-just saw some Pyramid machinery for requests and views. Let's look at
-features that help in routing.
+Writing web applications usually means sophisticated URL design. We just saw
+some Pyramid machinery for requests and views. Let's look at features that help
+with routing.
Above we saw the basics of routing URLs to views in Pyramid:
-- Your project's "setup" code registers a route name to be used when
- matching part of the URL
+- Your project's "setup" code registers a route name to be used when matching
+ part of the URL.
-- Elsewhere, a view is configured to be called for that route name
+- Elsewhere a view is configured to be called for that route name.
.. note::
- Why do this twice? Other Python web frameworks let you create a
- route and associate it with a view in one step. As
- illustrated in :ref:`routes_need_ordering`, multiple routes might
- match the same URL pattern. Rather than provide ways to help guess,
- Pyramid lets you be explicit in ordering. Pyramid also gives
- facilities to avoid the problem.
+ Why do this twice? Other Python web frameworks let you create a route and
+ associate it with a view in one step. As illustrated in
+ :ref:`routes_need_ordering`, multiple routes might match the same URL
+ pattern. Rather than provide ways to help guess, Pyramid lets you be
+ explicit in ordering. Pyramid also gives facilities to avoid the problem.
-What if we want part of the URL to be available as data in my view? This
-route declaration:
+What if we want part of the URL to be available as data in my view? We can use
+this route declaration, for example:
.. literalinclude:: quick_tour/routing/app.py
- :start-after: Start Route 1
- :end-before: End Route 1
+ :linenos:
+ :lines: 6
+ :lineno-start: 6
-With this, URLs such as ``/howdy/amy/smith`` will assign ``amy`` to
-``first`` and ``smith`` to ``last``. We can then use this data in our
-view:
+With this, URLs such as ``/howdy/amy/smith`` will assign ``amy`` to ``first``
+and ``smith`` to ``last``. We can then use this data in our view:
.. literalinclude:: quick_tour/routing/views.py
- :start-after: Start Route 1
- :end-before: End Route 1
+ :linenos:
+ :lines: 5-8
+ :lineno-start: 5
+ :emphasize-lines: 3
-``request.matchdict`` contains values from the URL that match the
-"replacement patterns" (the curly braces) in the route declaration.
-This information can then be used in your view.
+``request.matchdict`` contains values from the URL that match the "replacement
+patterns" (the curly braces) in the route declaration. This information can
+then be used in your view.
.. seealso:: See also:
- :ref:`Quick Tutorial Routing <qtut_routing>`,
- :doc:`../narr/urldispatch`,
- :ref:`debug_routematch_section`, and
- :doc:`../narr/router`
+ :ref:`Quick Tutorial Routing <qtut_routing>`, :doc:`../narr/urldispatch`,
+ :ref:`debug_routematch_section`, and :doc:`../narr/router`.
+
Templating
==========
-Ouch. We have been making our own ``Response`` and filling the response
-body with HTML. You usually won't embed an HTML string directly in
-Python, but instead, will use a templating language.
+Ouch. We have been making our own ``Response`` and filling the response body
+with HTML. You usually won't embed an HTML string directly in Python, but
+instead you will use a templating language.
-Pyramid doesn't mandate a particular database system, form library,
-etc. It encourages replaceability. This applies equally to templating,
-which is fortunate: developers have strong views about template
-languages. That said, the Pylons Project officially supports bindings for
-Chameleon, Jinja2, and Mako, so in this step, let's use Chameleon.
+Pyramid doesn't mandate a particular database system, form library, and so on.
+It encourages replaceability. This applies equally to templating, which is
+fortunate: developers have strong views about template languages. That said,
+the Pylons Project officially supports bindings for Chameleon, Jinja2, and
+Mako. In this step let's use Chameleon.
Let's add ``pyramid_chameleon``, a Pyramid :term:`add-on` which enables
-Chameleon as a :term:`renderer` in our Pyramid applications:
+Chameleon as a :term:`renderer` in our Pyramid application:
.. code-block:: bash
$ easy_install pyramid_chameleon
-With the package installed, we can include the template bindings into
-our configuration:
+With the package installed, we can include the template bindings into our
+configuration in ``app.py``:
-.. code-block:: python
+.. literalinclude:: quick_tour/templating/app.py
+ :linenos:
+ :lines: 6-8
+ :lineno-start: 6
+ :emphasize-lines: 2
- config.include('pyramid_chameleon')
-
-Now lets change our views.py file:
+Now lets change our ``views.py`` file:
.. literalinclude:: quick_tour/templating/views.py
- :start-after: Start View 1
- :end-before: End View 1
+ :linenos:
+ :emphasize-lines: 4,6
-Ahh, that looks better. We have a view that is focused on Python code.
-Our ``@view_config`` decorator specifies a :term:`renderer` that points
-to our template file. Our view then simply returns data which is then
-supplied to our template:
+Ahh, that looks better. We have a view that is focused on Python code. Our
+``@view_config`` decorator specifies a :term:`renderer` that points to our
+template file. Our view then simply returns data which is then supplied to our
+template ``hello_world.pt``:
.. literalinclude:: quick_tour/templating/hello_world.pt
:language: html
-Since our view returned ``dict(name=request.matchdict['name'])``,
-we can use ``name`` as a variable in our template via
-``${name}``.
+Since our view returned ``dict(name=request.matchdict['name'])``, we can use
+``name`` as a variable in our template via ``${name}``.
.. seealso:: See also:
:ref:`Quick Tutorial Templating <qtut_templating>`,
- :doc:`../narr/templates`,
- :ref:`debugging_templates`, and
- :ref:`available_template_system_bindings`
+ :doc:`../narr/templates`, :ref:`debugging_templates`, and
+ :ref:`available_template_system_bindings`.
+
-Templating With ``jinja2``
-==========================
+Templating with Jinja2
+======================
-We just said Pyramid doesn't prefer one templating language over
-another. Time to prove it. Jinja2 is a popular templating system,
-modelled after Django's templates. Let's add ``pyramid_jinja2``,
-a Pyramid :term:`add-on` which enables Jinja2 as a :term:`renderer` in
-our Pyramid applications:
+We just said Pyramid doesn't prefer one templating language over another. Time
+to prove it. Jinja2 is a popular templating system, modeled after Django's
+templates. Let's add ``pyramid_jinja2``, a Pyramid :term:`add-on` which enables
+Jinja2 as a :term:`renderer` in our Pyramid applications:
.. code-block:: bash
$ easy_install pyramid_jinja2
-With the package installed, we can include the template bindings into
-our configuration:
+With the package installed, we can include the template bindings into our
+configuration:
-.. code-block:: python
-
- config.include('pyramid_jinja2')
+.. literalinclude:: quick_tour/jinja2/app.py
+ :linenos:
+ :lines: 6-8
+ :lineno-start: 6
+ :emphasize-lines: 2
The only change in our view is to point the renderer at the ``.jinja2`` file:
.. literalinclude:: quick_tour/jinja2/views.py
- :start-after: Start View 1
- :end-before: End View 1
+ :linenos:
+ :lines: 4-6
+ :lineno-start: 4
+ :emphasize-lines: 1
Our Jinja2 template is very similar to our previous template:
@@ -315,54 +318,60 @@ Our Jinja2 template is very similar to our previous template:
:language: html
Pyramid's templating add-ons register a new kind of renderer into your
-application. The renderer registration maps to different kinds of
-filename extensions. In this case, changing the extension from ``.pt``
-to ``.jinja2`` passed the view response through the ``pyramid_jinja2``
-renderer.
+application. The renderer registration maps to different kinds of filename
+extensions. In this case, changing the extension from ``.pt`` to ``.jinja2``
+passed the view response through the ``pyramid_jinja2`` renderer.
.. seealso:: See also:
- :ref:`Quick Tutorial Jinja2 <qtut_jinja2>`,
- `Jinja2 homepage <http://jinja.pocoo.org/>`_, and
- :ref:`pyramid_jinja2 Overview <jinja2:overview>`
+ :ref:`Quick Tutorial Jinja2 <qtut_jinja2>`, `Jinja2 homepage
+ <http://jinja.pocoo.org/>`_, and :ref:`pyramid_jinja2 Overview
+ <jinja2:overview>`.
+
-Static Assets
+Static assets
=============
-Of course the Web is more than just markup. You need static assets:
-CSS, JS, and images. Let's point our web app at a directory where
-Pyramid will serve some static assets. First, another call to the
+Of course the Web is more than just markup. You need static assets: CSS, JS,
+and images. Let's point our web app at a directory from which Pyramid will
+serve some static assets. First let's make another call to the
:term:`configurator`:
.. literalinclude:: quick_tour/static_assets/app.py
- :start-after: Start Static 1
- :end-before: End Static 1
+ :linenos:
+ :lines: 6-8
+ :lineno-start: 6
+ :emphasize-lines: 2
This tells our WSGI application to map requests under
-``http://localhost:6543/static/`` to files and directories inside a
-``static`` directory alongside our Python module.
+http://localhost:6543/static/ to files and directories inside a ``static``
+directory alongside our Python module.
-Next, make a directory ``static`` and place ``app.css`` inside:
+Next make a directory named ``static``, and place ``app.css`` inside:
.. literalinclude:: quick_tour/static_assets/static/app.css
:language: css
-All we need to do now is point to it in the ``<head>`` of our Jinja2
-template:
+All we need to do now is point to it in the ``<head>`` of our Jinja2 template,
+``hello_world.jinja2``:
-.. literalinclude:: quick_tour/static_assets/hello_world.pt
- :language: html
- :start-after: Start Link 1
- :end-before: End Link 1
+.. literalinclude:: quick_tour/static_assets/hello_world.jinja2
+ :language: jinja
+ :linenos:
+ :lines: 4-6
+ :lineno-start: 4
+ :emphasize-lines: 2
-This link presumes that our CSS is at a URL starting with ``/static/``.
-What if the site is later moved under ``/somesite/static/``? Or perhaps
-a web developer changes the arrangement on disk? Pyramid provides a helper
-to allow flexibility on URL generation:
+This link presumes that our CSS is at a URL starting with ``/static/``. What if
+the site is later moved under ``/somesite/static/``? Or perhaps a web developer
+changes the arrangement on disk? Pyramid provides a helper to allow flexibility
+on URL generation:
-.. literalinclude:: quick_tour/static_assets/hello_world.pt
- :language: html
- :start-after: Start Link 2
- :end-before: End Link 2
+.. literalinclude:: quick_tour/static_assets/hello_world_static.jinja2
+ :language: jinja
+ :linenos:
+ :lines: 4-6
+ :lineno-start: 4
+ :emphasize-lines: 2
By using ``request.static_url`` to generate the full URL to the static
assets, you both ensure you stay in sync with the configuration and
@@ -370,39 +379,48 @@ gain refactoring flexibility later.
.. seealso:: See also:
:ref:`Quick Tutorial Static Assets <qtut_static_assets>`,
- :doc:`../narr/assets`,
- :ref:`preventing_http_caching`, and
- :ref:`influencing_http_caching`
+ :doc:`../narr/assets`, :ref:`preventing_http_caching`, and
+ :ref:`influencing_http_caching`.
+
Returning JSON
==============
-Modern web apps are more than rendered HTML. Dynamic pages now use
-JavaScript to update the UI in the browser by requesting server data as
-JSON. Pyramid supports this with a JSON renderer:
+Modern web apps are more than rendered HTML. Dynamic pages now use JavaScript
+to update the UI in the browser by requesting server data as JSON. Pyramid
+supports this with a JSON renderer:
.. literalinclude:: quick_tour/json/views.py
- :start-after: Start View 1
- :end-before: End View 2
+ :linenos:
+ :lines: 9-
+ :lineno-start: 9
-This wires up a view that returns some data through the JSON
-:term:`renderer`, which calls Python's JSON support to serialize the data
-into JSON and set the appropriate HTTP headers.
+This wires up a view that returns some data through the JSON :term:`renderer`,
+which calls Python's JSON support to serialize the data into JSON, and sets the
+appropriate HTTP headers.
+
+We also need to add a route to ``app.py`` so that our app will know how to
+respond to a request for ``hello.json``.
+
+.. literalinclude:: quick_tour/json/app.py
+ :linenos:
+ :lines: 6-8
+ :lineno-start: 6
+ :emphasize-lines: 2
.. seealso:: See also:
- :ref:`Quick Tutorial JSON <qtut_json>`,
- :ref:`views_which_use_a_renderer`,
- :ref:`json_renderer`, and
- :ref:`adding_and_overriding_renderers`
+ :ref:`Quick Tutorial JSON <qtut_json>`, :ref:`views_which_use_a_renderer`,
+ :ref:`json_renderer`, and :ref:`adding_and_overriding_renderers`.
+
-View Classes
+View classes
============
-So far our views have been simple, free-standing functions. Many times
-your views are related: different ways to look at or work on the same
-data or a REST API that handles multiple operations. Grouping these
-together as a
-:ref:`view class <class_as_view>` makes sense:
+So far our views have been simple, free-standing functions. Many times your
+views are related. They may have different ways to look at or work on the same
+data, or they may be a REST API that handles multiple operations. Grouping
+these together as a :ref:`view class <class_as_view>` makes sense and achieves
+the following goals.
- Group views
@@ -410,86 +428,85 @@ together as a
- Share some state and helpers
-The following shows a "Hello World" example with three operations: view
-a form, save a change, or press the delete button:
+The following shows a "Hello World" example with three operations: view a form,
+save a change, or press the delete button in our ``views.py``:
.. literalinclude:: quick_tour/view_classes/views.py
- :start-after: Start View 1
- :end-before: End View 1
+ :linenos:
+ :lines: 7-
+ :lineno-start: 7
-As you can see, the three views are logically grouped together.
-Specifically:
+As you can see, the three views are logically grouped together. Specifically:
-- The first view is returned when you go to ``/howdy/amy``. This URL is
- mapped to the ``hello`` route that we centrally set using the optional
+- The first view is returned when you go to ``/howdy/amy``. This URL is mapped
+ to the ``hello`` route that we centrally set using the optional
``@view_defaults``.
- The second view is returned when the form data contains a field with
- ``form.edit``, such as clicking on
- ``<input type="submit" name="form.edit" value="Save"/>``. This rule
- is specified in the ``@view_config`` for that view.
+ ``form.edit``, such as clicking on ``<input type="submit" name="form.edit"
+ value="Save">``. This rule is specified in the ``@view_config`` for that
+ view.
-- The third view is returned when clicking on a button such
- as ``<input type="submit" name="form.delete" value="Delete"/>``.
+- The third view is returned when clicking on a button such as ``<input
+ type="submit" name="form.delete" value="Delete">``.
-Only one route needed, stated in one place atop the view class. Also,
-the assignment of the ``name`` is done in the ``__init__``. Our
-templates can then use ``{{ view.name }}``.
+Only one route is needed, stated in one place atop the view class. Also, the
+assignment of ``name`` is done in the ``__init__`` function. Our templates can
+then use ``{{ view.name }}``.
-Pyramid view classes, combined with built-in and custom predicates,
-have much more to offer:
+Pyramid view classes, combined with built-in and custom predicates, have much
+more to offer:
- All the same view configuration parameters as function views
-- One route leading to multiple views, based on information in the
- request or data such as ``request_param``, ``request_method``,
- ``accept``, ``header``, ``xhr``, ``containment``, and
- ``custom_predicates``
+- One route leading to multiple views, based on information in the request or
+ data such as ``request_param``, ``request_method``, ``accept``, ``header``,
+ ``xhr``, ``containment``, and ``custom_predicates``
.. seealso:: See also:
- :ref:`Quick Tutorial View Classes <qtut_view_classes>`,
- :ref:`Quick Tutorial More View Classes <qtut_more_view_classes>`, and
- :ref:`class_as_view`
+ :ref:`Quick Tutorial View Classes <qtut_view_classes>`, :ref:`Quick
+ Tutorial More View Classes <qtut_more_view_classes>`, and
+ :ref:`class_as_view`.
+
-Quick Project Startup with Scaffolds
+Quick project startup with scaffolds
====================================
-So far we have done all of our *Quick Tour* as a single Python file.
-No Python packages, no structure. Most Pyramid projects, though,
-aren't developed this way.
+So far we have done all of our *Quick Tour* as a single Python file. No Python
+packages, no structure. Most Pyramid projects, though, aren't developed this
+way.
-To ease the process of getting started, Pyramid provides *scaffolds*
-that generate sample projects from templates in Pyramid and Pyramid
-add-ons. Pyramid's ``pcreate`` command can list the available scaffolds:
+To ease the process of getting started, Pyramid provides *scaffolds* that
+generate sample projects from templates in Pyramid and Pyramid add-ons.
+Pyramid's ``pcreate`` command can list the available scaffolds:
.. code-block:: bash
$ pcreate --list
Available scaffolds:
alchemy: Pyramid SQLAlchemy project using url dispatch
- pyramid_jinja2_starter: pyramid jinja2 starter project
+ pyramid_jinja2_starter: Pyramid Jinja2 starter project
starter: Pyramid starter project
zodb: Pyramid ZODB project using traversal
-The ``pyramid_jinja2`` add-on gave us a scaffold that we can use. From
-the parent directory of where we want our Python package to be generated,
-let's use that scaffold to make our project:
+The ``pyramid_jinja2`` add-on gave us a scaffold that we can use. From the
+parent directory of where we want our Python package to be generated, let's use
+that scaffold to make our project:
.. code-block:: bash
$ pcreate --scaffold pyramid_jinja2_starter hello_world
-We next use the normal Python command to set up our package for
-development:
+We next use the normal Python command to set up our package for development:
.. code-block:: bash
$ cd hello_world
$ python ./setup.py develop
-We are moving in the direction of a full-featured Pyramid project,
-with a proper setup for Python standards (packaging) and Pyramid
-configuration. This includes a new way of running your application:
+We are moving in the direction of a full-featured Pyramid project, with a
+proper setup for Python standards (packaging) and Pyramid configuration. This
+includes a new way of running your application:
.. code-block:: bash
@@ -502,53 +519,49 @@ Let's look at ``pserve`` and configuration in more depth.
:ref:`project_narr`, and
:doc:`../narr/scaffolding`
-Application Running with ``pserve``
+Application running with ``pserve``
===================================
-Prior to scaffolds, our project mixed a number of operations details
-into our code. Why should my main code care which HTTP server I want and
-what port number to run on?
+Prior to scaffolds, our project mixed a number of operational details into our
+code. Why should my main code care which HTTP server I want and what port
+number to run on?
-``pserve`` is Pyramid's application runner, separating operational
-details from your code. When you install Pyramid, a small command
-program called ``pserve`` is written to your ``bin`` directory. This
-program is an executable Python module. It's very small, getting most
-of its brains via import.
+``pserve`` is Pyramid's application runner, separating operational details from
+your code. When you install Pyramid, a small command program called ``pserve``
+is written to your ``bin`` directory. This program is an executable Python
+module. It's very small, getting most of its brains via import.
-You can run ``pserve`` with ``--help`` to see some of its options.
-Doing so reveals that you can ask ``pserve`` to watch your development
-files and reload the server when they change:
+You can run ``pserve`` with ``--help`` to see some of its options. Doing so
+reveals that you can ask ``pserve`` to watch your development files and reload
+the server when they change:
.. code-block:: bash
$ pserve development.ini --reload
-The ``pserve`` command has a number of other options and operations.
-Most of the work, though, comes from your project's wiring, as
-expressed in the configuration file you supply to ``pserve``. Let's
-take a look at this configuration file.
+The ``pserve`` command has a number of other options and operations. Most of
+the work, though, comes from your project's wiring, as expressed in the
+configuration file you supply to ``pserve``. Let's take a look at this
+configuration file.
.. seealso:: See also:
:ref:`what_is_this_pserve_thing`
-Configuration with ``.ini`` Files
+Configuration with ``.ini`` files
=================================
-Earlier in *Quick Tour* we first met Pyramid's configuration system.
-At that point we did all configuration in Python code. For example,
-the port number chosen for our HTTP server was right there in Python
-code. Our scaffold has moved this decision, and more, into the
-``development.ini`` file:
+Earlier in *Quick Tour* we first met Pyramid's configuration system. At that
+point we did all configuration in Python code. For example, the port number
+chosen for our HTTP server was right there in Python code. Our scaffold has
+moved this decision and more into the ``development.ini`` file:
.. literalinclude:: quick_tour/package/development.ini
:language: ini
-Let's take a quick high-level look. First, the ``.ini`` file is divided
-into sections:
+Let's take a quick high-level look. First the ``.ini`` file is divided into
+sections:
-- ``[app:hello_world]`` configures our WSGI app
-
-- ``[pipeline:main]`` sets up our WSGI "pipeline"
+- ``[app:main]`` configures our WSGI app
- ``[server:main]`` holds our WSGI server settings
@@ -556,25 +569,23 @@ into sections:
We have a few decisions made for us in this configuration:
-#. *Choice of web server*. The ``use = egg:pyramid#wsgiref`` tells
- ``pserve`` to use the ``wsgiref`` server that is wrapped in the Pyramid
- package.
+#. *Choice of web server:* ``use = egg:hello_world`` tells ``pserve`` to
+ use the ``waitress`` server.
-#. *Port number*. ``port = 6543`` tells ``wsgiref`` to listen on port
- 6543.
+#. *Port number:* ``port = 6543`` tells ``waitress`` to listen on port 6543.
-#. *WSGI app*. What package has our WSGI application in it?
- ``use = egg:hello_world`` in the app section tells the
- configuration what application to load.
+#. *WSGI app:* What package has our WSGI application in it?
+ ``use = egg:hello_world`` in the app section tells the configuration what
+ application to load.
-#. *Easier development by automatic template reloading*. In development
- mode, you shouldn't have to restart the server when editing a Jinja2
- template. ``reload_templates = true`` sets this policy,
- which might be different in production.
+#. *Easier development by automatic template reloading:* In development mode,
+ you shouldn't have to restart the server when editing a Jinja2 template.
+ ``pyramid.reload_templates = true`` sets this policy, which might be
+ different in production.
-Additionally, the ``development.ini`` generated by this scaffold wired
-up Python's standard logging. We'll now see in the console, for example,
-a log on every request that comes in, as well as traceback information.
+Additionally the ``development.ini`` generated by this scaffold wired up
+Python's standard logging. We'll now see in the console, for example, a log on
+every request that comes in, as well as traceback information.
.. seealso:: See also:
:ref:`Quick Tutorial Application Configuration <qtut_ini>`,
@@ -582,82 +593,83 @@ a log on every request that comes in, as well as traceback information.
:doc:`../narr/paste`
-Easier Development with ``debugtoolbar``
+Easier development with ``debugtoolbar``
========================================
As we introduce the basics, we also want to show how to be productive in
-development and debugging. For example, we just discussed template
-reloading and earlier we showed ``--reload`` for application reloading.
+development and debugging. For example, we just discussed template reloading
+and earlier we showed ``--reload`` for application reloading.
-``pyramid_debugtoolbar`` is a popular Pyramid add-on which makes
-several tools available in your browser. Adding it to your project
-illustrates several points about configuration.
+``pyramid_debugtoolbar`` is a popular Pyramid add-on which makes several tools
+available in your browser. Adding it to your project illustrates several points
+about configuration.
-First, change your ``setup.py`` to say:
+The scaffold ``pyramid_jinja2_starter`` is already configured to include the
+add-on ``pyramid_debugtoolbar`` in its ``setup.py``:
.. literalinclude:: quick_tour/package/setup.py
- :start-after: Start Requires
- :end-before: End Requires
+ :language: python
+ :linenos:
+ :lineno-start: 11
+ :lines: 11-16
-...and re-run your setup:
+It was installed when you previously ran:
.. code-block:: bash
$ python ./setup.py develop
-The Python package was now installed into our environment. The package
-is a Pyramid add-on, which means we need to include its configuration
-into our web application. We could do this with imperative
-configuration, as we did above for the ``pyramid_jinja2`` add-on:
+The ``pyramid_debugtoolbar`` package is a Pyramid add-on, which means we need
+to include its configuration into our web application. The ``pyramid_jinja2``
+add-on already took care of this for us in its ``__init__.py``:
.. literalinclude:: quick_tour/package/hello_world/__init__.py
- :start-after: Start Include
- :end-before: End Include
+ :language: python
+ :linenos:
+ :lineno-start: 16
+ :lines: 19
-Now that we have a configuration file, we can use the
-``pyramid.includes`` facility and place this in our
-``development.ini`` instead:
+And it uses the ``pyramid.includes`` facility in our ``development.ini``:
.. literalinclude:: quick_tour/package/development.ini
:language: ini
- :start-after: Start Includes
- :end-before: End Includes
-
-You'll now see an attractive (and
-collapsible) menu in the right of your browser, providing introspective
-access to debugging information. Even better, if your web application
-generates an error, you will see a nice traceback on the screen. When
-you want to disable this toolbar, no need to change code: you can
-remove it from ``pyramid.includes`` in the relevant ``.ini``
-configuration file.
+ :linenos:
+ :lineno-start: 15
+ :lines: 15-16
+
+You'll now see a Pyramid logo on the right side of your browser window, which
+when clicked opens a new window that provides introspective access to debugging
+information. Even better, if your web application generates an error, you will
+see a nice traceback on the screen. When you want to disable this toolbar,
+there's no need to change code: you can remove it from ``pyramid.includes`` in
+the relevant ``.ini`` configuration file.
.. seealso:: See also:
- :ref:`Quick Tutorial
- pyramid_debugtoolbar <qtut_debugtoolbar>` and
+ :ref:`Quick Tutorial pyramid_debugtoolbar <qtut_debugtoolbar>` and
:ref:`pyramid_debugtoolbar <toolbar:overview>`
-Unit Tests and ``nose``
+Unit tests and ``nose``
=======================
-Yikes! We got this far and we haven't yet discussed tests. Particularly
-egregious, as Pyramid has had a deep commitment to full test coverage
-since before it was released.
+Yikes! We got this far and we haven't yet discussed tests. This is particularly
+egregious, as Pyramid has had a deep commitment to full test coverage since
+before its release.
-Our ``pyramid_jinja2_starter`` scaffold generated a ``tests.py`` module
-with one unit test in it. To run it, let's install the handy ``nose``
-test runner by editing ``setup.py``. While we're at it, we'll throw in
-the ``coverage`` tool which yells at us for code that isn't tested:
+Our ``pyramid_jinja2_starter`` scaffold generated a ``tests.py`` module with
+one unit test in it. To run it, let's install the handy ``nose`` test runner by
+editing ``setup.py``. While we're at it, we'll throw in the ``coverage`` tool
+which yells at us for code that isn't tested. Edit line 36 so it becomes the
+following:
.. code-block:: python
+ :linenos:
+ :lineno-start: 36
- setup(name='hello_world',
- # Some lines removed...
- extras_require={
+ tests_require={
'testing': ['nose', 'coverage'],
- }
- )
+ },
-We changed ``setup.py`` which means we need to re-run
+We changed ``setup.py`` which means we need to rerun
``python ./setup.py develop``. We can now run all our tests:
.. code-block:: bash
@@ -666,136 +678,150 @@ We changed ``setup.py`` which means we need to re-run
.
Name Stmts Miss Cover Missing
---------------------------------------------------
- hello_world 12 8 33% 11-23
- hello_world.models 5 1 80% 8
- hello_world.tests 14 0 100%
- hello_world.views 4 0 100%
+ hello_world 11 8 27% 11-23
+ hello_world.models 5 1 80% 8
+ hello_world.tests 14 0 100%
+ hello_world.views 4 0 100%
---------------------------------------------------
- TOTAL 35 9 74%
+ TOTAL 34 9 74%
----------------------------------------------------------------------
- Ran 1 test in 0.931s
+ Ran 1 test in 0.009s
OK
Our unit test passed. What did our test look like?
.. literalinclude:: quick_tour/package/hello_world/tests.py
+ :linenos:
-Pyramid supplies helpers for test writing, which we use in the
-test setup and teardown. Our one test imports the view,
-makes a dummy request, and sees if the view returns what we expected.
+Pyramid supplies helpers for test writing, which we use in the test setup and
+teardown. Our one test imports the view, makes a dummy request, and sees if the
+view returns what we expected.
.. seealso:: See also:
- :ref:`Quick Tutorial Unit Testing <qtut_unit_testing>`,
- :ref:`Quick Tutorial Functional Testing <qtut_functional_testing>`,
- and
+ :ref:`Quick Tutorial Unit Testing <qtut_unit_testing>`, :ref:`Quick
+ Tutorial Functional Testing <qtut_functional_testing>`, and
:ref:`testing_chapter`
Logging
=======
-It's important to know what is going on inside our web application.
-In development we might need to collect some output. In production,
-we might need to detect situations when other people use the site. We
-need *logging*.
+It's important to know what is going on inside our web application. In
+development we might need to collect some output. In production we might need
+to detect situations when other people use the site. We need *logging*.
-Fortunately Pyramid uses the normal Python approach to logging. The
-scaffold generated in your ``development.ini`` a number of lines that
-configure the logging for you to some reasonable defaults. You then see
-messages sent by Pyramid (for example, when a new request comes in).
+Fortunately Pyramid uses the normal Python approach to logging. The scaffold
+generated in your ``development.ini`` has a number of lines that configure the
+logging for you to some reasonable defaults. You then see messages sent by
+Pyramid (for example, when a new request comes in).
-Maybe you would like to log messages in your code? In your Python
-module, import and set up the logging:
+Maybe you would like to log messages in your code? In your Python module,
+import and set up the logging:
.. literalinclude:: quick_tour/package/hello_world/views.py
- :start-after: Start Logging 1
- :end-before: End Logging 1
+ :language: python
+ :linenos:
+ :lineno-start: 3
+ :lines: 3-4
You can now, in your code, log messages:
.. literalinclude:: quick_tour/package/hello_world/views.py
- :start-after: Start Logging 2
- :end-before: End Logging 2
+ :language: python
+ :linenos:
+ :lineno-start: 9
+ :lines: 9-10
+ :emphasize-lines: 2
-This will log ``Some Message`` at a ``debug`` log level,
-to the application-configured logger in your ``development.ini``. What
-controls that? These sections in the configuration file:
+This will log ``Some Message`` at a ``debug`` log level to the
+application-configured logger in your ``development.ini``. What controls that?
+These emphasized sections in the configuration file:
.. literalinclude:: quick_tour/package/development.ini
:language: ini
- :start-after: Start Sphinx Include
- :end-before: End Sphinx Include
+ :linenos:
+ :lineno-start: 36
+ :lines: 36-52
+ :emphasize-lines: 1-2,14-17
-Our application, a package named ``hello_world``, is set up as a logger
-and configured to log messages at a ``DEBUG`` or higher level. When you
-visit ``http://localhost:6543`` your console will now show::
+Our application, a package named ``hello_world``, is set up as a logger and
+configured to log messages at a ``DEBUG`` or higher level. When you visit
+http://localhost:6543, your console will now show::
- 2013-08-09 10:42:42,968 DEBUG [hello_world.views][MainThread] Some Message
+ 2016-01-18 13:55:55,040 DEBUG [hello_world.views:10][waitress] Some Message
.. seealso:: See also:
- :ref:`Quick Tutorial Logging <qtut_logging>` and
- :ref:`logging_chapter`
+ :ref:`Quick Tutorial Logging <qtut_logging>` and :ref:`logging_chapter`.
Sessions
========
-When people use your web application, they frequently perform a task
-that requires semi-permanent data to be saved. For example, a shopping
-cart. This is called a :term:`session`.
+When people use your web application, they frequently perform a task that
+requires semi-permanent data to be saved. For example, a shopping cart. This is
+called a :term:`session`.
-Pyramid has basic built-in support for sessions. Third party packages such as
-``pyramid_redis_sessions`` provide richer session support. Or you can create
-your own custom sessioning engine. Let's take a look at the
-:doc:`built-in sessioning support <../narr/sessions>`. In our
-``__init__.py`` we first import the kind of sessioning we want:
+Pyramid has basic built-in support for sessions. Third party packages such as
+``pyramid_redis_sessions`` provide richer session support. Or you can create
+your own custom sessioning engine. Let's take a look at the :doc:`built-in
+sessioning support <../narr/sessions>`. In our ``__init__.py`` we first import
+the kind of sessioning we want:
.. literalinclude:: quick_tour/package/hello_world/__init__.py
- :start-after: Start Sphinx Include 1
- :end-before: End Sphinx Include 1
+ :language: python
+ :linenos:
+ :lineno-start: 2
+ :lines: 2-3
+ :emphasize-lines: 2
.. warning::
- As noted in the session docs, this example implementation is
- not intended for use in settings with security implications.
+ As noted in the session docs, this example implementation is not intended
+ for use in settings with security implications.
Now make a "factory" and pass it to the :term:`configurator`'s
``session_factory`` argument:
.. literalinclude:: quick_tour/package/hello_world/__init__.py
- :start-after: Start Sphinx Include 2
- :end-before: End Sphinx Include 2
+ :language: python
+ :linenos:
+ :lineno-start: 13
+ :lines: 13-17
+ :emphasize-lines: 3-5
-Pyramid's :term:`request` object now has a ``session`` attribute
-that we can use in our view code:
+Pyramid's :term:`request` object now has a ``session`` attribute that we can
+use in our view code in ``views.py``:
.. literalinclude:: quick_tour/package/hello_world/views.py
- :start-after: Start Sphinx Include 1
- :end-before: End Sphinx Include 1
+ :language: python
+ :linenos:
+ :lineno-start: 9
+ :lines: 9-15
+ :emphasize-lines: 3-7
-With this, each reload will increase the counter displayed in our
-Jinja2 template:
+We need to update our Jinja2 template to show counter increment in the session:
.. literalinclude:: quick_tour/package/hello_world/templates/mytemplate.jinja2
:language: jinja
- :start-after: Start Sphinx Include 1
- :end-before: End Sphinx Include 1
+ :linenos:
+ :lineno-start: 40
+ :lines: 40-42
+ :emphasize-lines: 3
.. seealso:: See also:
- :ref:`Quick Tutorial Sessions <qtut_sessions>`,
- :ref:`sessions_chapter`, :ref:`flash_messages`,
- :ref:`session_module`, and :term:`pyramid_redis_sessions`.
+ :ref:`Quick Tutorial Sessions <qtut_sessions>`, :ref:`sessions_chapter`,
+ :ref:`flash_messages`, :ref:`session_module`, and
+ :term:`pyramid_redis_sessions`.
+
Databases
=========
-Web applications mean data. Data means databases. Frequently SQL
-databases. SQL databases frequently mean an "ORM"
-(object-relational mapper.) In Python, ORM usually leads to the
-mega-quality *SQLAlchemy*, a Python package that greatly eases working
-with databases.
+Web applications mean data. Data means databases. Frequently SQL databases. SQL
+databases frequently mean an "ORM" (object-relational mapper.) In Python, ORM
+usually leads to the mega-quality *SQLAlchemy*, a Python package that greatly
+eases working with databases.
-Pyramid and SQLAlchemy are great friends. That friendship includes a
-scaffold!
+Pyramid and SQLAlchemy are great friends. That friendship includes a scaffold!
.. code-block:: bash
@@ -803,50 +829,53 @@ scaffold!
$ cd sqla_demo
$ python setup.py develop
-We now have a working sample SQLAlchemy application with all
-dependencies installed. The sample project provides a console script to
-initialize a SQLite database with tables. Let's run it and then start
-the application:
+We now have a working sample SQLAlchemy application with all dependencies
+installed. The sample project provides a console script to initialize a SQLite
+database with tables. Let's run it, then start the application:
.. code-block:: bash
$ initialize_sqla_demo_db development.ini
$ pserve development.ini
-The ORM eases the mapping of database structures into a programming
-language. SQLAlchemy uses "models" for this mapping. The scaffold
-generated a sample model:
+The ORM eases the mapping of database structures into a programming language.
+SQLAlchemy uses "models" for this mapping. The scaffold generated a sample
+model:
.. literalinclude:: quick_tour/sqla_demo/sqla_demo/models.py
- :start-after: Start Sphinx Include
- :end-before: End Sphinx Include
+ :language: python
+ :linenos:
+ :lineno-start: 21
+ :lines: 21-
-View code, which mediates the logic between web requests and the rest
-of the system, can then easily get at the data thanks to SQLAlchemy:
+View code, which mediates the logic between web requests and the rest of the
+system, can then easily get at the data thanks to SQLAlchemy:
.. literalinclude:: quick_tour/sqla_demo/sqla_demo/views.py
- :start-after: Start Sphinx Include
- :end-before: End Sphinx Include
+ :language: python
+ :linenos:
+ :lineno-start: 12
+ :lines: 12-18
+ :emphasize-lines: 4
.. seealso:: See also:
- :ref:`Quick Tutorial Databases <qtut_databases>`,
- `SQLAlchemy <http://www.sqlalchemy.org/>`_,
- :ref:`making_a_console_script`,
- :ref:`bfg_sql_wiki_tutorial`, and
- :ref:`Application Transactions With pyramid_tm <tm:overview>`
+ :ref:`Quick Tutorial Databases <qtut_databases>`, `SQLAlchemy
+ <http://www.sqlalchemy.org/>`_, :ref:`making_a_console_script`,
+ :ref:`bfg_sql_wiki_tutorial`, and :ref:`Application Transactions with
+ pyramid_tm <tm:overview>`.
+
Forms
=====
-Developers have lots of opinions about web forms, and thus there are many
-form libraries for Python. Pyramid doesn't directly bundle a form
-library, but *Deform* is a popular choice for forms,
-along with its related *Colander* schema system.
+Developers have lots of opinions about web forms, thus there are many form
+libraries for Python. Pyramid doesn't directly bundle a form library, but
+*Deform* is a popular choice for forms, along with its related *Colander*
+schema system.
-As an example, imagine we want a form that edits a wiki page. The form
-should have two fields on it, one of them a required title and the
-other a rich text editor for the body. With Deform we can express this
-as a Colander schema:
+As an example, imagine we want a form that edits a wiki page. The form should
+have two fields on it, one of them a required title and the other a rich text
+editor for the body. With Deform we can express this as a Colander schema:
.. code-block:: python
@@ -857,8 +886,8 @@ as a Colander schema:
widget=deform.widget.RichTextWidget()
)
-With this in place, we can render the HTML for a form,
-perhaps with form data from an existing page:
+With this in place, we can render the HTML for a form, perhaps with form data
+from an existing page:
.. code-block:: python
@@ -882,20 +911,18 @@ We'd like to handle form submission, validation, and saving:
page['title'] = appstruct['title']
page['body'] = appstruct['body']
-Deform and Colander provide a very flexible combination for forms,
-widgets, schemas, and validation. Recent versions of Deform also
-include a :ref:`retail mode <deform:retail>` for gaining Deform
-features on custom forms.
+Deform and Colander provide a very flexible combination for forms, widgets,
+schemas, and validation. Recent versions of Deform also include a :ref:`retail
+mode <deform:retail>` for gaining Deform features on custom forms.
-Also, the ``deform_bootstrap`` Pyramid add-on restyles the stock Deform
-widgets using attractive CSS from Bootstrap and more powerful widgets
-from Chosen.
+Also the ``deform_bootstrap`` Pyramid add-on restyles the stock Deform widgets
+using attractive CSS from Twitter Bootstrap and more powerful widgets from
+Chosen.
.. seealso:: See also:
- :ref:`Quick Tutorial Forms <qtut_forms>`,
- :ref:`Deform <deform:overview>`,
- :ref:`Colander <colander:overview>`, and
- `deform_bootstrap <https://pypi.python.org/pypi/deform_bootstrap>`_
+ :ref:`Quick Tutorial Forms <qtut_forms>`, :ref:`Deform <deform:overview>`,
+ :ref:`Colander <colander:overview>`, and `deform_bootstrap
+ <https://pypi.python.org/pypi/deform_bootstrap>`_.
Conclusion
==========
diff --git a/docs/quick_tour/awesome/CHANGES.txt b/docs/quick_tour/awesome/CHANGES.txt
deleted file mode 100644
index ffa255da8..000000000
--- a/docs/quick_tour/awesome/CHANGES.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-0.0
----
-
-- Initial version
diff --git a/docs/quick_tour/awesome/MANIFEST.in b/docs/quick_tour/awesome/MANIFEST.in
deleted file mode 100644
index e78395da8..000000000
--- a/docs/quick_tour/awesome/MANIFEST.in
+++ /dev/null
@@ -1,2 +0,0 @@
-include *.txt *.ini *.cfg *.rst
-recursive-include awesome *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
diff --git a/docs/quick_tour/awesome/README.txt b/docs/quick_tour/awesome/README.txt
deleted file mode 100644
index f695286d9..000000000
--- a/docs/quick_tour/awesome/README.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-awesome README
-
-
-
diff --git a/docs/quick_tour/awesome/awesome/__init__.py b/docs/quick_tour/awesome/awesome/__init__.py
deleted file mode 100644
index 408033997..000000000
--- a/docs/quick_tour/awesome/awesome/__init__.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from pyramid.config import Configurator
-from pyramid_jinja2 import renderer_factory
-from awesome.models import get_root
-
-def main(global_config, **settings):
- """ This function returns a WSGI application.
-
- It is usually called by the PasteDeploy framework during
- ``paster serve``.
- """
- settings = dict(settings)
- settings.setdefault('jinja2.i18n.domain', 'awesome')
-
- config = Configurator(root_factory=get_root, settings=settings)
- config.add_translation_dirs('locale/')
- config.include('pyramid_jinja2')
-
- config.add_static_view('static', 'static')
- config.add_view('awesome.views.my_view',
- context='awesome.models.MyModel',
- renderer="mytemplate.jinja2")
-
- return config.make_wsgi_app()
diff --git a/docs/quick_tour/awesome/awesome/locale/awesome.pot b/docs/quick_tour/awesome/awesome/locale/awesome.pot
deleted file mode 100644
index 9c9460cb2..000000000
--- a/docs/quick_tour/awesome/awesome/locale/awesome.pot
+++ /dev/null
@@ -1,21 +0,0 @@
-# Translations template for PROJECT.
-# Copyright (C) 2011 ORGANIZATION
-# This file is distributed under the same license as the PROJECT project.
-# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2011-05-12 09:14-0330\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Generated-By: Babel 0.9.6\n"
-
-msgid "Hello!"
-msgstr ""
diff --git a/docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.mo b/docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.mo
deleted file mode 100644
index 40bf0c271..000000000
--- a/docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.mo
+++ /dev/null
Binary files differ
diff --git a/docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.po b/docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.po
deleted file mode 100644
index 0df243dba..000000000
--- a/docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.po
+++ /dev/null
@@ -1,21 +0,0 @@
-# Translations template for PROJECT.
-# Copyright (C) 2011 ORGANIZATION
-# This file is distributed under the same license as the PROJECT project.
-# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2011-05-12 09:14-0330\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Generated-By: Babel 0.9.6\n"
-
-msgid "Hello!"
-msgstr "Hallo!"
diff --git a/docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.mo b/docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.mo
deleted file mode 100644
index 4fc438bfe..000000000
--- a/docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.mo
+++ /dev/null
Binary files differ
diff --git a/docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.po b/docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.po
deleted file mode 100644
index dc0aae5d7..000000000
--- a/docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.po
+++ /dev/null
@@ -1,21 +0,0 @@
-# Translations template for PROJECT.
-# Copyright (C) 2011 ORGANIZATION
-# This file is distributed under the same license as the PROJECT project.
-# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2011-05-12 09:14-0330\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Generated-By: Babel 0.9.6\n"
-
-msgid "Hello!"
-msgstr "Bonjour!"
diff --git a/docs/quick_tour/awesome/awesome/static/favicon.ico b/docs/quick_tour/awesome/awesome/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/quick_tour/awesome/awesome/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/quick_tour/awesome/awesome/static/logo.png b/docs/quick_tour/awesome/awesome/static/logo.png
deleted file mode 100644
index 88f5d9865..000000000
--- a/docs/quick_tour/awesome/awesome/static/logo.png
+++ /dev/null
Binary files differ
diff --git a/docs/quick_tour/awesome/awesome/static/pylons.css b/docs/quick_tour/awesome/awesome/static/pylons.css
deleted file mode 100644
index 42e2e320e..000000000
--- a/docs/quick_tour/awesome/awesome/static/pylons.css
+++ /dev/null
@@ -1,73 +0,0 @@
-html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;/* 16px */
-vertical-align:baseline;background:transparent;}
-body{line-height:1;}
-ol,ul{list-style:none;}
-blockquote,q{quotes:none;}
-blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}
-/* remember to define focus styles! */
-:focus{outline:0;}
-/* remember to highlight inserts somehow! */
-ins{text-decoration:none;}
-del{text-decoration:line-through;}
-/* tables still need 'cellspacing="0"' in the markup */
-table{border-collapse:collapse;border-spacing:0;}
-/* restyling */
-sub{vertical-align:sub;font-size:smaller;line-height:normal;}
-sup{vertical-align:super;font-size:smaller;line-height:normal;}
-/* lists */
-ul,menu,dir{display:block;list-style-type:disc;margin:1em 0;padding-left:40px;}
-ol{display:block;list-style-type:decimal-leading-zero;margin:1em 0;padding-left:40px;}
-li{display:list-item;}
-/* nested lists have no top/bottom margins */
-ul ul,ul ol,ul dir,ul menu,ul dl,ol ul,ol ol,ol dir,ol menu,ol dl,dir ul,dir ol,dir dir,dir menu,dir dl,menu ul,menu ol,menu dir,menu menu,menu dl,dl ul,dl ol,dl dir,dl menu,dl dl{margin-top:0;margin-bottom:0;}
-/* 2 deep unordered lists use a circle */
-ol ul,ul ul,menu ul,dir ul,ol menu,ul menu,menu menu,dir menu,ol dir,ul dir,menu dir,dir dir{list-style-type:circle;}
-/* 3 deep (or more) unordered lists use a square */
-ol ol ul,ol ul ul,ol menu ul,ol dir ul,ol ol menu,ol ul menu,ol menu menu,ol dir menu,ol ol dir,ol ul dir,ol menu dir,ol dir dir,ul ol ul,ul ul ul,ul menu ul,ul dir ul,ul ol menu,ul ul menu,ul menu menu,ul dir menu,ul ol dir,ul ul dir,ul menu dir,ul dir dir,menu ol ul,menu ul ul,menu menu ul,menu dir ul,menu ol menu,menu ul menu,menu menu menu,menu dir menu,menu ol dir,menu ul dir,menu menu dir,menu dir dir,dir ol ul,dir ul ul,dir menu ul,dir dir ul,dir ol menu,dir ul menu,dir menu menu,dir dir menu,dir ol dir,dir ul dir,dir menu dir,dir dir dir{list-style-type:square;}
-.hidden{display:none;}
-p{line-height:1.5em;}
-h1{font-size:1.75em;/* 28px */
-line-height:1.7em;font-family:helvetica,verdana;}
-h2{font-size:1.5em;/* 24px */
-line-height:1.7em;font-family:helvetica,verdana;}
-h3{font-size:1.25em;/* 20px */
-line-height:1.7em;font-family:helvetica,verdana;}
-h4{font-size:1em;line-height:1.7em;font-family:helvetica,verdana;}
-html,body{width:100%;height:100%;}
-body{margin:0;padding:0;background-color:#ffffff;position:relative;font:16px/24px "Nobile","Lucida Grande",Lucida,Verdana,sans-serif;}
-a{color:#1b61d6;text-decoration:none;}
-a:hover{color:#e88f00;text-decoration:underline;}
-body h1,
-body h2,
-body h3,
-body h4,
-body h5,
-body h6{font-family:"Nobile","Lucida Grande",Lucida,Verdana,sans-serif;font-weight:normal;color:#144fb2;font-style:normal;}
-#wrap {min-height: 100%;}
-#header,#footer{width:100%;color:#ffffff;height:40px;position:absolute;text-align:center;line-height:40px;overflow:hidden;font-size:12px;}
-#header{background-color:#e88f00;top:0;font-size:14px;}
-#footer{background-color:#000000;bottom:0;position: relative;margin-top:-40px;clear:both;}
-.header,.footer{width:700px;margin-right:auto;margin-left:auto;}
-.wrapper{width:100%}
-#top,#bottom{width:100%;}
-#top{color:#888;background-color:#eee;height:300px;border-bottom:2px solid #ddd;}
-#bottom{color:#222;background-color:#ffffff;overflow:auto;padding-bottom:80px;}
-.top,.bottom{width:700px;margin-right:auto;margin-left:auto;}
-.top{padding-top:100px;}
-.app-welcome{margin-top:25px;}
-.app-name{color:#000000;font-weight:bold;}
-.bottom{padding-top:50px;}
-#left{width:325px;float:left;padding-right:25px;}
-#right{width:325px;float:right;padding-left:25px;}
-.align-left{text-align:left;}
-.align-right{text-align:right;}
-.align-center{text-align:center;}
-ul.links{margin:0;padding:0;}
-ul.links li{list-style-type:none;font-size:14px;}
-form{border-style:none;}
-fieldset{border-style:none;}
-input{color:#222;border:1px solid #ccc;font-family:sans-serif;font-size:12px;line-height:16px;}
-input[type=text]{}
-input[type=submit]{background-color:#ddd;font-weight:bold;}
-/*Opera Fix*/
-body:before {content:"";height:100%;float:left;width:0;margin-top:-32767px;}
diff --git a/docs/quick_tour/awesome/awesome/templates/mytemplate.jinja2 b/docs/quick_tour/awesome/awesome/templates/mytemplate.jinja2
deleted file mode 100644
index 8bf676041..000000000
--- a/docs/quick_tour/awesome/awesome/templates/mytemplate.jinja2
+++ /dev/null
@@ -1,87 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="{{request.application_url}}/static/favicon.ico" />
- <link rel="stylesheet" href="{{request.application_url}}/static/pylons.css" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <!--[if !IE 7]>
- <style type="text/css">
- #wrap {display:table;height:100%}
- </style>
- <![endif]-->
- <style type="text/css">
- .locale { text-align: center; }
- .locale-name { font-weight: bold; }
- </style>
-</head>
-<body>
- <div id="wrap">
- <div id="header">
- <div class="header">The Pyramid Web Framework</div>
- </div>
- <div id="top">
- <div class="top align-center">
- <img src="{{request.application_url}}/static/logo.png" width="300" height="80" alt="Logo"/>
- <p class="app-welcome">
- Welcome to <span class="app-name">{{project}}</span>, an application generated by<br/>
- the Pyramid web framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="locale">
- <h2>{% trans %}Hello!{% endtrans %}</h2>
- <p>Request performed with <span class="locale-name">{{ request.locale_name }}</span> locale.</p>
- </div>
- <div class="bottom">
- <div id="left" class="align-right">
- <h3>Search Pyramid documentation</h3>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Search" />
- </form>
- </div>
- <div id="right" class="align-left">
- <h3>Pyramid links</h3>
- <ul class="links">
- <li>
- <a href="http://pylonshq.com">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/">The Pylons Project Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- <div id="footer">
- <div class="footer">© Copyright 2008-2010, Agendaless Consulting.</div>
- </div>
-</body>
-</html>
diff --git a/docs/quick_tour/awesome/awesome/tests.py b/docs/quick_tour/awesome/awesome/tests.py
deleted file mode 100644
index ac222e25b..000000000
--- a/docs/quick_tour/awesome/awesome/tests.py
+++ /dev/null
@@ -1,21 +0,0 @@
-import unittest
-from pyramid import testing
-from pyramid.i18n import TranslationStringFactory
-
-_ = TranslationStringFactory('awesome')
-
-
-class ViewTests(unittest.TestCase):
-
- def setUp(self):
- testing.setUp()
-
- def tearDown(self):
- testing.tearDown()
-
- def test_my_view(self):
- from awesome.views import my_view
- request = testing.DummyRequest()
- response = my_view(request)
- self.assertEqual(response['project'], 'awesome')
-
diff --git a/docs/quick_tour/awesome/awesome/views.py b/docs/quick_tour/awesome/awesome/views.py
deleted file mode 100644
index 67b282f87..000000000
--- a/docs/quick_tour/awesome/awesome/views.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from pyramid.i18n import TranslationStringFactory
-
-_ = TranslationStringFactory('awesome')
-
-def my_view(request):
- return {'project':'awesome'}
diff --git a/docs/quick_tour/awesome/development.ini b/docs/quick_tour/awesome/development.ini
deleted file mode 100644
index a473d32f1..000000000
--- a/docs/quick_tour/awesome/development.ini
+++ /dev/null
@@ -1,49 +0,0 @@
-[app:awesome]
-use = egg:awesome
-reload_templates = true
-debug_authorization = false
-debug_notfound = false
-debug_routematch = false
-debug_templates = true
-default_locale_name = en
-jinja2.directories = awesome:templates
-
-[pipeline:main]
-pipeline =
- awesome
-
-[server:main]
-use = egg:pyramid#wsgiref
-host = 0.0.0.0
-port = 6543
-
-# Begin logging configuration
-
-[loggers]
-keys = root, awesome
-
-[handlers]
-keys = console
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = console
-
-[logger_awesome]
-level = DEBUG
-handlers =
-qualname = awesome
-
-[handler_console]
-class = StreamHandler
-args = (sys.stderr,)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
-
-# End logging configuration
diff --git a/docs/quick_tour/awesome/message-extraction.ini b/docs/quick_tour/awesome/message-extraction.ini
deleted file mode 100644
index 0c3d54bc1..000000000
--- a/docs/quick_tour/awesome/message-extraction.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[python: **.py]
-[jinja2: **.jinja2]
-encoding = utf-8
diff --git a/docs/quick_tour/awesome/setup.py b/docs/quick_tour/awesome/setup.py
deleted file mode 100644
index 32d666317..000000000
--- a/docs/quick_tour/awesome/setup.py
+++ /dev/null
@@ -1,36 +0,0 @@
-import os
-
-from setuptools import setup, find_packages
-
-here = os.path.abspath(os.path.dirname(__file__))
-README = open(os.path.join(here, 'README.txt')).read()
-CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
-
-requires=['pyramid>=1.0.2', 'pyramid_jinja2']
-
-setup(name='awesome',
- version='0.0',
- description='awesome',
- long_description=README + '\n\n' + CHANGES,
- classifiers=[
- "Programming Language :: Python",
- "Framework :: Pylons",
- "Topic :: Internet :: WWW/HTTP",
- "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
- ],
- author='',
- author_email='',
- url='',
- keywords='web pyramid pylons',
- packages=find_packages(),
- include_package_data=True,
- zip_safe=False,
- install_requires=requires,
- tests_require=requires,
- test_suite="awesome",
- entry_points = """\
- [paste.app_factory]
- main = awesome:main
- """,
- paster_plugins=['pyramid'],
- )
diff --git a/docs/quick_tour/hello_world/app.py b/docs/quick_tour/hello_world/app.py
index df5a6cf18..75d22ac96 100644
--- a/docs/quick_tour/hello_world/app.py
+++ b/docs/quick_tour/hello_world/app.py
@@ -13,4 +13,4 @@ if __name__ == '__main__':
config.add_view(hello_world, route_name='hello')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/jinja2/app.py b/docs/quick_tour/jinja2/app.py
index 83af219db..b7632807b 100644
--- a/docs/quick_tour/jinja2/app.py
+++ b/docs/quick_tour/jinja2/app.py
@@ -8,4 +8,4 @@ if __name__ == '__main__':
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/jinja2/views.py b/docs/quick_tour/jinja2/views.py
index 916cdc720..7dbb45287 100644
--- a/docs/quick_tour/jinja2/views.py
+++ b/docs/quick_tour/jinja2/views.py
@@ -1,8 +1,6 @@
from pyramid.view import view_config
-# Start View 1
@view_config(route_name='hello', renderer='hello_world.jinja2')
-# End View 1
def hello_world(request):
return dict(name=request.matchdict['name'])
diff --git a/docs/quick_tour/json/app.py b/docs/quick_tour/json/app.py
index 950cb478f..40faddd00 100644
--- a/docs/quick_tour/json/app.py
+++ b/docs/quick_tour/json/app.py
@@ -1,8 +1,6 @@
from wsgiref.simple_server import make_server
-
from pyramid.config import Configurator
-
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/howdy/{name}')
@@ -12,4 +10,4 @@ if __name__ == '__main__':
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/json/hello_world.jinja2 b/docs/quick_tour/json/hello_world.jinja2
index f6862e618..4fb9be074 100644
--- a/docs/quick_tour/json/hello_world.jinja2
+++ b/docs/quick_tour/json/hello_world.jinja2
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Glance</title>
- <link rel="stylesheet" href="/static/app.css"/>
+ <title>Hello World</title>
+ <link rel="stylesheet" href="{{ request.static_url('static/app.css') }}"/>
</head>
<body>
<h1>Hello {{ name }}!</h1>
diff --git a/docs/quick_tour/json/hello_world.pt b/docs/quick_tour/json/hello_world.pt
deleted file mode 100644
index 711054aa9..000000000
--- a/docs/quick_tour/json/hello_world.pt
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <title>Quick Glance</title>
- <!-- Start Link 1 -->
- <link rel="stylesheet" href="/static/app.css" />
- <!-- End Link 1 -->
- <!-- Start Link 2 -->
- <link rel="stylesheet"
- href="${request.static_url('static/app.css')}"
- />
- <!-- End Link 2 -->
-</head>
-<body>
-<h1>Hello ${name}!</h1>
-</body>
-</html> \ No newline at end of file
diff --git a/docs/quick_tour/json/views.py b/docs/quick_tour/json/views.py
index 583e220c7..22aa8aad6 100644
--- a/docs/quick_tour/json/views.py
+++ b/docs/quick_tour/json/views.py
@@ -1,13 +1,11 @@
from pyramid.view import view_config
-@view_config(route_name='hello', renderer='hello_world.pt')
+@view_config(route_name='hello', renderer='hello_world.jinja2')
def hello_world(request):
return dict(name=request.matchdict['name'])
-# Start View 1
@view_config(route_name='hello_json', renderer='json')
def hello_json(request):
return [1, 2, 3]
- # End View 1 \ No newline at end of file
diff --git a/docs/quick_tour/package/MANIFEST.in b/docs/quick_tour/package/MANIFEST.in
index 18fbd855c..1d0352f7d 100644
--- a/docs/quick_tour/package/MANIFEST.in
+++ b/docs/quick_tour/package/MANIFEST.in
@@ -1,2 +1,2 @@
include *.txt *.ini *.cfg *.rst
-recursive-include hello_world *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
+recursive-include hello_world *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.jinja2 *.js *.html *.xml
diff --git a/docs/quick_tour/package/development.ini b/docs/quick_tour/package/development.ini
index a3a73e885..20f9817a9 100644
--- a/docs/quick_tour/package/development.ini
+++ b/docs/quick_tour/package/development.ini
@@ -1,37 +1,41 @@
-# Start Includes
-[app:hello_world]
-pyramid.includes = pyramid_debugtoolbar
-# End Includes
+###
+# app configuration
+# http://docs.pylonsproject.org/projects/pyramid/en/1.6-branch/narr/environment.html
+###
+
+[app:main]
use = egg:hello_world
-reload_templates = true
-debug_authorization = false
-debug_notfound = false
-debug_routematch = false
-debug_templates = true
-default_locale_name = en
-jinja2.directories = hello_world:templates
-
-[pipeline:main]
-pipeline =
- hello_world
+
+pyramid.reload_templates = true
+pyramid.debug_authorization = false
+pyramid.debug_notfound = false
+pyramid.debug_routematch = false
+pyramid.debug_templates = true
+pyramid.default_locale_name = en
+pyramid.includes =
+ pyramid_debugtoolbar
+
+# By default, the toolbar only appears for clients from IP addresses
+# '127.0.0.1' and '::1'.
+# debugtoolbar.hosts = 127.0.0.1 ::1
+
+###
+# wsgi server configuration
+###
[server:main]
-use = egg:pyramid#wsgiref
-host = 0.0.0.0
+use = egg:waitress#main
+host = 127.0.0.1
port = 6543
-# Begin logging configuration
+###
+# logging configuration
+# http://docs.pylonsproject.org/projects/pyramid/en/1.6-branch/narr/logging.html
+###
-# Start Sphinx Include
[loggers]
keys = root, hello_world
-[logger_hello_world]
-level = DEBUG
-handlers =
-qualname = hello_world
-# End Sphinx Include
-
[handlers]
keys = console
@@ -42,6 +46,11 @@ keys = generic
level = INFO
handlers = console
+[logger_hello_world]
+level = DEBUG
+handlers =
+qualname = hello_world
+
[handler_console]
class = StreamHandler
args = (sys.stderr,)
@@ -49,6 +58,4 @@ level = NOTSET
formatter = generic
[formatter_generic]
-format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
-
-# End logging configuration
+format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
diff --git a/docs/quick_tour/package/hello_world/__init__.py b/docs/quick_tour/package/hello_world/__init__.py
index 4a4fbec30..97f93d5a8 100644
--- a/docs/quick_tour/package/hello_world/__init__.py
+++ b/docs/quick_tour/package/hello_world/__init__.py
@@ -1,10 +1,7 @@
from pyramid.config import Configurator
-from pyramid_jinja2 import renderer_factory
-# Start Sphinx Include 1
+from hello_world.resources import get_root
from pyramid.session import SignedCookieSessionFactory
-# End Sphinx Include 1
-from hello_world.models import get_root
def main(global_config, **settings):
""" This function returns a WSGI application.
@@ -15,20 +12,15 @@ def main(global_config, **settings):
settings = dict(settings)
settings.setdefault('jinja2.i18n.domain', 'hello_world')
- # Start Sphinx Include 2
my_session_factory = SignedCookieSessionFactory('itsaseekreet')
config = Configurator(root_factory=get_root, settings=settings,
session_factory=my_session_factory)
- # End Sphinx Include 2
config.add_translation_dirs('locale/')
- # Start Include
config.include('pyramid_jinja2')
- # End Include
-
config.add_static_view('static', 'static')
config.add_view('hello_world.views.my_view',
- context='hello_world.models.MyModel',
- renderer="mytemplate.jinja2")
+ context='hello_world.resources.MyResource',
+ renderer="templates/mytemplate.jinja2")
return config.make_wsgi_app()
diff --git a/docs/quick_tour/package/hello_world/init.py b/docs/quick_tour/package/hello_world/init.py
deleted file mode 100644
index 5b5f6a118..000000000
--- a/docs/quick_tour/package/hello_world/init.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from pyramid.config import Configurator
-from pyramid_jinja2 import renderer_factory
-# Start Sphinx 1
-from pyramid.session import SignedCookieSessionFactory
-# End Sphinx 1
-
-from hello_world.models import get_root
-
-def main(global_config, **settings):
- """ This function returns a WSGI application.
-
- It is usually called by the PasteDeploy framework during
- ``paster serve``.
- """
- settings = dict(settings)
- settings.setdefault('jinja2.i18n.domain', 'hello_world')
-
- config = Configurator(root_factory=get_root, settings=settings)
- config.add_translation_dirs('locale/')
- # Start Include
- config.include('pyramid_jinja2')
- # End Include
-
- # Start Sphinx Include 2
- my_session_factory = SignedCookieSessionFactory('itsaseekreet')
- config = Configurator(session_factory=my_session_factory)
- # End Sphinx Include 2
-
- config.add_static_view('static', 'static')
- config.add_view('hello_world.views.my_view',
- context='hello_world.models.MyModel',
- renderer="mytemplate.jinja2")
-
- return config.make_wsgi_app()
diff --git a/docs/quick_tour/package/hello_world/models.py b/docs/quick_tour/package/hello_world/models.py
deleted file mode 100644
index edd361c9c..000000000
--- a/docs/quick_tour/package/hello_world/models.py
+++ /dev/null
@@ -1,8 +0,0 @@
-class MyModel(object):
- pass
-
-root = MyModel()
-
-
-def get_root(request):
- return root
diff --git a/docs/quick_tour/awesome/awesome/models.py b/docs/quick_tour/package/hello_world/resources.py
index edd361c9c..e89c2f363 100644
--- a/docs/quick_tour/awesome/awesome/models.py
+++ b/docs/quick_tour/package/hello_world/resources.py
@@ -1,7 +1,7 @@
-class MyModel(object):
+class MyResource(object):
pass
-root = MyModel()
+root = MyResource()
def get_root(request):
diff --git a/docs/quick_tour/package/hello_world/static/logo.png b/docs/quick_tour/package/hello_world/static/logo.png
deleted file mode 100644
index 88f5d9865..000000000
--- a/docs/quick_tour/package/hello_world/static/logo.png
+++ /dev/null
Binary files differ
diff --git a/docs/quick_tour/package/hello_world/static/pylons.css b/docs/quick_tour/package/hello_world/static/pylons.css
deleted file mode 100644
index 42e2e320e..000000000
--- a/docs/quick_tour/package/hello_world/static/pylons.css
+++ /dev/null
@@ -1,73 +0,0 @@
-html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;/* 16px */
-vertical-align:baseline;background:transparent;}
-body{line-height:1;}
-ol,ul{list-style:none;}
-blockquote,q{quotes:none;}
-blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}
-/* remember to define focus styles! */
-:focus{outline:0;}
-/* remember to highlight inserts somehow! */
-ins{text-decoration:none;}
-del{text-decoration:line-through;}
-/* tables still need 'cellspacing="0"' in the markup */
-table{border-collapse:collapse;border-spacing:0;}
-/* restyling */
-sub{vertical-align:sub;font-size:smaller;line-height:normal;}
-sup{vertical-align:super;font-size:smaller;line-height:normal;}
-/* lists */
-ul,menu,dir{display:block;list-style-type:disc;margin:1em 0;padding-left:40px;}
-ol{display:block;list-style-type:decimal-leading-zero;margin:1em 0;padding-left:40px;}
-li{display:list-item;}
-/* nested lists have no top/bottom margins */
-ul ul,ul ol,ul dir,ul menu,ul dl,ol ul,ol ol,ol dir,ol menu,ol dl,dir ul,dir ol,dir dir,dir menu,dir dl,menu ul,menu ol,menu dir,menu menu,menu dl,dl ul,dl ol,dl dir,dl menu,dl dl{margin-top:0;margin-bottom:0;}
-/* 2 deep unordered lists use a circle */
-ol ul,ul ul,menu ul,dir ul,ol menu,ul menu,menu menu,dir menu,ol dir,ul dir,menu dir,dir dir{list-style-type:circle;}
-/* 3 deep (or more) unordered lists use a square */
-ol ol ul,ol ul ul,ol menu ul,ol dir ul,ol ol menu,ol ul menu,ol menu menu,ol dir menu,ol ol dir,ol ul dir,ol menu dir,ol dir dir,ul ol ul,ul ul ul,ul menu ul,ul dir ul,ul ol menu,ul ul menu,ul menu menu,ul dir menu,ul ol dir,ul ul dir,ul menu dir,ul dir dir,menu ol ul,menu ul ul,menu menu ul,menu dir ul,menu ol menu,menu ul menu,menu menu menu,menu dir menu,menu ol dir,menu ul dir,menu menu dir,menu dir dir,dir ol ul,dir ul ul,dir menu ul,dir dir ul,dir ol menu,dir ul menu,dir menu menu,dir dir menu,dir ol dir,dir ul dir,dir menu dir,dir dir dir{list-style-type:square;}
-.hidden{display:none;}
-p{line-height:1.5em;}
-h1{font-size:1.75em;/* 28px */
-line-height:1.7em;font-family:helvetica,verdana;}
-h2{font-size:1.5em;/* 24px */
-line-height:1.7em;font-family:helvetica,verdana;}
-h3{font-size:1.25em;/* 20px */
-line-height:1.7em;font-family:helvetica,verdana;}
-h4{font-size:1em;line-height:1.7em;font-family:helvetica,verdana;}
-html,body{width:100%;height:100%;}
-body{margin:0;padding:0;background-color:#ffffff;position:relative;font:16px/24px "Nobile","Lucida Grande",Lucida,Verdana,sans-serif;}
-a{color:#1b61d6;text-decoration:none;}
-a:hover{color:#e88f00;text-decoration:underline;}
-body h1,
-body h2,
-body h3,
-body h4,
-body h5,
-body h6{font-family:"Nobile","Lucida Grande",Lucida,Verdana,sans-serif;font-weight:normal;color:#144fb2;font-style:normal;}
-#wrap {min-height: 100%;}
-#header,#footer{width:100%;color:#ffffff;height:40px;position:absolute;text-align:center;line-height:40px;overflow:hidden;font-size:12px;}
-#header{background-color:#e88f00;top:0;font-size:14px;}
-#footer{background-color:#000000;bottom:0;position: relative;margin-top:-40px;clear:both;}
-.header,.footer{width:700px;margin-right:auto;margin-left:auto;}
-.wrapper{width:100%}
-#top,#bottom{width:100%;}
-#top{color:#888;background-color:#eee;height:300px;border-bottom:2px solid #ddd;}
-#bottom{color:#222;background-color:#ffffff;overflow:auto;padding-bottom:80px;}
-.top,.bottom{width:700px;margin-right:auto;margin-left:auto;}
-.top{padding-top:100px;}
-.app-welcome{margin-top:25px;}
-.app-name{color:#000000;font-weight:bold;}
-.bottom{padding-top:50px;}
-#left{width:325px;float:left;padding-right:25px;}
-#right{width:325px;float:right;padding-left:25px;}
-.align-left{text-align:left;}
-.align-right{text-align:right;}
-.align-center{text-align:center;}
-ul.links{margin:0;padding:0;}
-ul.links li{list-style-type:none;font-size:14px;}
-form{border-style:none;}
-fieldset{border-style:none;}
-input{color:#222;border:1px solid #ccc;font-family:sans-serif;font-size:12px;line-height:16px;}
-input[type=text]{}
-input[type=submit]{background-color:#ddd;font-weight:bold;}
-/*Opera Fix*/
-body:before {content:"";height:100%;float:left;width:0;margin-top:-32767px;}
diff --git a/docs/quick_tour/package/hello_world/static/pyramid-16x16.png b/docs/quick_tour/package/hello_world/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/quick_tour/package/hello_world/static/pyramid.png b/docs/quick_tour/package/hello_world/static/pyramid.png
new file mode 100644
index 000000000..4ab837be9
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/static/pyramid.png
Binary files differ
diff --git a/docs/quick_tour/package/hello_world/static/theme.css b/docs/quick_tour/package/hello_world/static/theme.css
new file mode 100644
index 000000000..e3cf3f290
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/static/theme.css
@@ -0,0 +1,153 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a {
+ color: #ffffff;
+}
+.starter-template .links ul li a:hover {
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
+
diff --git a/docs/quick_tour/package/hello_world/templates/mytemplate.jinja2 b/docs/quick_tour/package/hello_world/templates/mytemplate.jinja2
index 25a28ed7a..a6089aebc 100644
--- a/docs/quick_tour/package/hello_world/templates/mytemplate.jinja2
+++ b/docs/quick_tour/package/hello_world/templates/mytemplate.jinja2
@@ -1,90 +1,72 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="{{request.application_url}}/static/favicon.ico" />
- <link rel="stylesheet" href="{{request.application_url}}/static/pylons.css" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <!--[if !IE 7]>
- <style type="text/css">
- #wrap {display:table;height:100%}
- </style>
- <![endif]-->
- <style type="text/css">
- .locale { text-align: center; }
- .locale-name { font-weight: bold; }
- </style>
-</head>
-<body>
- <div id="wrap">
- <div id="header">
- <div class="header">The Pyramid Web Framework</div>
- </div>
- <div id="top">
- <div class="top align-center">
- <img src="{{request.application_url}}/static/logo.png" width="300" height="80" alt="Logo"/>
- <p class="app-welcome">
- Welcome to <span class="app-name">{{project}}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="locale">
- <h2>{% trans %}Hello!{% endtrans %}</h2>
- <!-- Start Sphinx Include 1 -->
- <p>Counter: {{ request.session.counter }}</p>
- <!-- End Sphinx Include 1 -->
- <p>Request performed with <span class="locale-name">{{ request.locale_name }}</span> locale.</p>
+<!DOCTYPE html>
+<html lang="{{request.locale_name}}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="{{request.static_url('hello_world:static/pyramid-16x16.png')}}">
+
+ <title>Starter Scaffold for Pyramid Jinja2</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="{{request.static_url('hello_world:static/theme.css')}}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="{{request.static_url('hello_world:static/pyramid.png')}}" alt="pyramid web framework">
</div>
- <div class="bottom">
- <div id="left" class="align-right">
- <h3>Search Pyramid documentation</h3>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Search" />
- </form>
- </div>
- <div id="right" class="align-left">
- <h3>Pyramid links</h3>
- <ul class="links">
- <li>
- <a href="http://pylonshq.com">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/">The Pylons Project Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- <div id="footer">
- <div class="footer">© Copyright 2008-2010, Agendaless Consulting.</div>
- </div>
-</body>
+ <div class="col-md-10">
+ <div class="content">
+ <h1>
+ <span class="font-semi-bold">Pyramid</span>
+ <span class="smaller">Jinja2 scaffold</span>
+ </h1>
+ <p class="lead">
+ {% trans %}Hello{% endtrans %} to <span class="font-normal">{{project}}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework 1.6</span>.</p>
+ <p>Counter: {{ request.session.counter }}</p>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li class="current-version">Generated by v1.6</li>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/1.6-branch/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/quick_tour/package/hello_world/views.py b/docs/quick_tour/package/hello_world/views.py
index 109c260ad..9f7953c8e 100644
--- a/docs/quick_tour/package/hello_world/views.py
+++ b/docs/quick_tour/package/hello_world/views.py
@@ -1,22 +1,16 @@
-# Start Logging 1
+from pyramid.i18n import TranslationStringFactory
+
import logging
log = logging.getLogger(__name__)
-# End Logging 1
-
-from pyramid.i18n import TranslationStringFactory
_ = TranslationStringFactory('hello_world')
def my_view(request):
- # Start Logging 2
log.debug('Some Message')
- # End Logging 2
- # Start Sphinx Include 1
session = request.session
if 'counter' in session:
session['counter'] += 1
else:
session['counter'] = 0
- # End Sphinx Include 1
return {'project': 'hello_world'}
diff --git a/docs/quick_tour/package/setup.cfg b/docs/quick_tour/package/setup.cfg
new file mode 100644
index 000000000..186e796fc
--- /dev/null
+++ b/docs/quick_tour/package/setup.cfg
@@ -0,0 +1,28 @@
+[nosetests]
+match = ^test
+nocapture = 1
+cover-package = hello_world
+with-coverage = 1
+cover-erase = 1
+
+[compile_catalog]
+directory = hello_world/locale
+domain = hello_world
+statistics = true
+
+[extract_messages]
+add_comments = TRANSLATORS:
+output_file = hello_world/locale/hello_world.pot
+width = 80
+mapping_file = message-extraction.ini
+
+[init_catalog]
+domain = hello_world
+input_file = hello_world/locale/hello_world.pot
+output_dir = hello_world/locale
+
+[update_catalog]
+domain = hello_world
+input_file = hello_world/locale/hello_world.pot
+output_dir = hello_world/locale
+previous = true
diff --git a/docs/quick_tour/package/setup.py b/docs/quick_tour/package/setup.py
index f118ed5fb..61ed3c406 100644
--- a/docs/quick_tour/package/setup.py
+++ b/docs/quick_tour/package/setup.py
@@ -3,12 +3,17 @@ import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
-README = open(os.path.join(here, 'README.txt')).read()
-CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
+with open(os.path.join(here, 'README.txt')) as f:
+ README = f.read()
+with open(os.path.join(here, 'CHANGES.txt')) as f:
+ CHANGES = f.read()
-# Start Requires
-requires = ['pyramid>=1.0.2', 'pyramid_jinja2', 'pyramid_debugtoolbar']
-# End Requires
+requires = [
+ 'pyramid',
+ 'pyramid_jinja2',
+ 'pyramid_debugtoolbar',
+ 'waitress',
+]
setup(name='hello_world',
version='0.0',
@@ -16,7 +21,7 @@ setup(name='hello_world',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Programming Language :: Python",
- "Framework :: Pylons",
+ "Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
],
@@ -28,14 +33,12 @@ setup(name='hello_world',
include_package_data=True,
zip_safe=False,
install_requires=requires,
- tests_require=requires,
+ tests_require={
+ 'testing': ['nose', 'coverage'],
+ },
test_suite="hello_world",
entry_points="""\
[paste.app_factory]
main = hello_world:main
""",
- paster_plugins=['pyramid'],
- extras_require={
- 'testing': ['nose', ],
- }
-) \ No newline at end of file
+ )
diff --git a/docs/quick_tour/requests/app.py b/docs/quick_tour/requests/app.py
index 7ac81eb50..f55264cff 100644
--- a/docs/quick_tour/requests/app.py
+++ b/docs/quick_tour/requests/app.py
@@ -21,4 +21,4 @@ if __name__ == '__main__':
config.add_view(hello_world, route_name='hello')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/routing/app.py b/docs/quick_tour/routing/app.py
index 04a8a6344..12b547bfe 100644
--- a/docs/quick_tour/routing/app.py
+++ b/docs/quick_tour/routing/app.py
@@ -3,9 +3,7 @@ from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
- # Start Route 1
config.add_route('hello', '/howdy/{first}/{last}')
- # End Route 1
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
diff --git a/docs/quick_tour/routing/views.py b/docs/quick_tour/routing/views.py
index 8cb8d3780..8a3bd230e 100644
--- a/docs/quick_tour/routing/views.py
+++ b/docs/quick_tour/routing/views.py
@@ -2,9 +2,7 @@ from pyramid.response import Response
from pyramid.view import view_config
-# Start Route 1
@view_config(route_name='hello')
def hello_world(request):
body = '<h1>Hi %(first)s %(last)s!</h1>' % request.matchdict
return Response(body)
- # End Route 1 \ No newline at end of file
diff --git a/docs/quick_tour/sqla_demo/README.txt b/docs/quick_tour/sqla_demo/README.txt
index f35d3aec5..c7f9d6474 100644
--- a/docs/quick_tour/sqla_demo/README.txt
+++ b/docs/quick_tour/sqla_demo/README.txt
@@ -6,9 +6,9 @@ Getting Started
- cd <directory containing this file>
-- $venv/bin/python setup.py develop
+- $VENV/bin/python setup.py develop
-- $venv/bin/initialize_sqla_demo_db development.ini
+- $VENV/bin/initialize_sqla_demo_db development.ini
-- $venv/bin/pserve development.ini
+- $VENV/bin/pserve development.ini
diff --git a/docs/quick_tour/sqla_demo/development.ini b/docs/quick_tour/sqla_demo/development.ini
index 174468abf..cdf20638e 100644
--- a/docs/quick_tour/sqla_demo/development.ini
+++ b/docs/quick_tour/sqla_demo/development.ini
@@ -68,4 +68,4 @@ level = NOTSET
formatter = generic
[formatter_generic]
-format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
diff --git a/docs/quick_tour/sqla_demo/production.ini b/docs/quick_tour/sqla_demo/production.ini
index dc0ba304f..38f3b6318 100644
--- a/docs/quick_tour/sqla_demo/production.ini
+++ b/docs/quick_tour/sqla_demo/production.ini
@@ -59,4 +59,4 @@ level = NOTSET
formatter = generic
[formatter_generic]
-format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
diff --git a/docs/quick_tour/sqla_demo/setup.cfg b/docs/quick_tour/sqla_demo/setup.cfg
new file mode 100644
index 000000000..9f91cd122
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/setup.cfg
@@ -0,0 +1,27 @@
+[nosetests]
+match=^test
+nocapture=1
+cover-package=sqla_demo
+with-coverage=1
+cover-erase=1
+
+[compile_catalog]
+directory = sqla_demo/locale
+domain = sqla_demo
+statistics = true
+
+[extract_messages]
+add_comments = TRANSLATORS:
+output_file = sqla_demo/locale/sqla_demo.pot
+width = 80
+
+[init_catalog]
+domain = sqla_demo
+input_file = sqla_demo/locale/sqla_demo.pot
+output_dir = sqla_demo/locale
+
+[update_catalog]
+domain = sqla_demo
+input_file = sqla_demo/locale/sqla_demo.pot
+output_dir = sqla_demo/locale
+previous = true
diff --git a/docs/quick_tour/sqla_demo/setup.py b/docs/quick_tour/sqla_demo/setup.py
index ac2eed035..a9a8842e2 100644
--- a/docs/quick_tour/sqla_demo/setup.py
+++ b/docs/quick_tour/sqla_demo/setup.py
@@ -3,15 +3,18 @@ import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
-README = open(os.path.join(here, 'README.txt')).read()
-CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
+with open(os.path.join(here, 'README.txt')) as f:
+ README = f.read()
+with open(os.path.join(here, 'CHANGES.txt')) as f:
+ CHANGES = f.read()
requires = [
'pyramid',
+ 'pyramid_chameleon',
+ 'pyramid_debugtoolbar',
+ 'pyramid_tm',
'SQLAlchemy',
'transaction',
- 'pyramid_tm',
- 'pyramid_debugtoolbar',
'zope.sqlalchemy',
'waitress',
]
diff --git a/docs/quick_tour/sqla_demo/sqla_demo.sqlite b/docs/quick_tour/sqla_demo/sqla_demo.sqlite
deleted file mode 100644
index fa6adb104..000000000
--- a/docs/quick_tour/sqla_demo/sqla_demo.sqlite
+++ /dev/null
Binary files differ
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/__init__.py b/docs/quick_tour/sqla_demo/sqla_demo/__init__.py
index aac7c5e69..867049e4f 100644
--- a/docs/quick_tour/sqla_demo/sqla_demo/__init__.py
+++ b/docs/quick_tour/sqla_demo/sqla_demo/__init__.py
@@ -14,6 +14,7 @@ def main(global_config, **settings):
DBSession.configure(bind=engine)
Base.metadata.bind = engine
config = Configurator(settings=settings)
+ config.include('pyramid_chameleon')
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.scan()
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/models.py b/docs/quick_tour/sqla_demo/sqla_demo/models.py
index 3dfb40e58..a0d3e7b71 100644
--- a/docs/quick_tour/sqla_demo/sqla_demo/models.py
+++ b/docs/quick_tour/sqla_demo/sqla_demo/models.py
@@ -1,5 +1,6 @@
from sqlalchemy import (
Column,
+ Index,
Integer,
Text,
)
@@ -16,14 +17,11 @@ from zope.sqlalchemy import ZopeTransactionExtension
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base()
-# Start Sphinx Include
+
class MyModel(Base):
__tablename__ = 'models'
id = Column(Integer, primary_key=True)
- name = Column(Text, unique=True)
+ name = Column(Text)
value = Column(Integer)
- def __init__(self, name, value):
- self.name = name
- self.value = value
- # End Sphinx Include
+Index('my_index', MyModel.name, unique=True, mysql_length=255)
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/scripts/initializedb.py b/docs/quick_tour/sqla_demo/sqla_demo/scripts/initializedb.py
index 66feb3008..7dfdece15 100644
--- a/docs/quick_tour/sqla_demo/sqla_demo/scripts/initializedb.py
+++ b/docs/quick_tour/sqla_demo/sqla_demo/scripts/initializedb.py
@@ -9,6 +9,8 @@ from pyramid.paster import (
setup_logging,
)
+from pyramid.scripts.common import parse_vars
+
from ..models import (
DBSession,
MyModel,
@@ -18,17 +20,18 @@ from ..models import (
def usage(argv):
cmd = os.path.basename(argv[0])
- print('usage: %s <config_uri>\n'
+ print('usage: %s <config_uri> [var=value]\n'
'(example: "%s development.ini")' % (cmd, cmd))
sys.exit(1)
def main(argv=sys.argv):
- if len(argv) != 2:
+ if len(argv) < 2:
usage(argv)
config_uri = argv[1]
+ options = parse_vars(argv[2:])
setup_logging(config_uri)
- settings = get_appsettings(config_uri)
+ settings = get_appsettings(config_uri, options=options)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/static/pyramid-16x16.png b/docs/quick_tour/sqla_demo/sqla_demo/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/static/pyramid.png b/docs/quick_tour/sqla_demo/sqla_demo/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/quick_tour/sqla_demo/sqla_demo/static/pyramid.png
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/pyramid.png
Binary files differ
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/static/theme.css b/docs/quick_tour/sqla_demo/sqla_demo/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/static/theme.min.css b/docs/quick_tour/sqla_demo/sqla_demo/static/theme.min.css
new file mode 100644
index 000000000..0d25de5b6
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a,a{color:#f2b7bd;text-decoration:underline}.starter-template .links ul li a:hover,a:hover{color:#fff;text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}}
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/templates/mytemplate.pt b/docs/quick_tour/sqla_demo/sqla_demo/templates/mytemplate.pt
index 321c0f5fb..99df4a8b7 100644
--- a/docs/quick_tour/sqla_demo/sqla_demo/templates/mytemplate.pt
+++ b/docs/quick_tour/sqla_demo/sqla_demo/templates/mytemplate.pt
@@ -1,76 +1,67 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="${request.static_url('sqla_demo:static/favicon.ico')}" />
- <link rel="stylesheet" href="${request.static_url('sqla_demo:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="${request.static_url('sqla_demo:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="${request.static_url('sqla_demo:static/pyramid.png')}" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid web framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('sqla_demo:static/pyramid-16x16.png')}">
+
+ <title>Alchemy Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('sqla_demo:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('sqla_demo:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Alchemy scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework 1.6</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/#reference-material">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/#detailed-change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li class="current-version">Generated by v1.6</li>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/1.6-branch/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
- <div id="footer">
- <div class="footer">&copy; Copyright 2008-2012, Agendaless Consulting.</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/tests.py b/docs/quick_tour/sqla_demo/sqla_demo/tests.py
index 6fef6d695..be288d580 100644
--- a/docs/quick_tour/sqla_demo/sqla_demo/tests.py
+++ b/docs/quick_tour/sqla_demo/sqla_demo/tests.py
@@ -6,7 +6,7 @@ from pyramid import testing
from .models import DBSession
-class TestMyView(unittest.TestCase):
+class TestMyViewSuccessCondition(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
from sqlalchemy import create_engine
@@ -25,9 +25,31 @@ class TestMyView(unittest.TestCase):
DBSession.remove()
testing.tearDown()
- def test_it(self):
+ def test_passing_view(self):
from .views import my_view
request = testing.DummyRequest()
info = my_view(request)
self.assertEqual(info['one'].name, 'one')
self.assertEqual(info['project'], 'sqla_demo')
+
+
+class TestMyViewFailureCondition(unittest.TestCase):
+ def setUp(self):
+ self.config = testing.setUp()
+ from sqlalchemy import create_engine
+ engine = create_engine('sqlite://')
+ from .models import (
+ Base,
+ MyModel,
+ )
+ DBSession.configure(bind=engine)
+
+ def tearDown(self):
+ DBSession.remove()
+ testing.tearDown()
+
+ def test_failing_view(self):
+ from .views import my_view
+ request = testing.DummyRequest()
+ info = my_view(request)
+ self.assertEqual(info.status_int, 500) \ No newline at end of file
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/views.py b/docs/quick_tour/sqla_demo/sqla_demo/views.py
index 768a7e42e..964f76441 100644
--- a/docs/quick_tour/sqla_demo/sqla_demo/views.py
+++ b/docs/quick_tour/sqla_demo/sqla_demo/views.py
@@ -12,19 +12,18 @@ from .models import (
@view_config(route_name='home', renderer='templates/mytemplate.pt')
def my_view(request):
try:
- # Start Sphinx Include
one = DBSession.query(MyModel).filter(MyModel.name == 'one').first()
- # End Sphinx Include
except DBAPIError:
return Response(conn_err_msg, content_type='text/plain', status_int=500)
return {'one': one, 'project': 'sqla_demo'}
+
conn_err_msg = """\
Pyramid is having a problem using your SQL database. The problem
might be caused by one of the following things:
1. You may need to run the "initialize_sqla_demo_db" script
- to initialize your database tables. Check your virtual
+ to initialize your database tables. Check your virtual
environment's "bin" directory for this script and try to run it.
2. Your database server may not be running. Check that the
diff --git a/docs/quick_tour/static_assets/app.py b/docs/quick_tour/static_assets/app.py
index 9c808972f..1849c0a5a 100644
--- a/docs/quick_tour/static_assets/app.py
+++ b/docs/quick_tour/static_assets/app.py
@@ -4,11 +4,9 @@ from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/howdy/{name}')
- # Start Static 1
config.add_static_view(name='static', path='static')
- # End Static 1
config.include('pyramid_jinja2')
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/static_assets/hello_world.jinja2 b/docs/quick_tour/static_assets/hello_world.jinja2
index f6862e618..0fb2ce296 100644
--- a/docs/quick_tour/static_assets/hello_world.jinja2
+++ b/docs/quick_tour/static_assets/hello_world.jinja2
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Glance</title>
+ <title>Hello World</title>
<link rel="stylesheet" href="/static/app.css"/>
</head>
<body>
diff --git a/docs/quick_tour/static_assets/hello_world.pt b/docs/quick_tour/static_assets/hello_world.pt
deleted file mode 100644
index 1797146eb..000000000
--- a/docs/quick_tour/static_assets/hello_world.pt
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html lang="en"><head>
- <title>Quick Glance</title>
- <!-- Start Link 1 -->
- <link rel="stylesheet" href="/static/app.css" />
- <!-- End Link 1 -->
- <!-- Start Link 2 -->
- <link rel="stylesheet"
- href="${request.static_url('static/app.css')}"
- />
- <!-- End Link 2 -->
-</head>
-<body>
-<h1>Hello ${name}!</h1>
-</body>
-</html> \ No newline at end of file
diff --git a/docs/quick_tour/static_assets/hello_world_static.jinja2 b/docs/quick_tour/static_assets/hello_world_static.jinja2
new file mode 100644
index 000000000..4fb9be074
--- /dev/null
+++ b/docs/quick_tour/static_assets/hello_world_static.jinja2
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Hello World</title>
+ <link rel="stylesheet" href="{{ request.static_url('static/app.css') }}"/>
+</head>
+<body>
+<h1>Hello {{ name }}!</h1>
+</body>
+</html> \ No newline at end of file
diff --git a/docs/quick_tour/static_assets/views.py b/docs/quick_tour/static_assets/views.py
index 90730ae32..7dbb45287 100644
--- a/docs/quick_tour/static_assets/views.py
+++ b/docs/quick_tour/static_assets/views.py
@@ -1,6 +1,6 @@
from pyramid.view import view_config
-@view_config(route_name='hello', renderer='hello_world.pt')
+@view_config(route_name='hello', renderer='hello_world.jinja2')
def hello_world(request):
return dict(name=request.matchdict['name'])
diff --git a/docs/quick_tour/templating/app.py b/docs/quick_tour/templating/app.py
index 6d1a29f4e..52b7faf55 100644
--- a/docs/quick_tour/templating/app.py
+++ b/docs/quick_tour/templating/app.py
@@ -4,7 +4,8 @@ from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/howdy/{name}')
+ config.include('pyramid_chameleon')
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/templating/views.py b/docs/quick_tour/templating/views.py
index 6c7846efa..90730ae32 100644
--- a/docs/quick_tour/templating/views.py
+++ b/docs/quick_tour/templating/views.py
@@ -1,8 +1,6 @@
from pyramid.view import view_config
-# Start View 1
@view_config(route_name='hello', renderer='hello_world.pt')
def hello_world(request):
return dict(name=request.matchdict['name'])
- # End View 1 \ No newline at end of file
diff --git a/docs/quick_tour/view_classes/app.py b/docs/quick_tour/view_classes/app.py
index 468c8c29e..40faddd00 100644
--- a/docs/quick_tour/view_classes/app.py
+++ b/docs/quick_tour/view_classes/app.py
@@ -3,11 +3,11 @@ from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
- # Start Routes 1
config.add_route('hello', '/howdy/{name}')
- # End Routes 1
+ config.add_route('hello_json', 'hello.json')
+ config.add_static_view(name='static', path='static')
config.include('pyramid_jinja2')
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/view_classes/hello.jinja2 b/docs/quick_tour/view_classes/hello.jinja2
index 3446b96ce..fc3058067 100644
--- a/docs/quick_tour/view_classes/hello.jinja2
+++ b/docs/quick_tour/view_classes/hello.jinja2
@@ -5,13 +5,11 @@
</head>
<body>
<h1>Hello {{ view.name }}!</h1>
-<!-- Start Form 1 -->
<form method="POST"
action="{{ request.current_route_url() }}">
- <input name="new_name"/>
- <input type="submit" name="form.edit" value="Save"/>
- <input type="submit" name="form.delete" value="Delete"/>
+ <input name="new_name">
+ <input type="submit" name="form.edit" value="Save">
+ <input type="submit" name="form.delete" value="Delete">
</form>
-<!-- End Form 1 -->
</body>
</html> \ No newline at end of file
diff --git a/docs/quick_tour/view_classes/views.py b/docs/quick_tour/view_classes/views.py
index 62556142e..10ff238c7 100644
--- a/docs/quick_tour/view_classes/views.py
+++ b/docs/quick_tour/view_classes/views.py
@@ -4,7 +4,6 @@ from pyramid.view import (
)
-# Start View 1
# One route, at /howdy/amy, so don't repeat on each @view_config
@view_defaults(route_name='hello')
class HelloWorldViews:
@@ -29,4 +28,3 @@ class HelloWorldViews:
def delete_view(self):
print('Deleted')
return dict()
- # End View 1 \ No newline at end of file
diff --git a/docs/quick_tour/views/app.py b/docs/quick_tour/views/app.py
index 54dc9ed4b..e8df6eff2 100644
--- a/docs/quick_tour/views/app.py
+++ b/docs/quick_tour/views/app.py
@@ -10,4 +10,4 @@ if __name__ == '__main__':
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tutorial/authentication.rst b/docs/quick_tutorial/authentication.rst
index 4b4eb1ba3..7fd8173d4 100644
--- a/docs/quick_tutorial/authentication.rst
+++ b/docs/quick_tutorial/authentication.rst
@@ -93,7 +93,7 @@ Steps
Analysis
========
-Unlike many web frameworks, Pyramid includes a built-in (but optional)
+Unlike many web frameworks, Pyramid includes a built-in but optional
security model for authentication and authorization. This security
system is intended to be flexible and support many needs. In this
security model, authentication (who are you) and authorization (what
@@ -123,9 +123,6 @@ Extra Credit
#. Can I use a database behind my ``groupfinder`` to look up principals?
-#. Do I have to put a ``renderer`` in my ``@forbidden_view_config``
- decorator?
-
#. Once I am logged in, does any user-centric information get jammed
onto each request? Use ``import pdb; pdb.set_trace()`` to answer
this.
diff --git a/docs/quick_tutorial/authentication/tutorial/home.pt b/docs/quick_tutorial/authentication/tutorial/home.pt
index 6ecd0081b..ed911b673 100644
--- a/docs/quick_tutorial/authentication/tutorial/home.pt
+++ b/docs/quick_tutorial/authentication/tutorial/home.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
@@ -15,4 +15,4 @@
<h1>Hi ${name}</h1>
<p>Visit <a href="${request.route_url('hello')}">hello</a></p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/authentication/tutorial/login.pt b/docs/quick_tutorial/authentication/tutorial/login.pt
index 4451fc4f8..9e5bfe2ad 100644
--- a/docs/quick_tutorial/authentication/tutorial/login.pt
+++ b/docs/quick_tutorial/authentication/tutorial/login.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Login</h1>
@@ -22,4 +22,4 @@
value="Log In"/>
</form>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/authorization.rst b/docs/quick_tutorial/authorization.rst
index 6b10d3409..855043f7f 100644
--- a/docs/quick_tutorial/authorization.rst
+++ b/docs/quick_tutorial/authorization.rst
@@ -11,7 +11,7 @@ Background
Our application has URLs that allow people to add/edit/delete content
via a web browser. Time to add security to the application. Let's
protect our add/edit views to require a login (username of
-``editor`` and password of ``editor``.) We will allow the other views
+``editor`` and password of ``editor``). We will allow the other views
to continue working without a password.
Objectives
@@ -93,7 +93,7 @@ In summary: ``hello`` wants ``edit`` permission, ``Root`` says
Of course, this only applies on ``Root``. Some other part of the site
(a.k.a. *context*) might have a different ACL.
-If you are not logged in and visit ``/hello``, you need to get
+If you are not logged in and visit ``/howdy``, you need to get
shown the login screen. How does Pyramid know what is the login page to
use? We explicitly told Pyramid that the ``login`` view should be used
by decorating the view with ``@forbidden_view_config``.
@@ -101,7 +101,10 @@ by decorating the view with ``@forbidden_view_config``.
Extra Credit
============
-#. Perhaps you would like experience of not having enough permissions
+#. Do I have to put a ``renderer`` in my ``@forbidden_view_config``
+ decorator?
+
+#. Perhaps you would like the experience of not having enough permissions
(forbidden) to be richer. How could you change this?
#. Perhaps we want to store security statements in a database and
diff --git a/docs/quick_tutorial/authorization/tutorial/home.pt b/docs/quick_tutorial/authorization/tutorial/home.pt
index 6ecd0081b..ed911b673 100644
--- a/docs/quick_tutorial/authorization/tutorial/home.pt
+++ b/docs/quick_tutorial/authorization/tutorial/home.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
@@ -15,4 +15,4 @@
<h1>Hi ${name}</h1>
<p>Visit <a href="${request.route_url('hello')}">hello</a></p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/authorization/tutorial/login.pt b/docs/quick_tutorial/authorization/tutorial/login.pt
index 4451fc4f8..9e5bfe2ad 100644
--- a/docs/quick_tutorial/authorization/tutorial/login.pt
+++ b/docs/quick_tutorial/authorization/tutorial/login.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Login</h1>
@@ -22,4 +22,4 @@
value="Log In"/>
</form>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/databases.rst b/docs/quick_tutorial/databases.rst
index 7c019dbfc..19dfd066d 100644
--- a/docs/quick_tutorial/databases.rst
+++ b/docs/quick_tutorial/databases.rst
@@ -53,8 +53,8 @@ Steps
.. note::
- We aren't yet doing ``python3.3 setup.py develop`` as we
- are changing it later.
+ We aren't yet doing ``$VENV/bin/python setup.py develop`` as we
+ will change it later.
#. Our configuration file at ``databases/development.ini`` wires
together some new pieces:
@@ -72,6 +72,7 @@ Steps
to initialize the database:
.. literalinclude:: databases/tutorial/initialize_db.py
+ :linenos:
#. Since ``setup.py`` changed, we now run it:
@@ -89,21 +90,34 @@ Steps
.. code-block:: bash
$ $VENV/bin/initialize_tutorial_db development.ini
- 2013-09-06 15:54:08,050 INFO [sqlalchemy.engine.base.Engine][MainThread] PRAGMA table_info("wikipages")
- 2013-09-06 15:54:08,050 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
- 2013-09-06 15:54:08,051 INFO [sqlalchemy.engine.base.Engine][MainThread]
+ 2015-06-01 11:22:52,650 INFO [sqlalchemy.engine.base.Engine][MainThread] SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1
+ 2015-06-01 11:22:52,650 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
+ 2015-06-01 11:22:52,651 INFO [sqlalchemy.engine.base.Engine][MainThread] SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
+ 2015-06-01 11:22:52,651 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
+ 2015-06-01 11:22:52,652 INFO [sqlalchemy.engine.base.Engine][MainThread] PRAGMA table_info("wikipages")
+ 2015-06-01 11:22:52,652 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
+ 2015-06-01 11:22:52,653 INFO [sqlalchemy.engine.base.Engine][MainThread]
CREATE TABLE wikipages (
- uid INTEGER NOT NULL,
- title TEXT,
- body TEXT,
- PRIMARY KEY (uid),
- UNIQUE (title)
+ uid INTEGER NOT NULL,
+ title TEXT,
+ body TEXT,
+ PRIMARY KEY (uid),
+ UNIQUE (title)
)
+
+ 2015-06-01 11:22:52,653 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
+ 2015-06-01 11:22:52,655 INFO [sqlalchemy.engine.base.Engine][MainThread] COMMIT
+ 2015-06-01 11:22:52,658 INFO [sqlalchemy.engine.base.Engine][MainThread] BEGIN (implicit)
+ 2015-06-01 11:22:52,659 INFO [sqlalchemy.engine.base.Engine][MainThread] INSERT INTO wikipages (title, body) VALUES (?, ?)
+ 2015-06-01 11:22:52,659 INFO [sqlalchemy.engine.base.Engine][MainThread] ('Root', '<p>Root</p>')
+ 2015-06-01 11:22:52,659 INFO [sqlalchemy.engine.base.Engine][MainThread] COMMIT
+
#. With our data now driven by SQLAlchemy queries, we need to update
our ``databases/tutorial/views.py``:
.. literalinclude:: databases/tutorial/views.py
+ :linenos:
#. Our tests in ``databases/tutorial/tests.py`` changed to include
SQLAlchemy bootstrapping:
@@ -138,8 +152,8 @@ Let's start with the dependencies. We made the decision to use
``pyramid_tm`` and ``zope.sqlalchemy``. Why?
Pyramid has a strong orientation towards support for ``transactions``.
-Specifically, you can install a transaction manager into your app
-application, either as middleware or a Pyramid "tween". Then,
+Specifically, you can install a transaction manager into your
+application either as middleware or a Pyramid "tween". Then,
just before you return the response, all transaction-aware parts of
your application are executed.
@@ -149,7 +163,7 @@ aborts the transaction. This is a very liberating way to write code.
The ``pyramid_tm`` package provides a "tween" that is configured in the
``development.ini`` configuration file. That installs it. We then need
-a package that makes SQLAlchemy and thus the RDBMS transaction manager
+a package that makes SQLAlchemy, and thus the RDBMS transaction manager,
integrate with the Pyramid transaction manager. That's what
``zope.sqlalchemy`` does.
@@ -167,8 +181,8 @@ console script follows the pattern of being fed a configuration file
with all the bootstrapping. It then opens SQLAlchemy and creates the
root of the wiki, which also makes the SQLite file. Note the
``with transaction.manager`` part that puts the work in the scope of a
-transaction (as we aren't inside a web request where this is done
-automatically.)
+transaction, as we aren't inside a web request where this is done
+automatically.
The ``models.py`` does a little bit extra work to hook up SQLAlchemy
into the Pyramid transaction manager. It then declares the model for a
diff --git a/docs/quick_tutorial/databases/development.ini b/docs/quick_tutorial/databases/development.ini
index 04c249a62..5da87d602 100644
--- a/docs/quick_tutorial/databases/development.ini
+++ b/docs/quick_tutorial/databases/development.ini
@@ -11,3 +11,39 @@ sqlalchemy.url = sqlite:///%(here)s/sqltutorial.sqlite
use = egg:pyramid#wsgiref
host = 0.0.0.0
port = 6543
+
+# Begin logging configuration
+
+[loggers]
+keys = root, tutorial, sqlalchemy.engine.base.Engine
+
+[logger_tutorial]
+level = DEBUG
+handlers =
+qualname = tutorial
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[logger_sqlalchemy.engine.base.Engine]
+level = INFO
+handlers =
+qualname = sqlalchemy.engine.base.Engine
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+
+# End logging configuration
diff --git a/docs/quick_tutorial/databases/tutorial/tests.py b/docs/quick_tutorial/databases/tutorial/tests.py
index e18e70c8c..11e747d15 100644
--- a/docs/quick_tutorial/databases/tutorial/tests.py
+++ b/docs/quick_tutorial/databases/tutorial/tests.py
@@ -40,16 +40,14 @@ class WikiViewTests(unittest.TestCase):
class WikiFunctionalTests(unittest.TestCase):
def setUp(self):
- self.session = _initTestingDB()
- self.config = testing.setUp()
from pyramid.paster import get_app
app = get_app('development.ini')
from webtest import TestApp
self.testapp = TestApp(app)
def tearDown(self):
- self.session.remove()
- testing.tearDown()
+ from .models import DBSession
+ DBSession.remove()
def test_it(self):
res = self.testapp.get('/', status=200)
diff --git a/docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt b/docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt
index d1fea0d7f..01955ef72 100644
--- a/docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt
+++ b/docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt
@@ -4,10 +4,12 @@
<title>WikiPage: Add/Edit</title>
<tal:block tal:repeat="reqt view.reqts['css']">
<link rel="stylesheet" type="text/css"
- href="${request.static_url('deform:static/' + reqt)}"/>
+ href="${request.static_url(reqt)}">
</tal:block>
+ <script type="text/javascript"
+ src="${request.static_url('deform:static/scripts/jquery-2.0.3.min.js')}"></script>
<tal:block tal:repeat="reqt view.reqts['js']">
- <script src="${request.static_url('deform:static/' + reqt)}"
+ <script src="${request.static_url(reqt)}"
type="text/javascript"></script>
</tal:block>
</head>
diff --git a/docs/quick_tutorial/debugtoolbar.rst b/docs/quick_tutorial/debugtoolbar.rst
index 90750c633..f11abc493 100644
--- a/docs/quick_tutorial/debugtoolbar.rst
+++ b/docs/quick_tutorial/debugtoolbar.rst
@@ -58,57 +58,55 @@ Steps
Analysis
========
-``pyramid_debugtoolbar`` is a full-fledged Python package,
-available on PyPI just like thousands of other Python packages. Thus we
-start by installing the ``pyramid_debugtoolbar`` package into our
-virtual environment using normal Python package installation commands.
-
-The ``pyramid_debugtoolbar`` Python package is also a Pyramid add-on,
-which means we need to include its add-on configuration into our web
-application. We could do this with imperative configuration in
-``tutorial/__init__.py`` by using ``config.include``. Pyramid also
-supports wiring in add-on configuration via our ``development.ini``
-using ``pyramid.includes``. We use this to load the configuration for
-the debugtoolbar.
-
-You'll now see an attractive button on the right side of
-your browser, which you may click to provide introspective access to debugging
-information in a new browser tab. Even better, if your web application
-generates an error,
-you will see a nice traceback on the screen. When you want to disable
-this toolbar, no need to change code: you can remove it from
-``pyramid.includes`` in the relevant ``.ini`` configuration file (thus
-showing why configuration files are handy.)
-
-Note injects a small amount of html/css into your app just before the closing
-``</body>`` tag in order to display itself. If you
-start to experience otherwise inexplicable client-side weirdness, you can shut
-it off by commenting out the ``pyramid_debugtoolbar`` line in
-``pyramid.includes`` temporarily.
+``pyramid_debugtoolbar`` is a full-fledged Python package, available on PyPI
+just like thousands of other Python packages. Thus we start by installing the
+``pyramid_debugtoolbar`` package into our virtual environment using normal
+Python package installation commands.
+
+The ``pyramid_debugtoolbar`` Python package is also a Pyramid add-on, which
+means we need to include its add-on configuration into our web application. We
+could do this with imperative configuration in ``tutorial/__init__.py`` by
+using ``config.include``. Pyramid also supports wiring in add-on configuration
+via our ``development.ini`` using ``pyramid.includes``. We use this to load
+the configuration for the debugtoolbar.
+
+You'll now see an attractive button on the right side of your browser, which
+you may click to provide introspective access to debugging information in a
+new browser tab. Even better, if your web application generates an error, you
+will see a nice traceback on the screen. When you want to disable this
+toolbar, there's no need to change code: you can remove it from
+``pyramid.includes`` in the relevant ``.ini`` configuration file (thus showing
+why configuration files are handy.)
+
+Note that the toolbar injects a small amount of HTML/CSS into your app just
+before the closing ``</body>`` tag in order to display itself. If you start to
+experience otherwise inexplicable client-side weirdness, you can shut it off
+by commenting out the ``pyramid_debugtoolbar`` line in ``pyramid.includes``
+temporarily.
.. seealso:: See also :ref:`pyramid_debugtoolbar <toolbar:overview>`.
Extra Credit
============
-# Why don't we add ``pyramid_debugtoolbar`` to the list of
- ``install_requires`` dependencies in ``debugtoolbar/setup.py``?
+#. Why don't we add ``pyramid_debugtoolbar`` to the list of
+ ``install_requires`` dependencies in ``debugtoolbar/setup.py``?
-# Introduce a bug into your application: Change:
+#. Introduce a bug into your application: Change:
- .. code-block:: python
+ .. code-block:: python
- def hello_world(request):
- return Response('<body><h1>Hello World!</h1></body>')
+ def hello_world(request):
+ return Response('<body><h1>Hello World!</h1></body>')
- to:
+ to:
- .. code-block:: python
+ .. code-block:: python
def hello_world(request):
return xResponse('<body><h1>Hello World!</h1></body>')
- Save, and visit http://localhost:6543/ again. Notice the nice
- traceback display. On the lowest line, click the "screen" icon to the
- right, and try typing the variable names ``request`` and ``Response``.
- What else can you discover?
+ Save, and visit http://localhost:6543/ again. Notice the nice
+ traceback display. On the lowest line, click the "screen" icon to the
+ right, and try typing the variable names ``request`` and ``Response``.
+ What else can you discover?
diff --git a/docs/quick_tutorial/forms.rst b/docs/quick_tutorial/forms.rst
index e8bc0c8b4..f81b88fc2 100644
--- a/docs/quick_tutorial/forms.rst
+++ b/docs/quick_tutorial/forms.rst
@@ -12,13 +12,13 @@ Background
Modern web applications deal extensively with forms. Developers,
though, have a wide range of philosophies about how frameworks should
help them with their forms. As such, Pyramid doesn't directly bundle
-one particular form library. Instead, there are a variety of form
+one particular form library. Instead there are a variety of form
libraries that are easy to use in Pyramid.
:ref:`Deform <deform:overview>`
is one such library. In this step, we introduce Deform for our
-forms and validation. This also gives us the
-:ref:`Colander <colander:overview>` for schemas and validation.
+forms and validation. This also gives us :ref:`Colander <colander:overview>`
+for schemas and validation.
Deform is getting a facelift, with styling from Twitter Bootstrap and
advanced widgets from popular JavaScript projects. The work began in
@@ -104,7 +104,7 @@ assets which need to be published. We don't have to know where on disk
it is located. We point at the package, then the path inside the package.
We just need to include a call to ``add_static_view`` to make that
-directory available at a URL. For Pyramid-specific pages,
+directory available at a URL. For Pyramid-specific packages,
Pyramid provides a facility (``config.include()``) which even makes
that unnecessary for consumers of a package. (Deform is not specific to
Pyramid.)
diff --git a/docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt b/docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt
index 3292dfd90..547465018 100644
--- a/docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt
+++ b/docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt
@@ -6,6 +6,8 @@
<link rel="stylesheet" type="text/css"
href="${request.static_url(reqt)}"/>
</tal:block>
+ <script src="${request.static_url('deform:static/scripts/jquery-2.0.3.min.js')}"
+ type="text/javascript"></script>
<tal:block tal:repeat="reqt view.reqts['js']">
<script src="${request.static_url(reqt)}"
type="text/javascript"></script>
diff --git a/docs/quick_tutorial/functional_testing.rst b/docs/quick_tutorial/functional_testing.rst
index 205ddf5cb..6f1544e79 100644
--- a/docs/quick_tutorial/functional_testing.rst
+++ b/docs/quick_tutorial/functional_testing.rst
@@ -10,7 +10,7 @@ Background
==========
Unit tests are a common and popular approach to test-driven development
-(TDD.) In web applications, though, the templating and entire apparatus
+(TDD). In web applications, though, the templating and entire apparatus
of a web site are important parts of the delivered quality. We'd like a
way to test these.
@@ -37,12 +37,15 @@ Steps
$ $VENV/bin/python setup.py develop
$ $VENV/bin/easy_install webtest
-#. Let's extend ``unit_testing/tutorial/tests.py`` to include a
+#. Let's extend ``functional_testing/tutorial/tests.py`` to include a
functional test:
.. literalinclude:: functional_testing/tutorial/tests.py
:linenos:
+ Be sure this file is not executable, or ``nosetests`` may not
+ include your tests.
+
#. Now run the tests:
.. code-block:: bash
@@ -67,4 +70,4 @@ execution time of our tests.
Extra Credit
============
-#. Why do our functional tests use ``b''``? \ No newline at end of file
+#. Why do our functional tests use ``b''``?
diff --git a/docs/quick_tutorial/hello_world.rst b/docs/quick_tutorial/hello_world.rst
index 1a9ba4c9d..4ae80ca87 100644
--- a/docs/quick_tutorial/hello_world.rst
+++ b/docs/quick_tutorial/hello_world.rst
@@ -77,7 +77,7 @@ explanation:
#. *Lines 12-14*. Use Pyramid's :term:`configurator` to connect
:term:`view` code to a particular URL :term:`route`.
-#. *Lines 6-7*. Implement the view code that generates the
+#. *Lines 6-8*. Implement the view code that generates the
:term:`response`.
#. *Lines 15-17*. Publish a :term:`WSGI` app using an HTTP
diff --git a/docs/quick_tutorial/ini.rst b/docs/quick_tutorial/ini.rst
index 3402c50e8..36942c767 100644
--- a/docs/quick_tutorial/ini.rst
+++ b/docs/quick_tutorial/ini.rst
@@ -14,9 +14,9 @@ Pyramid has a first-class concept of
:ref:`configuration <configuration_narr>` distinct from code.
This approach is optional, but its presence makes it distinct from
other Python web frameworks. It taps into Python's ``setuptools``
-library, which establishes conventions for how Python projects can be
-installed and provide "entry points". Pyramid uses an entry point to
-let a Pyramid application it where to find the WSGI app.
+library, which establishes conventions for installing and providing
+"entry points" for Python projects. Pyramid uses an entry point to
+let a Pyramid application know where to find the WSGI app.
Objectives
==========
@@ -88,7 +88,7 @@ the Pyramid chapter on
- ``pserve`` looks for ``[app:main]`` and finds ``use = egg:tutorial``
-- The projects's ``setup.py`` has defined an "entry point" (lines 9-10)
+- The projects's ``setup.py`` has defined an "entry point" (lines 9-12)
for the project "main" entry point of ``tutorial:main``
- The ``tutorial`` package's ``__init__`` has a ``main`` function
@@ -131,6 +131,8 @@ Extra Credit
#. The entry point in ``setup.py`` didn't mention ``__init__.py`` when
it declared ``tutorial:main`` function. Why not?
+#. What is the purpose of ``**settings``? What does the ``**`` signify?
+
.. seealso::
:ref:`project_narr`,
:ref:`scaffolding_chapter`,
@@ -138,7 +140,3 @@ Extra Credit
:ref:`environment_chapter`,
:ref:`paste_chapter`
-Extra Credit
-============
-
-#. What is the purpose of ``**settings``? What does the ``**`` signify?
diff --git a/docs/quick_tutorial/jinja2.rst b/docs/quick_tutorial/jinja2.rst
index 2f1e295dd..2121803f9 100644
--- a/docs/quick_tutorial/jinja2.rst
+++ b/docs/quick_tutorial/jinja2.rst
@@ -6,7 +6,7 @@
We just said Pyramid doesn't prefer one templating language over
another. Time to prove it. Jinja2 is a popular templating system,
-used in Flask and modelled after Django's templates. Let's add
+used in Flask and modeled after Django's templates. Let's add
``pyramid_jinja2``, a Pyramid :term:`add-on` which enables Jinja2 as a
:term:`renderer` in our Pyramid applications.
@@ -20,8 +20,8 @@ Objectives
Steps
=====
-#. In this step let's start by installing the ``pyramid_jinja2``
- add-on, the copying the ``view_class`` step's directory:
+#. In this step let's start by copying the ``view_class`` step's
+ directory, and then installing the ``pyramid_jinja2`` add-on.
.. code-block:: bash
@@ -45,12 +45,6 @@ Steps
.. literalinclude:: jinja2/tutorial/home.jinja2
:language: html
-#. Get the ``pyramid.includes`` into the functional test setup in
- ``jinja2/tutorial/tests.py``:
-
- .. literalinclude:: jinja2/tutorial/tests.py
- :linenos:
-
#. Now run the tests:
.. code-block:: bash
@@ -78,9 +72,6 @@ Our view code stayed largely the same. We simply changed the file
extension on the renderer. For the template, the syntax for Chameleon
and Jinja2's basic variable insertion is very similar.
-Our functional tests don't have ``development.ini`` so they needed the
-``pyramid.includes`` to be setup in the test setup.
-
Extra Credit
============
diff --git a/docs/quick_tutorial/jinja2/tutorial/home.jinja2 b/docs/quick_tutorial/jinja2/tutorial/home.jinja2
index 975323169..20d33b733 100644
--- a/docs/quick_tutorial/jinja2/tutorial/home.jinja2
+++ b/docs/quick_tutorial/jinja2/tutorial/home.jinja2
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: {{ name }}</title>
+ <title>Quick Tutorial: {{ name }}</title>
</head>
<body>
<h1>Hi {{ name }}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/jinja2/tutorial/tests.py b/docs/quick_tutorial/jinja2/tutorial/tests.py
index 0b22946f3..4381235ec 100644
--- a/docs/quick_tutorial/jinja2/tutorial/tests.py
+++ b/docs/quick_tutorial/jinja2/tutorial/tests.py
@@ -30,13 +30,7 @@ class TutorialViewTests(unittest.TestCase):
class TutorialFunctionalTests(unittest.TestCase):
def setUp(self):
from tutorial import main
-
- settings = {
- 'pyramid.includes': [
- 'pyramid_jinja2'
- ]
- }
- app = main({}, **settings)
+ app = main({})
from webtest import TestApp
self.testapp = TestApp(app)
diff --git a/docs/quick_tutorial/json/tutorial/home.pt b/docs/quick_tutorial/json/tutorial/home.pt
index a0cc08e7a..fd4ef8764 100644
--- a/docs/quick_tutorial/json/tutorial/home.pt
+++ b/docs/quick_tutorial/json/tutorial/home.pt
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Hi ${name}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/logging.rst b/docs/quick_tutorial/logging.rst
index 855ded59f..5d29cd196 100644
--- a/docs/quick_tutorial/logging.rst
+++ b/docs/quick_tutorial/logging.rst
@@ -16,9 +16,9 @@ we might need to detect problems when other people use the site. We
need *logging*.
Fortunately Pyramid uses the normal Python approach to logging. The
-scaffold generated, in your ``development.ini``, a number of lines that
+scaffold generated in your ``development.ini`` has a number of lines that
configure the logging for you to some reasonable defaults. You then see
-messages sent by Pyramid (for example, when a new request comes in.)
+messages sent by Pyramid, for example, when a new request comes in.
Objectives
==========
@@ -42,6 +42,12 @@ Steps
.. literalinclude:: logging/tutorial/views.py
:linenos:
+#. Finally let's edit ``development.ini`` configuration file
+ to enable logging for our Pyramid application:
+
+ .. literalinclude:: logging/development.ini
+ :language: ini
+
#. Make sure the tests still pass:
.. code-block:: bash
@@ -61,15 +67,10 @@ Steps
Analysis
========
-Our ``development.ini`` configuration file wires up Python standard
-logging for our Pyramid application:
-
-.. literalinclude:: logging/development.ini
- :language: ini
-
-In this, our ``tutorial`` Python package is setup as a logger
-and configured to log messages at a ``DEBUG`` or higher level. When you
-visit http://localhost:6543 your console will now show::
+In our configuration file ``development.ini``, our ``tutorial`` Python
+package is setup as a logger and configured to log messages at a
+``DEBUG`` or higher level. When you visit http://localhost:6543 your
+console will now show::
2013-08-09 10:42:42,968 DEBUG [tutorial.views][MainThread] In home view
diff --git a/docs/quick_tutorial/logging/tutorial/home.pt b/docs/quick_tutorial/logging/tutorial/home.pt
index a0cc08e7a..fd4ef8764 100644
--- a/docs/quick_tutorial/logging/tutorial/home.pt
+++ b/docs/quick_tutorial/logging/tutorial/home.pt
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Hi ${name}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/more_view_classes.rst b/docs/quick_tutorial/more_view_classes.rst
index 9cc4cc520..afbb7cc3a 100644
--- a/docs/quick_tutorial/more_view_classes.rst
+++ b/docs/quick_tutorial/more_view_classes.rst
@@ -47,7 +47,7 @@ Objectives
- Dispatch one route/URL to multiple views based on request data
-- Share stated and logic between views and templates via the view class
+- Share states and logic between views and templates via the view class
Steps
=====
@@ -95,6 +95,23 @@ Steps
.. literalinclude:: more_view_classes/tutorial/delete.pt
:language: html
+#. Our tests in ``more_view_classes/tutorial/tests.py`` fail, so let's modify
+ them:
+
+ .. literalinclude:: more_view_classes/tutorial/tests.py
+ :linenos:
+
+#. Now run the tests:
+
+ .. code-block:: bash
+
+ $ $VENV/bin/nosetests tutorial
+ .
+ ----------------------------------------------------------------------
+ Ran 2 tests in 0.248s
+
+ OK
+
#. Run your Pyramid application with:
.. code-block:: bash
@@ -125,7 +142,7 @@ Specifically:
- The fourth view is returned when clicking on a button such
as ``<input type="submit" name="form.delete" value="Delete"/>``.
-In this step we show using the following information as criteria to
+In this step we show, using the following information as criteria, how to
decide which view to use:
- Method of the HTTP request (``GET``, ``POST``, etc.)
diff --git a/docs/quick_tutorial/more_view_classes/tutorial/delete.pt b/docs/quick_tutorial/more_view_classes/tutorial/delete.pt
index 67cc8bf09..7bd4d3b0d 100644
--- a/docs/quick_tutorial/more_view_classes/tutorial/delete.pt
+++ b/docs/quick_tutorial/more_view_classes/tutorial/delete.pt
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${page_title}</title>
+ <title>Quick Tutorial: ${page_title}</title>
</head>
<body>
<h1>${view.view_name} - ${page_title}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/more_view_classes/tutorial/edit.pt b/docs/quick_tutorial/more_view_classes/tutorial/edit.pt
index 1bd204065..523a4ce5d 100644
--- a/docs/quick_tutorial/more_view_classes/tutorial/edit.pt
+++ b/docs/quick_tutorial/more_view_classes/tutorial/edit.pt
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${view.view_name} - ${page_title}</title>
+ <title>Quick Tutorial: ${view.view_name} - ${page_title}</title>
</head>
<body>
<h1>${view.view_name} - ${page_title}</h1>
<p>You submitted <code>${new_name}</code></p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/more_view_classes/tutorial/hello.pt b/docs/quick_tutorial/more_view_classes/tutorial/hello.pt
index 8a39aed09..40b00bfe4 100644
--- a/docs/quick_tutorial/more_view_classes/tutorial/hello.pt
+++ b/docs/quick_tutorial/more_view_classes/tutorial/hello.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${view.view_name} - ${page_title}</title>
+ <title>Quick Tutorial: ${view.view_name} - ${page_title}</title>
</head>
<body>
<h1>${view.view_name} - ${page_title}</h1>
@@ -13,4 +13,4 @@
<input type="submit" name="form.delete" value="Delete"/>
</form>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/more_view_classes/tutorial/home.pt b/docs/quick_tutorial/more_view_classes/tutorial/home.pt
index fa9016705..fa0436f7e 100644
--- a/docs/quick_tutorial/more_view_classes/tutorial/home.pt
+++ b/docs/quick_tutorial/more_view_classes/tutorial/home.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${view.view_name} - ${page_title}</title>
+ <title>Quick Tutorial: ${view.view_name} - ${page_title}</title>
</head>
<body>
<h1>${view.view_name} - ${page_title}</h1>
@@ -9,4 +9,4 @@
<p>Go to the <a href="${request.route_url('hello', first='jane',
last='doe')}">form</a>.</p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/more_view_classes/tutorial/views.py b/docs/quick_tutorial/more_view_classes/tutorial/views.py
index 635de0520..156e468a9 100644
--- a/docs/quick_tutorial/more_view_classes/tutorial/views.py
+++ b/docs/quick_tutorial/more_view_classes/tutorial/views.py
@@ -5,7 +5,7 @@ from pyramid.view import (
@view_defaults(route_name='hello')
-class TutorialViews:
+class TutorialViews(object):
def __init__(self, request):
self.request = request
self.view_name = 'TutorialViews'
@@ -25,13 +25,13 @@ class TutorialViews:
def hello(self):
return {'page_title': 'Hello View'}
- # Posting to /home via the "Edit" submit button
+ # Posting to /howdy/first/last via the "Edit" submit button
@view_config(request_method='POST', renderer='edit.pt')
def edit(self):
new_name = self.request.params['new_name']
return {'page_title': 'Edit View', 'new_name': new_name}
- # Posting to /home via the "Delete" submit button
+ # Posting to /howdy/first/last via the "Delete" submit button
@view_config(request_method='POST', request_param='form.delete',
renderer='delete.pt')
def delete(self):
diff --git a/docs/quick_tutorial/package.rst b/docs/quick_tutorial/package.rst
index 8fb052d5b..54a6a0bd9 100644
--- a/docs/quick_tutorial/package.rst
+++ b/docs/quick_tutorial/package.rst
@@ -3,7 +3,7 @@
============================================
Most modern Python development is done using Python packages, an approach
-Pyramid puts to good use. In this step we re-do "Hello World" as a
+Pyramid puts to good use. In this step we redo "Hello World" as a
minimum Python package inside a minimum Python project.
Background
@@ -93,7 +93,7 @@ Python projects, via ``setup.py``, gives us special features when
our package is installed (in this case, in local development mode.)
In this step we have a Python package called ``tutorial``. We use the
-same name in each step of the tutorial, to avoid unnecessary re-typing.
+same name in each step of the tutorial, to avoid unnecessary retyping.
Above this ``tutorial`` directory we have the files that handle the
packaging of this project. At the moment, all we need is a
diff --git a/docs/quick_tutorial/request_response.rst b/docs/quick_tutorial/request_response.rst
index 504803804..4f8de0221 100644
--- a/docs/quick_tutorial/request_response.rst
+++ b/docs/quick_tutorial/request_response.rst
@@ -46,14 +46,17 @@ Steps
#. Simplify the routes in ``request_response/tutorial/__init__.py``:
.. literalinclude:: request_response/tutorial/__init__.py
+ :linenos:
#. We only need one view in ``request_response/tutorial/views.py``:
.. literalinclude:: request_response/tutorial/views.py
+ :linenos:
#. Update the tests in ``request_response/tutorial/tests.py``:
.. literalinclude:: request_response/tutorial/tests.py
+ :linenos:
#. Now run the tests:
diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst
index b5778ea42..f855dcb55 100644
--- a/docs/quick_tutorial/requirements.rst
+++ b/docs/quick_tutorial/requirements.rst
@@ -19,7 +19,7 @@ make an isolated environment, and setup packaging tools.)
This *Quick Tutorial* is based on:
-* **Python 3.3**. Pyramid fully supports Python 3.2+ and Python 2.6+.
+* **Python 3.3**. Pyramid fully supports Python 3.3+ and Python 2.6+.
This tutorial uses **Python 3.3** but runs fine under Python 2.7.
* **pyvenv**. We believe in virtual environments. For this tutorial,
@@ -58,11 +58,8 @@ Steps
Install Python 3.3 or greater
-----------------------------
-Download the latest standard Python 3.3+ release (not development
-release) from
-`python.org <http://www.python.org/download/releases/>`_. On that page, you
-must click the latest version, then scroll down to the "Downloads" section
-for your operating system.
+Download the latest standard Python 3.3+ release (not development release)
+from `python.org <https://www.python.org/downloads/>`_.
Windows and Mac OS X users can download and run an installer.
@@ -73,8 +70,7 @@ directions. Make sure you get the proper 32- or 64-bit build and Python
version.
Linux users can either use their package manager to install Python 3.3
-or may
-`build Python 3.3 from source
+or may `build Python 3.3 from source
<http://pyramid.readthedocs.org/en/master/narr/install.html#package-manager-
method>`_.
@@ -86,13 +82,21 @@ Create a project directory structure
We will arrive at a directory structure of
``workspace->project->package``, with our workspace named
-``quick_tutorial``. The following diagram shows how this is structured
-and where our virtual environment will reside:
-
-.. figure:: ../_static/directory_structure_pyramid.png
- :alt: Final directory structure
-
- Final directory structure.
+``quick_tutorial``. The following tree diagram shows how this will be
+structured and where our virtual environment will reside as we proceed through
+the tutorial:
+
+.. code-block:: text
+
+ └── ~
+ └── projects
+ └── quick_tutorial
+ ├── env
+ └── step_one
+ ├── intro
+ │ ├── __init__.py
+ │ └── app.py
+ └── setup.py
For Linux, the commands to do so are as follows:
@@ -105,7 +109,7 @@ For Linux, the commands to do so are as follows:
For Windows:
-.. code-block:: posh
+.. code-block:: ps1con
# Windows
c:\> cd \
@@ -136,11 +140,11 @@ environment. We set an environment variable to save typing later.
.. code-block:: bash
# Mac and Linux
- $ export VENV=~/projects/quick_tutorial/env33/
+ $ export VENV=~/projects/quick_tutorial/env
# Windows
# TODO: This command does not work
- c:\> set VENV=c:\projects\quick_tutorial\env33
+ c:\> set VENV=c:\projects\quick_tutorial\env
.. _create-a-virtual-environment:
diff --git a/docs/quick_tutorial/routing.rst b/docs/quick_tutorial/routing.rst
index 54dff5c39..1b79a5889 100644
--- a/docs/quick_tutorial/routing.rst
+++ b/docs/quick_tutorial/routing.rst
@@ -14,7 +14,7 @@ Writing web applications usually means sophisticated URL design. We
just saw some Pyramid machinery for requests and views. Let's look at
features that help in routing.
-Previously we saw the basics of routing URLs to views in
+Previously we saw the basics of routing URLs to views in Pyramid.
- Your project's "setup" code registers a route name to be used when
matching part of the URL
diff --git a/docs/quick_tutorial/routing/tutorial/home.pt b/docs/quick_tutorial/routing/tutorial/home.pt
index f2b991059..b68e96338 100644
--- a/docs/quick_tutorial/routing/tutorial/home.pt
+++ b/docs/quick_tutorial/routing/tutorial/home.pt
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>${name}</h1>
<p>First: ${first}, Last: ${last}</p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/sessions.rst b/docs/quick_tutorial/sessions.rst
index b4887beb8..f97405500 100644
--- a/docs/quick_tutorial/sessions.rst
+++ b/docs/quick_tutorial/sessions.rst
@@ -89,7 +89,7 @@ when you add an item using a form ``POST``, the site usually issues a
second HTTP Redirect web request to view the new item. You might want a
message to appear after that second web request saying "Your item was
added." You can't just return it in the web response for the POST,
-as it will be tossed out during the second web requests.
+as it will be tossed out during the second web request.
Flash messages are a technique where messages can be stored between
requests, using sessions, then removed when they finally get displayed.
diff --git a/docs/quick_tutorial/sessions/tutorial/home.pt b/docs/quick_tutorial/sessions/tutorial/home.pt
index 0b27ba1d8..50342e52f 100644
--- a/docs/quick_tutorial/sessions/tutorial/home.pt
+++ b/docs/quick_tutorial/sessions/tutorial/home.pt
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Hi ${name}</h1>
<p>Count: ${view.counter}</p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/static_assets.rst b/docs/quick_tutorial/static_assets.rst
index 19d33f00f..3a7496ec7 100644
--- a/docs/quick_tutorial/static_assets.rst
+++ b/docs/quick_tutorial/static_assets.rst
@@ -25,7 +25,7 @@ Steps
$ cd ..; cp -r view_classes static_assets; cd static_assets
$ $VENV/bin/python setup.py develop
-#. We add a call ``config.add_static_view in
+#. We add a call ``config.add_static_view`` in
``static_assets/tutorial/__init__.py``:
.. literalinclude:: static_assets/tutorial/__init__.py
diff --git a/docs/quick_tutorial/static_assets/tutorial/home.pt b/docs/quick_tutorial/static_assets/tutorial/home.pt
index 5d347f057..57867a1ff 100644
--- a/docs/quick_tutorial/static_assets/tutorial/home.pt
+++ b/docs/quick_tutorial/static_assets/tutorial/home.pt
@@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
<link rel="stylesheet"
href="${request.static_url('tutorial:static/app.css') }"/>
</head>
<body>
<h1>Hi ${name}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/templating.rst b/docs/quick_tutorial/templating.rst
index d73067f48..cf56d2a96 100644
--- a/docs/quick_tutorial/templating.rst
+++ b/docs/quick_tutorial/templating.rst
@@ -112,7 +112,7 @@ Analysis
Ahh, that looks better. We have a view that is focused on Python code.
Our ``@view_config`` decorator specifies a :term:`renderer` that points
-our template file. Our view then simply returns data which is then
+to our template file. Our view then simply returns data which is then
supplied to our template. Note that we used the same template for both
views.
diff --git a/docs/quick_tutorial/templating/tutorial/home.pt b/docs/quick_tutorial/templating/tutorial/home.pt
index a0cc08e7a..fd4ef8764 100644
--- a/docs/quick_tutorial/templating/tutorial/home.pt
+++ b/docs/quick_tutorial/templating/tutorial/home.pt
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Hi ${name}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/unit_testing.rst b/docs/quick_tutorial/unit_testing.rst
index f8a33b39d..4cb7ef714 100644
--- a/docs/quick_tutorial/unit_testing.rst
+++ b/docs/quick_tutorial/unit_testing.rst
@@ -24,7 +24,7 @@ and functionality. The Pyramid developers use ``nose``, which we'll thus
use in this tutorial.
Don't worry, this tutorial won't be pedantic about "test-driven
-development" (TDD.) We'll do just enough to ensure that, in each step,
+development" (TDD). We'll do just enough to ensure that, in each step,
we haven't majorly broken the code. As you're writing your code you
might find this more convenient than changing to your browser
constantly and clicking reload.
diff --git a/docs/quick_tutorial/view_classes.rst b/docs/quick_tutorial/view_classes.rst
index 58ab43e40..50a7ee0af 100644
--- a/docs/quick_tutorial/view_classes.rst
+++ b/docs/quick_tutorial/view_classes.rst
@@ -51,7 +51,7 @@ Steps
:linenos:
#. Our unit tests in ``view_classes/tutorial/tests.py`` don't run,
- so let's modify the to import the view class and make an instance
+ so let's modify them to import the view class and make an instance
before getting a response:
.. literalinclude:: view_classes/tutorial/tests.py
@@ -88,7 +88,7 @@ view class, then updated the tests.
In our ``TutorialViews`` view class you can see that our two view
classes are logically grouped together as methods on a common class.
Since the two views shared the same template, we could move that to a
-``@view_defaults`` decorator on at the class level.
+``@view_defaults`` decorator at the class level.
The tests needed to change. Obviously we needed to import the view
class. But you can also see the pattern in the tests of instantiating
diff --git a/docs/quick_tutorial/views.rst b/docs/quick_tutorial/views.rst
index 529bba0a4..6728925fd 100644
--- a/docs/quick_tutorial/views.rst
+++ b/docs/quick_tutorial/views.rst
@@ -92,7 +92,7 @@ module ``views.py`` which is scanned via ``config.scan('.views')``.
We have 2 views, each leading to the other. If you start at
http://localhost:6543/, you get a response with a link to the next
-view. The ``hello_view`` (available at the URL ``/howdy``) has a link
+view. The ``hello`` view (available at the URL ``/howdy``) has a link
back to the first view.
This step also shows that the name appearing in the URL,
diff --git a/docs/tutorials/wiki/authorization.rst b/docs/tutorials/wiki/authorization.rst
index 93cd0c18e..c6f551b42 100644
--- a/docs/tutorials/wiki/authorization.rst
+++ b/docs/tutorials/wiki/authorization.rst
@@ -1,19 +1,20 @@
+.. _wiki_adding_authorization:
+
====================
-Adding Authorization
+Adding authorization
====================
:app:`Pyramid` provides facilities for :term:`authentication` and
-:term:`authorization`. We'll make use of both features to provide security
-to our application. Our application currently allows anyone with access to
-the server to view, edit, and add pages to our wiki. We'll change that
-to allow only people who are members of a *group* named ``group:editors``
-to add and edit wiki pages but we'll continue allowing
-anyone with access to the server to view pages.
-
-We will also add a login page and a logout link on all the
-pages. The login page will be shown when a user is denied
-access to any of the views that require a permission, instead of
-a default "403 Forbidden" page.
+::term:`authorization`. We'll make use of both features to provide security
+:to our application. Our application currently allows anyone with access to
+:the server to view, edit, and add pages to our wiki. We'll change that to
+:allow only people who are members of a *group* named ``group:editors`` to add
+:and edit wiki pages but we'll continue allowing anyone with access to the
+:server to view pages.
+
+We will also add a login page and a logout link on all the pages. The login
+page will be shown when a user is denied access to any of the views that
+require permission, instead of a default "403 Forbidden" page.
We will implement the access control with the following steps:
@@ -28,12 +29,13 @@ Then we will add the login and logout feature:
* Add ``login`` and ``logout`` views (``views.py``).
* Add a login template (``login.pt``).
-* Make the existing views return a ``logged_in`` flag to the renderer (``views.py``).
+* Make the existing views return a ``logged_in`` flag to the renderer
+ (``views.py``).
* Add a "Logout" link to be shown when logged in and viewing or editing a page
(``view.pt``, ``edit.pt``).
-Access Control
+Access control
--------------
Add users and groups
@@ -49,11 +51,9 @@ following content:
The ``groupfinder`` function accepts a userid and a request and
returns one of these values:
-- If the userid exists in the system, it will return a
- sequence of group identifiers (or an empty sequence if the user
- isn't a member of any groups).
-- If the userid *does not* exist in the system, it will
- return ``None``.
+- If the userid exists in the system, it will return a sequence of group
+ identifiers (or an empty sequence if the user isn't a member of any groups).
+- If the userid *does not* exist in the system, it will return ``None``.
For example, ``groupfinder('editor', request )`` returns ``['group:editor']``,
``groupfinder('viewer', request)`` returns ``[]``, and ``groupfinder('admin',
@@ -61,9 +61,8 @@ request)`` returns ``None``. We will use ``groupfinder()`` as an
:term:`authentication policy` "callback" that will provide the
:term:`principal` or principals for a user.
-In a production system, user and group
-data will most often come from a database, but here we use "dummy"
-data to represent user and groups sources.
+In a production system, user and group data will most often come from a
+database, but here we use "dummy" data to represent user and groups sources.
Add an ACL
~~~~~~~~~~
@@ -81,44 +80,42 @@ Add the following lines to the ``Wiki`` class:
.. literalinclude:: src/authorization/tutorial/models.py
:lines: 9-13
:linenos:
+ :lineno-start: 9
:emphasize-lines: 4-5
:language: python
-We import :data:`~pyramid.security.Allow`, an action that
-means that permission is allowed, and
-:data:`~pyramid.security.Everyone`, a special :term:`principal`
-that is associated to all requests. Both are used in the
+We import :data:`~pyramid.security.Allow`, an action that means that
+permission is allowed, and :data:`~pyramid.security.Everyone`, a special
+:term:`principal` that is associated to all requests. Both are used in the
:term:`ACE` entries that make up the ACL.
-The ACL is a list that needs to be named `__acl__` and be an
-attribute of a class. We define an :term:`ACL` with two
-:term:`ACE` entries: the first entry allows any user the `view`
-permission, and the second entry allows the ``group:editors``
-principal the `edit` permission.
+The ACL is a list that needs to be named `__acl__` and be an attribute of a
+class. We define an :term:`ACL` with two :term:`ACE` entries: the first entry
+allows any user the `view` permission. The second entry allows the
+``group:editors`` principal the `edit` permission.
-The ``Wiki`` class that contains the ACL is the :term:`resource`
-constructor for the :term:`root` resource, which is
-a ``Wiki`` instance. The ACL is
-provided to each view in the :term:`context` of the request, as
-the ``context`` attribute.
+The ``Wiki`` class that contains the ACL is the :term:`resource` constructor
+for the :term:`root` resource, which is a ``Wiki`` instance. The ACL is
+provided to each view in the :term:`context` of the request as the ``context``
+attribute.
It's only happenstance that we're assigning this ACL at class scope. An ACL
can be attached to an object *instance* too; this is how "row level security"
can be achieved in :app:`Pyramid` applications. We actually need only *one*
ACL for the entire system, however, because our security requirements are
-simple, so this feature is not demonstrated. See
-:ref:`assigning_acls` for more information about what an
-:term:`ACL` represents.
+simple, so this feature is not demonstrated. See :ref:`assigning_acls` for
+more information about what an :term:`ACL` represents.
-Add Authentication and Authorization Policies
+Add authentication and authorization policies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Open ``tutorial/__init__.py`` and
-add these import statements:
+Open ``tutorial/tutorial/__init__.py`` and add the highlighted import
+statements:
.. literalinclude:: src/authorization/tutorial/__init__.py
- :lines: 4-5,8
+ :lines: 1-8
:linenos:
+ :emphasize-lines: 4-5,8
:language: python
Now add those policies to the configuration:
@@ -126,15 +123,16 @@ Now add those policies to the configuration:
.. literalinclude:: src/authorization/tutorial/__init__.py
:lines: 18-23
:linenos:
+ :lineno-start: 18
:emphasize-lines: 1-3,5-6
:language: python
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added.
-We are enabling an ``AuthTktAuthenticationPolicy``, it is based in an
-auth ticket that may be included in the request, and an
-``ACLAuthorizationPolicy`` that uses an ACL to determine the allow or deny
-outcome for a view.
+We are enabling an ``AuthTktAuthenticationPolicy``, which is based in an auth
+ticket that may be included in the request. We are also enabling an
+``ACLAuthorizationPolicy``, which uses an ACL to determine the *allow* or
+*deny* outcome for a view.
Note that the :class:`pyramid.authentication.AuthTktAuthenticationPolicy`
constructor accepts two arguments: ``secret`` and ``callback``. ``secret`` is
@@ -144,235 +142,231 @@ machinery represented by this policy: it is required. The ``callback`` is the
Add permission declarations
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Open ``tutorial/tutorial/views.py``. Add a ``permission='edit'`` parameter
-to the ``@view_config`` decorator for ``add_page()`` and
-``edit_page()``, for example:
+Open ``tutorial/tutorial/views.py`` and add a ``permission='edit'`` parameter
+to the ``@view_config`` decorators for ``add_page()`` and ``edit_page()``:
-.. code-block:: python
- :linenos:
- :emphasize-lines: 3
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 50-52
+ :emphasize-lines: 2-3
+ :language: python
- @view_config(name='add_page', context='.models.Wiki',
- renderer='templates/edit.pt',
- permission='edit')
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 70-72
+ :emphasize-lines: 2-3
+ :language: python
-(Only the highlighted line, along with its preceding comma,
-needs to be added.)
+Only the highlighted lines, along with their preceding commas, need to be
+edited and added.
-The result is that only users who possess the ``edit``
-permission at the time of the request may invoke those two views.
+The result is that only users who possess the ``edit`` permission at the time
+of the request may invoke those two views.
-Add a ``permission='view'`` parameter to the ``@view_config``
-decorator for ``view_wiki()`` and ``view_page()``, like this:
+Add a ``permission='view'`` parameter to the ``@view_config`` decorator for
+``view_wiki()`` and ``view_page()`` as follows:
-.. code-block:: python
- :linenos:
- :emphasize-lines: 2
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 23-24
+ :emphasize-lines: 1-2
+ :language: python
- @view_config(context='.models.Page', renderer='templates/view.pt',
- permission='view')
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 28-29
+ :emphasize-lines: 1-2
+ :language: python
-(Only the highlighted line, along with its preceding comma,
-needs to be added.)
+Only the highlighted lines, along with their preceding commas, need to be
+edited and added.
This allows anyone to invoke these two views.
-We are done with the changes needed to control access. The
-changes that follow will add the login and logout feature.
+We are done with the changes needed to control access. The changes that
+follow will add the login and logout feature.
-Login, Logout
+Login, logout
-------------
-Add Login and Logout Views
+Add login and logout views
~~~~~~~~~~~~~~~~~~~~~~~~~~
-We'll add a ``login`` view which renders a login form and processes
-the post from the login form, checking credentials.
+We'll add a ``login`` view which renders a login form and processes the post
+from the login form, checking credentials.
-We'll also add a ``logout`` view callable to our application and
-provide a link to it. This view will clear the credentials of the
-logged in user and redirect back to the front page.
+We'll also add a ``logout`` view callable to our application and provide a
+link to it. This view will clear the credentials of the logged in user and
+redirect back to the front page.
-Add the following import statements to the
-head of ``tutorial/tutorial/views.py``:
+Add the following import statements to the head of
+``tutorial/tutorial/views.py``:
.. literalinclude:: src/authorization/tutorial/views.py
- :lines: 6-13,15-17
- :linenos:
- :emphasize-lines: 3,6-9,11
+ :lines: 6-17
+ :emphasize-lines: 1-12
:language: python
-(Only the highlighted lines, with other necessary modifications,
-need to be added.)
+All the highlighted lines need to be added or edited.
-:meth:`~pyramid.view.forbidden_view_config` will be used
-to customize the default 403 Forbidden page.
-:meth:`~pyramid.security.remember` and
-:meth:`~pyramid.security.forget` help to create and
-expire an auth ticket cookie.
+:meth:`~pyramid.view.forbidden_view_config` will be used to customize the
+default 403 Forbidden page. :meth:`~pyramid.security.remember` and
+:meth:`~pyramid.security.forget` help to create and expire an auth ticket
+cookie.
-Now add the ``login`` and ``logout`` views:
+Now add the ``login`` and ``logout`` views at the end of the file:
.. literalinclude:: src/authorization/tutorial/views.py
- :lines: 82-120
+ :lines: 82-116
:linenos:
+ :lineno-start: 82
:language: python
``login()`` has two decorators:
-- a ``@view_config`` decorator which associates it with the
- ``login`` route and makes it visible when we visit ``/login``,
-- a ``@forbidden_view_config`` decorator which turns it into
- a :term:`forbidden view`. ``login()`` will be invoked
- when a user tries to execute a view callable for which they lack
- authorization. For example, if a user has not logged in
- and tries to add or edit a Wiki page, they will be shown the
- login form before being allowed to continue.
+- a ``@view_config`` decorator which associates it with the ``login`` route
+ and makes it visible when we visit ``/login``,
+- a ``@forbidden_view_config`` decorator which turns it into a
+ :term:`forbidden view`. ``login()`` will be invoked when a user tries to
+ execute a view callable for which they lack authorization. For example, if
+ a user has not logged in and tries to add or edit a Wiki page, they will be
+ shown the login form before being allowed to continue.
-The order of these two :term:`view configuration` decorators
-is unimportant.
+The order of these two :term:`view configuration` decorators is unimportant.
-``logout()`` is decorated with a ``@view_config`` decorator
-which associates it with the ``logout`` route. It will be
-invoked when we visit ``/logout``.
+``logout()`` is decorated with a ``@view_config`` decorator which associates
+it with the ``logout`` route. It will be invoked when we visit ``/logout``.
Add the ``login.pt`` Template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Create ``tutorial/tutorial/templates/login.pt`` with the following
-content:
+Create ``tutorial/tutorial/templates/login.pt`` with the following content:
.. literalinclude:: src/authorization/tutorial/templates/login.pt
- :language: xml
+ :language: html
-The above template is referred in the login view that we just added
-in ``views.py``.
+The above template is referenced in the login view that we just added in
+``views.py``.
-Return a logged_in flag to the renderer
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Return a ``logged_in`` flag to the renderer
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Add a ``logged_in`` parameter to the return value of
-``view_page()``, ``edit_page()`` and ``add_page()``,
-like this:
+Open ``tutorial/tutorial/views.py`` again. Add a ``logged_in`` parameter to
+the return value of ``view_page()``, ``add_page()``, and ``edit_page()`` as
+follows:
-.. code-block:: python
- :linenos:
- :emphasize-lines: 4
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 47-48
+ :emphasize-lines: 1-2
+ :language: python
- return dict(page = page,
- content = content,
- edit_url = edit_url,
- logged_in = request.authenticated_userid)
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 67-68
+ :emphasize-lines: 1-2
+ :language: python
-(Only the highlighted line and a trailing comma on the preceding
-line need to be added.)
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 78-80
+ :emphasize-lines: 2-3
+ :language: python
+
+Only the highlighted lines need to be added or edited.
The :meth:`pyramid.request.Request.authenticated_userid` will be ``None`` if
-the user is not authenticated, or a user id if the user is authenticated.
+the user is not authenticated, or a userid if the user is authenticated.
Add a "Logout" link when logged in
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Open ``tutorial/tutorial/templates/edit.pt`` and
-``tutorial/tutorial/templates/view.pt`` and add this within the
-``<div id="right" class="app-welcome align-right">`` div:
+``tutorial/tutorial/templates/view.pt`` and add the following code as
+indicated by the highlighted lines.
-.. code-block:: xml
-
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
+.. literalinclude:: src/authorization/tutorial/templates/edit.pt
+ :lines: 34-38
+ :emphasize-lines: 3-5
+ :language: html
-The attribute ``tal:condition="logged_in"`` will make the element be
-included when ``logged_in`` is any user id. The link will invoke
-the logout view. The above element will not be included if ``logged_in``
-is ``None``, such as when a user is not authenticated.
+The attribute ``tal:condition="logged_in"`` will make the element be included
+when ``logged_in`` is any user id. The link will invoke the logout view. The
+above element will not be included if ``logged_in`` is ``None``, such as when
+a user is not authenticated.
-Seeing Our Changes
-------------------
+Reviewing our changes
+---------------------
-Our ``tutorial/tutorial/__init__.py`` will look something like this
-when we're done:
+Our ``tutorial/tutorial/__init__.py`` will look like this when we're done:
.. literalinclude:: src/authorization/tutorial/__init__.py
:linenos:
:emphasize-lines: 4-5,8,18-20,22-23
:language: python
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Our ``tutorial/tutorial/models.py`` will look something like this
-when we're done:
+Our ``tutorial/tutorial/models.py`` will look like this when we're done:
.. literalinclude:: src/authorization/tutorial/models.py
:linenos:
:emphasize-lines: 4-7,12-13
:language: python
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Our ``tutorial/tutorial/views.py`` will look something like this
-when we're done:
+Our ``tutorial/tutorial/views.py`` will look like this when we're done:
.. literalinclude:: src/authorization/tutorial/views.py
:linenos:
:emphasize-lines: 8,11-15,17,24,29,48,52,68,72,80,82-120
:language: python
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Our ``tutorial/tutorial/templates/edit.pt`` template will look
-something like this when we're done:
+Our ``tutorial/tutorial/templates/edit.pt`` template will look like this when
+we're done:
.. literalinclude:: src/authorization/tutorial/templates/edit.pt
:linenos:
- :emphasize-lines: 41-43
- :language: xml
+ :emphasize-lines: 36-38
+ :language: html
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Our ``tutorial/tutorial/templates/view.pt`` template will look
-something like this when we're done:
+Our ``tutorial/tutorial/templates/view.pt`` template will look like this when
+we're done:
.. literalinclude:: src/authorization/tutorial/templates/view.pt
:linenos:
- :emphasize-lines: 41-43
- :language: xml
+ :emphasize-lines: 36-38
+ :language: html
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Viewing the Application in a Browser
+Viewing the application in a browser
------------------------------------
We can finally examine our application in a browser (See
-:ref:`wiki-start-the-application`). Launch a browser and visit
-each of the following URLs, check that the result is as expected:
-
-- ``http://localhost:6543/`` invokes the
- ``view_wiki`` view. This always redirects to the ``view_page`` view
- of the ``FrontPage`` Page resource. It is executable by any user.
-
-- ``http://localhost:6543/FrontPage`` invokes
- the ``view_page`` view of the ``FrontPage`` Page resource. This is because
- it's the :term:`default view` (a view without a ``name``) for ``Page``
- resources. It is executable by any user.
-
-- ``http://localhost:6543/FrontPage/edit_page``
- invokes the edit view for the FrontPage object. It is executable by
- only the ``editor`` user. If a different user (or the anonymous
- user) invokes it, a login form will be displayed. Supplying the
- credentials with the username ``editor``, password ``editor`` will
- display the edit page form.
-
-- ``http://localhost:6543/add_page/SomePageName``
- invokes the add view for a page. It is executable by only
- the ``editor`` user. If a different user (or the anonymous user)
- invokes it, a login form will be displayed. Supplying the
- credentials with the username ``editor``, password ``editor`` will
- display the edit page form.
-
-- After logging in (as a result of hitting an edit or add page
- and submitting the login form with the ``editor``
- credentials), we'll see a Logout link in the upper right hand
- corner. When we click it, we're logged out, and redirected
- back to the front page.
+:ref:`wiki-start-the-application`). Launch a browser and visit each of the
+following URLs, checking that the result is as expected:
+
+- http://localhost:6543/ invokes the ``view_wiki`` view. This always
+ redirects to the ``view_page`` view of the ``FrontPage`` Page resource. It
+ is executable by any user.
+
+- http://localhost:6543/FrontPage invokes the ``view_page`` view of the
+ ``FrontPage`` Page resource. This is because it's the :term:`default view`
+ (a view without a ``name``) for ``Page`` resources. It is executable by any
+ user.
+
+- http://localhost:6543/FrontPage/edit_page invokes the edit view for the
+ FrontPage object. It is executable by only the ``editor`` user. If a
+ different user (or the anonymous user) invokes it, a login form will be
+ displayed. Supplying the credentials with the username ``editor``, password
+ ``editor`` will display the edit page form.
+
+- http://localhost:6543/add_page/SomePageName invokes the add view for a page.
+ It is executable by only the ``editor`` user. If a different user (or the
+ anonymous user) invokes it, a login form will be displayed. Supplying the
+ credentials with the username ``editor``, password ``editor`` will display
+ the edit page form.
+
+- After logging in (as a result of hitting an edit or add page and submitting
+ the login form with the ``editor`` credentials), we'll see a Logout link in
+ the upper right hand corner. When we click it, we're logged out, and
+ redirected back to the front page.
diff --git a/docs/tutorials/wiki/basiclayout.rst b/docs/tutorials/wiki/basiclayout.rst
index cdf52b73e..0484ebf17 100644
--- a/docs/tutorials/wiki/basiclayout.rst
+++ b/docs/tutorials/wiki/basiclayout.rst
@@ -2,25 +2,27 @@
Basic Layout
============
-The starter files generated by the ``zodb`` scaffold are basic, but
+The starter files generated by the ``zodb`` scaffold are very basic, but
they provide a good orientation for the high-level patterns common to most
-:term:`traversal` -based :app:`Pyramid` (and :term:`ZODB` -based) projects.
+:term:`traversal`-based (and :term:`ZODB`-based) :app:`Pyramid` projects.
-Application Configuration with ``__init__.py``
-------------------------------------------------
+Application configuration with ``__init__.py``
+----------------------------------------------
A directory on disk can be turned into a Python :term:`package` by containing
an ``__init__.py`` file. Even if empty, this marks a directory as a Python
-package. Our application uses ``__init__.py`` both as a package marker and
-to contain application configuration code.
+package. We use ``__init__.py`` both as a marker, indicating the directory
+in which it's contained is a package, and to contain application configuration
+code.
When you run the application using the ``pserve`` command using the
-``development.ini`` generated config file, the application configuration
-points at a Setuptools *entry point* described as ``egg:tutorial``. In our
-application, because the application's ``setup.py`` file says so, this entry
-point happens to be the ``main`` function within the file named
-``__init__.py``:
+``development.ini`` generated configuration file, the application
+configuration points at a Setuptools *entry point* described as
+``egg:tutorial``. In our application, because the application's ``setup.py``
+file says so, this entry point happens to be the ``main`` function within the
+file named ``__init__.py``. Let's take a look at the code and describe what
+it does:
.. literalinclude:: src/basiclayout/tutorial/__init__.py
:linenos:
@@ -28,17 +30,19 @@ point happens to be the ``main`` function within the file named
#. *Lines 1-3*. Perform some dependency imports.
-#. *Lines 6-8*. Define a root factory for our Pyramid application.
+#. *Lines 6-8*. Define a :term:`root factory` for our Pyramid application.
-#. *Line 14*. We construct a :term:`Configurator` with a :term:`root
- factory` and the settings keywords parsed by :term:`PasteDeploy`. The root
+#. *Line 11*. ``__init__.py`` defines a function named ``main``.
+
+#. *Line 14*. We construct a :term:`Configurator` with a root
+ factory and the settings keywords parsed by :term:`PasteDeploy`. The root
factory is named ``root_factory``.
#. *Line 15*. Include support for the :term:`Chameleon` template rendering
bindings, allowing us to use the ``.pt`` templates.
-#. *Line 16*. Register a "static view" which answers requests whose URL path
- start with ``/static`` using the
+#. *Line 16*. Register a "static view", which answers requests whose URL
+ paths start with ``/static``, using the
:meth:`pyramid.config.Configurator.add_static_view` method. This
statement registers a view that will serve up static assets, such as CSS
and image files, for us, in this case, at
@@ -63,7 +67,7 @@ point happens to be the ``main`` function within the file named
:meth:`pyramid.config.Configurator.make_wsgi_app` method
to return a :term:`WSGI` application.
-Resources and Models with ``models.py``
+Resources and models with ``models.py``
---------------------------------------
:app:`Pyramid` uses the word :term:`resource` to describe objects arranged
@@ -93,13 +97,12 @@ Here is the source for ``models.py``:
root* object. It is called on *every request* to the
:app:`Pyramid` application. It also performs bootstrapping by
*creating* an application root (inside the ZODB root object) if one
- does not already exist. It is used by the "root_factory" we've defined
+ does not already exist. It is used by the ``root_factory`` we've defined
in our ``__init__.py``.
- We do so by first seeing if the database has the persistent
- application root. If not, we make an instance, store it, and
- commit the transaction. We then return the application root
- object.
+ Bootstrapping is done by first seeing if the database has the persistent
+ application root. If not, we make an instance, store it, and commit the
+ transaction. We then return the application root object.
Views With ``views.py``
-----------------------
@@ -171,6 +174,6 @@ opposed to the tutorial :term:`package` directory) looks like this:
Note the existence of a ``[app:main]`` section which specifies our WSGI
application. Our ZODB database settings are specified as the
``zodbconn.uri`` setting within this section. This value, and the other
-values within this section are passed as ``**settings`` to the ``main``
+values within this section, are passed as ``**settings`` to the ``main``
function we defined in ``__init__.py`` when the server is started via
``pserve``.
diff --git a/docs/tutorials/wiki/definingmodels.rst b/docs/tutorials/wiki/definingmodels.rst
index 49372179f..859e902ab 100644
--- a/docs/tutorials/wiki/definingmodels.rst
+++ b/docs/tutorials/wiki/definingmodels.rst
@@ -15,7 +15,7 @@ single instance of the "Wiki" class will serve as a container for "Page"
objects, which will be instances of the "Page" class.
-Delete the Database
+Delete the database
-------------------
In the next step, we're going to remove the ``MyModel`` Python model
@@ -32,12 +32,19 @@ Edit ``models.py``
.. note::
- There is nothing automagically special about the filename ``models.py``. A
+ There is nothing special about the filename ``models.py``. A
project may have many models throughout its codebase in arbitrarily named
- files. Files implementing models often have ``model`` in their filenames,
+ files. Files implementing models often have ``model`` in their filenames
or they may live in a Python subpackage of your application package named
``models``, but this is only by convention.
+Open ``tutorial/tutorial/models.py`` file and edit it to look like the
+following:
+
+.. literalinclude:: src/models/tutorial/models.py
+ :linenos:
+ :language: python
+
The first thing we want to do is remove the ``MyModel`` class from the
generated ``models.py`` file. The ``MyModel`` class is only a sample and
we're not going to use it.
@@ -70,17 +77,7 @@ front page) into the Wiki within the ``appmaker``. This will provide
:term:`traversal` a :term:`resource tree` to work against when it attempts to
resolve URLs to resources.
-Look at the Result of Our Edits to ``models.py``
-------------------------------------------------
-
-The result of all of our edits to ``models.py`` will end up looking
-something like this:
-
-.. literalinclude:: src/models/tutorial/models.py
- :linenos:
- :language: python
-
-View the Application in a Browser
+View the application in a browser
---------------------------------
We can't. At this point, our system is in a "non-runnable" state; we'll need
diff --git a/docs/tutorials/wiki/definingviews.rst b/docs/tutorials/wiki/definingviews.rst
index e06468267..ed173a706 100644
--- a/docs/tutorials/wiki/definingviews.rst
+++ b/docs/tutorials/wiki/definingviews.rst
@@ -17,7 +17,7 @@ assumed to return a :term:`response` object.
interchangeably as necessary. In :term:`traversal` based applications,
URLs are mapped to a context :term:`resource`, and since our
:term:`resource tree` also represents our application's
- "domain model", we're often interested in the context, because
+ "domain model", we're often interested in the context because
it represents the persistent storage of our application. For
this reason, in this tutorial we define views as callables that
accept ``context`` in the callable argument list. If you do
@@ -35,35 +35,80 @@ Declaring Dependencies in Our ``setup.py`` File
The view code in our application will depend on a package which is not a
dependency of the original "tutorial" application. The original "tutorial"
application was generated by the ``pcreate`` command; it doesn't know
-about our custom application requirements. We need to add a dependency on
-the ``docutils`` package to our ``tutorial`` package's ``setup.py`` file by
-assigning this dependency to the ``install_requires`` parameter in the
-``setup`` function.
+about our custom application requirements.
-Our resulting ``setup.py`` should look like so:
+We need to add a dependency on the ``docutils`` package to our ``tutorial``
+package's ``setup.py`` file by assigning this dependency to the ``requires``
+parameter in the ``setup()`` function.
+
+Open ``tutorial/setup.py`` and edit it to look like the following:
.. literalinclude:: src/views/setup.py
:linenos:
+ :emphasize-lines: 20
+ :language: python
+
+Only the highlighted line needs to be added.
+
+Running ``setup.py develop``
+============================
+
+Since a new software dependency was added, you will need to run ``python
+setup.py develop`` again inside the root of the ``tutorial`` package to obtain
+and register the newly added dependency distribution.
+
+Make sure your current working directory is the root of the project (the
+directory in which ``setup.py`` lives) and execute the following command.
+
+On UNIX:
+
+.. code-block:: text
+
+ $ cd tutorial
+ $ $VENV/bin/python setup.py develop
+
+On Windows:
+
+.. code-block:: text
+
+ c:\pyramidtut> cd tutorial
+ c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py develop
+
+Success executing this command will end with a line to the console something
+like::
+
+ Finished processing dependencies for tutorial==0.0
+
+Adding view functions in ``views.py``
+=====================================
+
+It's time for a major change. Open ``tutorial/tutorial/views.py`` and edit it
+to look like the following:
+
+.. literalinclude:: src/views/tutorial/views.py
+ :linenos:
:language: python
-.. note:: After these new dependencies are added, you will need to
- rerun ``python setup.py develop`` inside the root of the
- ``tutorial`` package to obtain and register the newly added
- dependency package.
+We added some imports and created a regular expression to find "WikiWords".
+
+We got rid of the ``my_view`` view function and its decorator that was added
+when we originally rendered the ``zodb`` scaffold. It was only an example and
+isn't relevant to our application.
+
+Then we added four :term:`view callable` functions to our ``views.py``
+module:
-Adding View Functions
-=====================
+* ``view_wiki()`` - Displays the wiki itself. It will answer on the root URL.
+* ``view_page()`` - Displays an individual page.
+* ``add_page()`` - Allows the user to add a page.
+* ``edit_page()`` - Allows the user to edit a page.
-We're going to add four :term:`view callable` functions to our ``views.py``
-module. One view named ``view_wiki`` will display the wiki itself (it will
-answer on the root URL), another named ``view_page`` will display an
-individual page, another named ``add_page`` will allow a page to be added,
-and a final view named ``edit_page`` will allow a page to be edited.
+We'll describe each one briefly in the following sections.
.. note::
There is nothing special about the filename ``views.py``. A project may
- have many view callables throughout its codebase in arbitrarily-named
+ have many view callables throughout its codebase in arbitrarily named
files. Files implementing view callables often have ``view`` in their
filenames (or may live in a Python subpackage of your application package
named ``views``), but this is only by convention.
@@ -71,44 +116,55 @@ and a final view named ``edit_page`` will allow a page to be edited.
The ``view_wiki`` view function
-------------------------------
-Here is the code for the ``view_wiki`` view function and its decorator, which
-will be added to ``views.py``:
+Following is the code for the ``view_wiki`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
:lines: 12-14
+ :lineno-start: 12
+ :linenos:
:language: python
-The ``view_wiki`` function will be configured to respond as the default view
-callable for a Wiki resource. We'll provide it with a ``@view_config``
-decorator which names the class ``tutorial.models.Wiki`` as its context.
-This means that when a Wiki resource is the context, and no :term:`view name`
-exists in the request, this view will be used. The view configuration
-associated with ``view_wiki`` does not use a ``renderer`` because the view
-callable always returns a :term:`response` object rather than a dictionary.
-No renderer is necessary when a view returns a response object.
-
-The ``view_wiki`` view callable always redirects to the URL of a Page
-resource named "FrontPage". To do so, it returns an instance of the
+.. note:: In our code, we use an *import* that is *relative* to our package
+ named ``tutorial``, meaning we can omit the name of the package in the
+ ``import`` and ``context`` statements. In our narrative, however, we refer
+ to a *class* and thus we use the *absolute* form, meaning that the name of
+ the package is included.
+
+``view_wiki()`` is the :term:`default view` that gets called when a request is
+made to the root URL of our wiki. It always redirects to an URL which
+represents the path to our "FrontPage".
+
+We provide it with a ``@view_config`` decorator which names the class
+``tutorial.models.Wiki`` as its context. This means that when a Wiki resource
+is the context and no :term:`view name` exists in the request, then this view
+will be used. The view configuration associated with ``view_wiki`` does not
+use a ``renderer`` because the view callable always returns a :term:`response`
+object rather than a dictionary. No renderer is necessary when a view returns
+a response object.
+
+The ``view_wiki`` view callable always redirects to the URL of a Page resource
+named "FrontPage". To do so, it returns an instance of the
:class:`pyramid.httpexceptions.HTTPFound` class (instances of which implement
-the :class:`pyramid.interfaces.IResponse` interface like
-:class:`pyramid.response.Response` does).
-:meth:`pyramid.request.Request.resource_url` constructs a URL to the
+the :class:`pyramid.interfaces.IResponse` interface, like
+:class:`pyramid.response.Response` does). It uses the
+:meth:`pyramid.request.Request.route_url` API to construct an URL to the
``FrontPage`` page resource (i.e., ``http://localhost:6543/FrontPage``), and
-uses it as the "location" of the HTTPFound response, forming an HTTP
+uses it as the "location" of the ``HTTPFound`` response, forming an HTTP
redirect.
The ``view_page`` view function
-------------------------------
-Here is the code for the ``view_page`` view function and its decorator, which
-will be added to ``views.py``:
+Here is the code for the ``view_page`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
:lines: 16-33
+ :lineno-start: 16
+ :linenos:
:language: python
-The ``view_page`` function will be configured to respond as the default view
-of a Page resource. We'll provide it with a ``@view_config`` decorator which
+The ``view_page`` function is configured to respond as the default view
+of a Page resource. We provide it with a ``@view_config`` decorator which
names the class ``tutorial.models.Page`` as its context. This means that
when a Page resource is the context, and no :term:`view name` exists in the
request, this view will be used. We inform :app:`Pyramid` this view will use
@@ -116,9 +172,9 @@ the ``templates/view.pt`` template file as a ``renderer``.
The ``view_page`` function generates the :term:`reStructuredText` body of a
page (stored as the ``data`` attribute of the context passed to the view; the
-context will be a Page resource) as HTML. Then it substitutes an HTML anchor
-for each *WikiWord* reference in the rendered HTML using a compiled regular
-expression.
+context will be a ``Page`` resource) as HTML. Then it substitutes an HTML
+anchor for each *WikiWord* reference in the rendered HTML using a compiled
+regular expression.
The curried function named ``check`` is used as the first argument to
``wikiwords.sub``, indicating that it should be called to provide a value for
@@ -133,8 +189,8 @@ As a result, the ``content`` variable is now a fully formed bit of HTML
containing various view and add links for WikiWords based on the content of
our current page resource.
-We then generate an edit URL (because it's easier to do here than in the
-template), and we wrap up a number of arguments in a dictionary and return
+We then generate an edit URL because it's easier to do here than in the
+template, and we wrap up a number of arguments in a dictionary and return
it.
The arguments we wrap into a dictionary include ``page``, ``content``, and
@@ -153,22 +209,23 @@ callable. In the ``view_wiki`` view callable, we unconditionally return a
The ``add_page`` view function
------------------------------
-Here is the code for the ``add_page`` view function and its decorator, which
-will be added to ``views.py``:
+Here is the code for the ``add_page`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
:lines: 35-50
+ :lineno-start: 35
+ :linenos:
:language: python
-The ``add_page`` function will be configured to respond when the context
-resource is a Wiki and the :term:`view name` is ``add_page``. We'll provide
-it with a ``@view_config`` decorator which names the string ``add_page`` as
-its :term:`view name` (via name=), the class ``tutorial.models.Wiki`` as its
-context, and the renderer named ``templates/edit.pt``. This means that when
-a Wiki resource is the context, and a :term:`view name` named ``add_page``
+The ``add_page`` function is configured to respond when the context resource
+is a Wiki and the :term:`view name` is ``add_page``. We provide it with a
+``@view_config`` decorator which names the string ``add_page`` as its
+:term:`view name` (via ``name=``), the class ``tutorial.models.Wiki`` as its
+context, and the renderer named ``templates/edit.pt``. This means that when a
+Wiki resource is the context, and a :term:`view name` named ``add_page``
exists as the result of traversal, this view will be used. We inform
-:app:`Pyramid` this view will use the ``templates/edit.pt`` template file as
-a ``renderer``. We share the same template between add and edit views, thus
+:app:`Pyramid` this view will use the ``templates/edit.pt`` template file as a
+``renderer``. We share the same template between add and edit views, thus
``edit.pt`` instead of ``add.pt``.
The ``add_page`` function will be invoked when a user clicks on a WikiWord
@@ -181,7 +238,7 @@ Page resource).
The request :term:`subpath` in :app:`Pyramid` is the sequence of names that
are found *after* the :term:`view name` in the URL segments given in the
``PATH_INFO`` of the WSGI request as the result of :term:`traversal`. If our
-add view is invoked via, e.g. ``http://localhost:6543/add_page/SomeName``,
+add view is invoked via, e.g., ``http://localhost:6543/add_page/SomeName``,
the :term:`subpath` will be a tuple: ``('SomeName',)``.
The add view takes the zeroth element of the subpath (the wiki page name),
@@ -198,7 +255,7 @@ order to satisfy the edit form's desire to have *some* page object exposed as
``page``, and we'll render the template to a response.
If the view rendering *is* a result of a form submission (if the expression
-``'form.submitted' in request.params`` is ``True``), we scrape the page body
+``'form.submitted' in request.params`` is ``True``), we grab the page body
from the form data, create a Page object using the name in the subpath and
the page body, and save it into "our context" (the Wiki) using the
``__setitem__`` method of the context. We then redirect back to the
@@ -207,15 +264,16 @@ the page body, and save it into "our context" (the Wiki) using the
The ``edit_page`` view function
-------------------------------
-Here is the code for the ``edit_page`` view function and its decorator, which
-will be added to ``views.py``:
+Here is the code for the ``edit_page`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
:lines: 52-60
+ :lineno-start: 52
+ :linenos:
:language: python
-The ``edit_page`` function will be configured to respond when the context is
-a Page resource and the :term:`view name` is ``edit_page``. We'll provide it
+The ``edit_page`` function is configured to respond when the context is
+a Page resource and the :term:`view name` is ``edit_page``. We provide it
with a ``@view_config`` decorator which names the string ``edit_page`` as its
:term:`view name` (via ``name=``), the class ``tutorial.models.Page`` as its
context, and the renderer named ``templates/edit.pt``. This means that when
@@ -240,26 +298,16 @@ If the view execution *is* a result of a form submission (if the expression
attribute of the page context. It then redirects to the default view of the
context (the page), which will always be the ``view_page`` view.
-Viewing the Result of all Our Edits to ``views.py``
-===================================================
-
-The result of all of our edits to ``views.py`` will leave it looking like
-this:
-
-.. literalinclude:: src/views/tutorial/views.py
- :linenos:
- :language: python
-
-Adding Templates
+Adding templates
================
The ``view_page``, ``add_page`` and ``edit_page`` views that we've added
-reference a :term:`template`. Each template is a :term:`Chameleon` :term:`ZPT`
-template. These templates will live in the ``templates`` directory of our
-tutorial package. Chameleon templates must have a ``.pt`` extension to be
-recognized as such.
+reference a :term:`template`. Each template is a :term:`Chameleon`
+:term:`ZPT` template. These templates will live in the ``templates``
+directory of our tutorial package. Chameleon templates must have a ``.pt``
+extension to be recognized as such.
-The ``view.pt`` Template
+The ``view.pt`` template
------------------------
Create ``tutorial/tutorial/templates/view.pt`` and add the following
@@ -267,20 +315,18 @@ content:
.. literalinclude:: src/views/tutorial/templates/view.pt
:linenos:
- :language: xml
+ :language: html
This template is used by ``view_page()`` for displaying a single
wiki page. It includes:
-- A ``div`` element that is replaced with the ``content``
- value provided by the view (rows 45-47). ``content``
- contains HTML, so the ``structure`` keyword is used
- to prevent escaping it (i.e. changing ">" to "&gt;", etc.)
-- A link that points
- at the "edit" URL which invokes the ``edit_page`` view for
- the page being viewed (rows 49-51).
+- A ``div`` element that is replaced with the ``content`` value provided by
+ the view (lines 36-38). ``content`` contains HTML, so the ``structure``
+ keyword is used to prevent escaping it (i.e., changing ">" to "&gt;", etc.)
+- A link that points at the "edit" URL which invokes the ``edit_page`` view
+ for the page being viewed (lines 40-42).
-The ``edit.pt`` Template
+The ``edit.pt`` template
------------------------
Create ``tutorial/tutorial/templates/edit.pt`` and add the following
@@ -288,66 +334,58 @@ content:
.. literalinclude:: src/views/tutorial/templates/edit.pt
:linenos:
- :language: xml
+ :language: html
-This template is used by ``add_page()`` and ``edit_page()`` for adding
-and editing a wiki page. It displays
-a page containing a form that includes:
+This template is used by ``add_page()`` and ``edit_page()`` for adding and
+editing a wiki page. It displays a page containing a form that includes:
- A 10 row by 60 column ``textarea`` field named ``body`` that is filled
- with any existing page data when it is rendered (rows 46-47).
-- A submit button that has the name ``form.submitted`` (row 48).
-
-The form POSTs back to the "save_url" argument supplied
-by the view (row 45). The view will use the ``body`` and
-``form.submitted`` values.
-
-.. note:: Our templates use a ``request`` object that
- none of our tutorial views return in their dictionary.
- ``request`` is one of several
- names that are available "by default" in a template when a template
- renderer is used. See :ref:`renderer_system_values` for
- information about other names that are available by default
- when a template is used as a renderer.
-
-Static Assets
+ with any existing page data when it is rendered (line 45).
+- A submit button that has the name ``form.submitted`` (line 48).
+
+The form POSTs back to the ``save_url`` argument supplied by the view (line
+43). The view will use the ``body`` and ``form.submitted`` values.
+
+.. note:: Our templates use a ``request`` object that none of our tutorial
+ views return in their dictionary. ``request`` is one of several names that
+ are available "by default" in a template when a template renderer is used.
+ See :ref:`renderer_system_values` for information about other names that
+ are available by default when a template is used as a renderer.
+
+Static assets
-------------
-Our templates name a single static asset named ``pylons.css``. We don't need
-to create this file within our package's ``static`` directory because it was
-provided at the time we created the project. This file is a little too long to
-replicate within the body of this guide, however it is available `online
-<https://github.com/Pylons/pyramid/blob/master/docs/tutorials/wiki/src/views/tutorial/static/pylons.css>`_.
+Our templates name static assets, including CSS and images. We don't need
+to create these files within our package's ``static`` directory because they
+were provided at the time we created the project.
-This CSS file will be accessed via
-e.g. ``/static/pylons.css`` by virtue of the call to
+As an example, the CSS file will be accessed via
+``http://localhost:6543/static/theme.css`` by virtue of the call to the
``add_static_view`` directive we've made in the ``__init__.py`` file. Any
number and type of static assets can be placed in this directory (or
-subdirectories) and are just referred to by URL.
+subdirectories) and are just referred to by URL or by using the convenience
+method ``static_url``, e.g.,
+``request.static_url('<package>:static/foo.css')`` within templates.
-Viewing the Application in a Browser
+Viewing the application in a browser
====================================
We can finally examine our application in a browser (See
:ref:`wiki-start-the-application`). Launch a browser and visit
-each of the following URLs, check that the result is as expected:
+each of the following URLs, checking that the result is as expected:
-- ``http://localhost:6543/`` invokes the ``view_wiki``
- view. This always redirects to the ``view_page`` view of the ``FrontPage``
- Page resource.
+- http://localhost:6543/ invokes the ``view_wiki`` view. This always
+ redirects to the ``view_page`` view of the ``FrontPage`` Page resource.
-- ``http://localhost:6543/FrontPage/`` invokes
- the ``view_page`` view of the front page resource. This is
- because it's the :term:`default view` (a view without a ``name``) for Page
- resources.
+- http://localhost:6543/FrontPage/ invokes the ``view_page`` view of the front
+ page resource. This is because it's the :term:`default view` (a view
+ without a ``name``) for Page resources.
-- ``http://localhost:6543/FrontPage/edit_page``
- invokes the edit view for the ``FrontPage`` Page resource.
+- http://localhost:6543/FrontPage/edit_page invokes the edit view for the
+ ``FrontPage`` Page resource.
-- ``http://localhost:6543/add_page/SomePageName``
- invokes the add view for a Page.
+- http://localhost:6543/add_page/SomePageName invokes the add view for a Page.
-- To generate an error, visit ``http://localhost:6543/add_page`` which
- will generate an ``IndexErrorr: tuple index out of range`` error.
- You'll see an interactive traceback
- facility provided by :term:`pyramid_debugtoolbar`.
+- To generate an error, visit http://localhost:6543/add_page which will
+ generate an ``IndexErrorr: tuple index out of range`` error. You'll see an
+ interactive traceback facility provided by :term:`pyramid_debugtoolbar`.
diff --git a/docs/tutorials/wiki/design.rst b/docs/tutorials/wiki/design.rst
index eb785dd1c..46c2a2f30 100644
--- a/docs/tutorials/wiki/design.rst
+++ b/docs/tutorials/wiki/design.rst
@@ -1,23 +1,23 @@
-==========
+======
Design
-==========
+======
-Following is a quick overview of our wiki application, to help
-us understand the changes that we will be doing next in our
-default files generated by the ``zodb`` scaffold.
+Following is a quick overview of the design of our wiki application, to help
+us understand the changes that we will be making as we work through the
+tutorial.
Overall
-------
-We choose to use ``reStructuredText`` markup in the wiki text.
-Translation from reStructuredText to HTML is provided by the
-widely used ``docutils`` Python module. We will add this module
-in the dependency list on the project ``setup.py`` file.
+We choose to use :term:`reStructuredText` markup in the wiki text. Translation
+from reStructuredText to HTML is provided by the widely used ``docutils``
+Python module. We will add this module in the dependency list on the project
+``setup.py`` file.
Models
------
-The root resource, named *Wiki*, will be a mapping of wiki page
+The root resource named ``Wiki`` will be a mapping of wiki page
names to page resources. The page resources will be instances
of a *Page* class and they store the text content.
@@ -29,9 +29,9 @@ To add a page to the wiki, a new instance of the page resource
is created and its name and reference are added to the Wiki
mapping.
-A page named *FrontPage* containing the text *This is the front
-page*, will be created when the storage is initialized, and will
-be used as the wiki home page.
+A page named ``FrontPage`` containing the text *This is the front page*, will
+be created when the storage is initialized, and will be used as the wiki home
+page.
Views
-----
@@ -53,18 +53,17 @@ Security
We'll eventually be adding security to our application. The components we'll
use to do this are below.
-- USERS, a dictionary mapping usernames to their
+- USERS, a dictionary mapping :term:`userids <userid>` to their
corresponding passwords.
-- GROUPS, a dictionary mapping usernames to a
- list of groups to which they belong to.
+- GROUPS, a dictionary mapping :term:`userids <userid>` to a
+ list of groups to which they belong.
-- ``groupfinder``, an *authorization callback* that looks up
- USERS and GROUPS. It will be provided in a new
- *security.py* file.
+- ``groupfinder``, an *authorization callback* that looks up USERS and
+ GROUPS. It will be provided in a new ``security.py`` file.
-- An :term:`ACL` is attached to the root :term:`resource`. Each
- row below details an :term:`ACE`:
+- An :term:`ACL` is attached to the root :term:`resource`. Each row below
+ details an :term:`ACE`:
+----------+----------------+----------------+
| Action | Principal | Permission |
@@ -125,7 +124,7 @@ listed in the following table:
| | | | authenticate. | | |
| | | | | | |
| | | | - If authentication | | |
-| | | | successful, | | |
+| | | | succeeds, | | |
| | | | redirect to the | | |
| | | | page that we | | |
| | | | came from. | | |
@@ -145,6 +144,6 @@ listed in the following table:
when there is no view name.
.. [2] Pyramid will return a default 404 Not Found page
if the page *PageName* does not exist yet.
-.. [3] pyramid.exceptions.Forbidden is reached when a
+.. [3] ``pyramid.exceptions.Forbidden`` is reached when a
user tries to invoke a view that is
not authorized by the authorization policy.
diff --git a/docs/tutorials/wiki/distributing.rst b/docs/tutorials/wiki/distributing.rst
index 9c63cf0bd..fee50a1cf 100644
--- a/docs/tutorials/wiki/distributing.rst
+++ b/docs/tutorials/wiki/distributing.rst
@@ -2,11 +2,11 @@
Distributing Your Application
=============================
-Once your application works properly, you can create a "tarball" from
-it by using the ``setup.py sdist`` command. The following commands
-assume your current working directory is the ``tutorial`` package
-we've created and that the parent directory of the ``tutorial``
-package is a virtualenv representing a :app:`Pyramid` environment.
+Once your application works properly, you can create a "tarball" from it by
+using the ``setup.py sdist`` command. The following commands assume your
+current working directory is the ``tutorial`` package we've created and that
+the parent directory of the ``tutorial`` package is a virtualenv representing
+a :app:`Pyramid` environment.
On UNIX:
@@ -27,16 +27,14 @@ The output of such a command will be something like:
running sdist
# .. more output ..
creating dist
- tar -cf dist/tutorial-0.1.tar tutorial-0.1
- gzip -f9 dist/tutorial-0.1.tar
- removing 'tutorial-0.1' (and everything under it)
-
-Note that this command creates a tarball in the "dist" subdirectory
-named ``tutorial-0.1.tar.gz``. You can send this file to your friends
-to show them your cool new application. They should be able to
-install it by pointing the ``easy_install`` command directly at it.
-Or you can upload it to `PyPI <http://pypi.python.org>`_ and share it
-with the rest of the world, where it can be downloaded via
-``easy_install`` remotely like any other package people download from
-PyPI.
-
+ tar -cf dist/tutorial-0.0.tar tutorial-0.0
+ gzip -f9 dist/tutorial-0.0.tar
+ removing 'tutorial-0.0' (and everything under it)
+
+Note that this command creates a tarball in the "dist" subdirectory named
+``tutorial-0.0.tar.gz``. You can send this file to your friends to show them
+your cool new application. They should be able to install it by pointing the
+``easy_install`` command directly at it. Or you can upload it to `PyPI
+<http://pypi.python.org>`_ and share it with the rest of the world, where it
+can be downloaded via ``easy_install`` remotely like any other package people
+download from PyPI.
diff --git a/docs/tutorials/wiki/index.rst b/docs/tutorials/wiki/index.rst
index 981d135c7..89c026dac 100644
--- a/docs/tutorials/wiki/index.rst
+++ b/docs/tutorials/wiki/index.rst
@@ -3,10 +3,10 @@
ZODB + Traversal Wiki Tutorial
==============================
-This tutorial introduces a :term:`traversal` -based :app:`Pyramid`
-application to a developer familiar with Python. It will be most familiar to
-developers with previous :term:`Zope` experience. When we're done with the
-tutorial, the developer will have created a basic Wiki application with
+This tutorial introduces a :term:`ZODB` and :term:`traversal`-based
+:app:`Pyramid` application to a developer familiar with Python. It will be
+most familiar to developers with previous :term:`Zope` experience. When the
+is finished, the developer will have created a basic Wiki application with
authentication.
For cut and paste purposes, the source code for all stages of this
diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst
index b51254b92..ff5cac4c9 100644
--- a/docs/tutorials/wiki/installation.rst
+++ b/docs/tutorials/wiki/installation.rst
@@ -2,125 +2,218 @@
Installation
============
-Preparation
-===========
+Before you begin
+================
-Follow the steps in :ref:`installing_chapter`, but name the virtualenv
-directory ``pyramidtut``.
+This tutorial assumes that you have already followed the steps in
+:ref:`installing_chapter`, except **do not create a virtualenv or install
+Pyramid**. Thereby you will satisfy the following requirements.
-Preparation, UNIX
------------------
+* Python interpreter is installed on your operating system
+* :term:`setuptools` or :term:`distribute` is installed
+* :term:`virtualenv` is installed
+Create directory to contain the project
+---------------------------------------
-#. Switch to the ``pyramidtut`` directory:
+We need a workspace for our project files.
- .. code-block:: text
+On UNIX
+^^^^^^^
- $ cd pyramidtut
+.. code-block:: text
+
+ $ mkdir ~/pyramidtut
+
+On Windows
+^^^^^^^^^^
+
+.. code-block:: text
+
+ c:\> mkdir pyramidtut
-#. Install tutorial dependencies:
+Create and use a virtual Python environment
+-------------------------------------------
- .. code-block:: text
+Next let's create a `virtualenv` workspace for our project. We will
+use the `VENV` environment variable instead of the absolute path of the
+virtual environment.
- $ $VENV/bin/easy_install docutils pyramid_tm pyramid_zodbconn \
- pyramid_debugtoolbar nose coverage
+On UNIX
+^^^^^^^
-Preparation, Windows
---------------------
+.. code-block:: text
+
+ $ export VENV=~/pyramidtut
+ $ virtualenv $VENV
+ New python executable in /home/foo/env/bin/python
+ Installing setuptools.............done.
+
+On Windows
+^^^^^^^^^^
+.. code-block:: text
+
+ c:\> set VENV=c:\pyramidtut
-#. Switch to the ``pyramidtut`` directory:
+Versions of Python use different paths, so you will need to adjust the
+path to the command for your Python version.
- .. code-block:: text
+Python 2.7:
- c:\> cd pyramidtut
+.. code-block:: text
-#. Install tutorial dependencies:
+ c:\> c:\Python27\Scripts\virtualenv %VENV%
- .. code-block:: text
+Python 3.3:
+
+.. code-block:: text
+
+ c:\> c:\Python33\Scripts\virtualenv %VENV%
+
+Install Pyramid and tutorial dependencies into the virtual Python environment
+-----------------------------------------------------------------------------
+
+On UNIX
+^^^^^^^
+
+.. code-block:: text
+
+ $ $VENV/bin/easy_install docutils pyramid_tm pyramid_zodbconn \
+ pyramid_debugtoolbar nose coverage
+
+On Windows
+^^^^^^^^^^
+
+.. code-block:: text
- c:\pyramidtut> %VENV%\Scripts\easy_install docutils pyramid_tm \
- pyramid_zodbconn pyramid_debugtoolbar nose coverage
+ c:\> %VENV%\Scripts\easy_install docutils pyramid_tm pyramid_zodbconn \
+ pyramid_debugtoolbar nose coverage
+
+Change Directory to Your Virtual Python Environment
+---------------------------------------------------
+
+Change directory to the ``pyramidtut`` directory.
+
+On UNIX
+^^^^^^^
+
+.. code-block:: text
+
+ $ cd pyramidtut
+
+On Windows
+^^^^^^^^^^
+
+.. code-block:: text
+
+ c:\> cd pyramidtut
.. _making_a_project:
-Make a Project
-==============
+Making a project
+================
+
+Your next step is to create a project. For this tutorial, we will use
+the :term:`scaffold` named ``zodb``, which generates an application
+that uses :term:`ZODB` and :term:`traversal`.
-Your next step is to create a project. For this tutorial, we will use the
-:term:`scaffold` named ``zodb``, which generates an application
-that uses :term:`ZODB` and :term:`traversal`. :app:`Pyramid`
-supplies a variety of scaffolds to generate sample projects.
+:app:`Pyramid` supplies a variety of scaffolds to generate sample
+projects. We will use `pcreate`—a script that comes with Pyramid to
+quickly and easily generate scaffolds, usually with a single command—to
+create the scaffold for our project.
-The below instructions assume your current working directory is the
-"virtualenv" named "pyramidtut".
+By passing `zodb` into the `pcreate` command, the script creates
+the files needed to use ZODB. By passing in our application name
+`tutorial`, the script inserts that application name into all the
+required files.
-On UNIX:
+The below instructions assume your current working directory is "pyramidtut".
+
+On UNIX
+-------
.. code-block:: text
- $ $VENV/bin/pcreate -s zodb tutorial
+ $ $VENV/bin/pcreate -s zodb tutorial
-On Windows:
+On Windows
+----------
.. code-block:: text
c:\pyramidtut> %VENV%\Scripts\pcreate -s zodb tutorial
-.. note:: You don't have to call it `tutorial` -- the code uses
- relative paths for imports and finding templates and static
- resources.
+.. note:: If you are using Windows, the ``zodb``
+ scaffold may not deal gracefully with installation into a
+ location that contains spaces in the path. If you experience
+ startup problems, try putting both the virtualenv and the project
+ into directories that do not contain spaces in their paths.
-.. note:: If you are using Windows, the ``zodb`` scaffold
- doesn't currently deal gracefully with installation into a location
- that contains spaces in the path. If you experience startup
- problems, try putting both the virtualenv and the project into
- directories that do not contain spaces in their paths.
+.. _installing_project_in_dev_mode_zodb:
-Install the Project in "Development Mode"
-=========================================
+Installing the project in development mode
+==========================================
In order to do development on the project easily, you must "register"
the project as a development egg in your workspace using the
-``setup.py develop`` command. In order to do so, cd to the "tutorial"
+``setup.py develop`` command. In order to do so, cd to the `tutorial`
directory you created in :ref:`making_a_project`, and run the
-"setup.py develop" command using virtualenv Python interpreter.
+``setup.py develop`` command using the virtualenv Python interpreter.
-On UNIX:
+On UNIX
+-------
.. code-block:: text
- $ cd tutorial
- $ $VENV/bin/python setup.py develop
+ $ cd tutorial
+ $ $VENV/bin/python setup.py develop
-On Windows:
+On Windows
+----------
.. code-block:: text
- C:\pyramidtut> cd tutorial
- C:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py develop
+ c:\pyramidtut> cd tutorial
+ c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py develop
+
+The console will show `setup.py` checking for packages and installing
+missing packages. Success executing this command will show a line like
+the following::
+
+ Finished processing dependencies for tutorial==0.0
.. _running_tests:
-Run the Tests
+Run the tests
=============
After you've installed the project in development mode, you may run
the tests for the project.
-On UNIX:
+On UNIX
+-------
.. code-block:: text
- $ $VENV/bin/python setup.py test -q
+ $ $VENV/bin/python setup.py test -q
-On Windows:
+On Windows
+----------
.. code-block:: text
- c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py test -q
+ c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py test -q
-Expose Test Coverage Information
+For a successful test run, you should see output that ends like this::
+
+ .
+ ----------------------------------------------------------------------
+ Ran 1 test in 0.094s
+
+ OK
+
+Expose test coverage information
================================
You can run the ``nosetests`` command to see test coverage
@@ -129,48 +222,73 @@ test`` does but provides additional "coverage" information, exposing
which lines of your project are "covered" (or not covered) by the
tests.
-On UNIX:
+On UNIX
+-------
.. code-block:: text
- $ $VENV/bin/nosetests --cover-package=tutorial --cover-erase --with-coverage
+ $ $VENV/bin/nosetests --cover-package=tutorial --cover-erase --with-coverage
-On Windows:
+On Windows
+----------
.. code-block:: text
- c:\pyramidtut\tutorial> %VENV%\Scripts\nosetests --cover-package=tutorial ^
- --cover-erase --with-coverage
+ c:\pyramidtut\tutorial> %VENV%\Scripts\nosetests --cover-package=tutorial \
+ --cover-erase --with-coverage
+
+If successful, you will see output something like this::
-Looks like the code in the ``zodb`` scaffold for ZODB projects is
-missing some test coverage, particularly in the file named
-``models.py``.
+ .
+ Name Stmts Miss Cover Missing
+ --------------------------------------------------
+ tutorial.py 12 7 42% 7-8, 14-18
+ tutorial/models.py 10 6 40% 9-14
+ tutorial/views.py 4 0 100%
+ --------------------------------------------------
+ TOTAL 26 13 50%
+ ----------------------------------------------------------------------
+ Ran 1 test in 0.392s
+
+ OK
+
+Looks like our package doesn't quite have 100% test coverage.
.. _wiki-start-the-application:
-Start the Application
+Start the application
=====================
Start the application.
-On UNIX:
+On UNIX
+-------
.. code-block:: text
- $ $VENV/bin/pserve development.ini --reload
+ $ $VENV/bin/pserve development.ini --reload
-On Windows:
+On Windows
+----------
.. code-block:: text
- c:\pyramidtut\tutorial> %VENV%\Scripts\pserve development.ini --reload
+ c:\pyramidtut\tutorial> %VENV%\Scripts\pserve development.ini --reload
.. note::
Your OS firewall, if any, may pop up a dialog asking for authorization
to allow python to accept incoming network connections.
-Visit the Application in a Browser
+If successful, you will see something like this on your console::
+
+ Starting subprocess with file monitor
+ Starting server in PID 95736.
+ serving on http://0.0.0.0:6543
+
+This means the server is ready to accept requests.
+
+Visit the application in a browser
==================================
In a browser, visit `http://localhost:6543/ <http://localhost:6543>`_. You
@@ -181,7 +299,7 @@ page. You can read more about the purpose of the icon at
:ref:`debug_toolbar`. It allows you to get information about your
application while you develop.
-Decisions the ``zodb`` Scaffold Has Made For You
+Decisions the ``zodb`` scaffold has made for you
================================================
Creating a project using the ``zodb`` scaffold makes the following
@@ -189,11 +307,11 @@ assumptions:
- you are willing to use :term:`ZODB` as persistent storage
-- you are willing to use :term:`traversal` to map URLs to code.
+- you are willing to use :term:`traversal` to map URLs to code
.. note::
:app:`Pyramid` supports any persistent storage mechanism (e.g., a SQL
- database or filesystem files). :app:`Pyramid` also supports an additional
+ database or filesystem files). It also supports an additional
mechanism to map URLs to code (:term:`URL dispatch`). However, for the
purposes of this tutorial, we'll only be using traversal and ZODB.
diff --git a/docs/tutorials/wiki/src/authorization/setup.py b/docs/tutorials/wiki/src/authorization/setup.py
index 5ab4f73cd..e2e96379d 100644
--- a/docs/tutorials/wiki/src/authorization/setup.py
+++ b/docs/tutorials/wiki/src/authorization/setup.py
@@ -11,10 +11,10 @@ with open(os.path.join(here, 'CHANGES.txt')) as f:
requires = [
'pyramid',
'pyramid_chameleon',
+ 'pyramid_debugtoolbar',
+ 'pyramid_tm',
'pyramid_zodbconn',
'transaction',
- 'pyramid_tm',
- 'pyramid_debugtoolbar',
'ZODB3',
'waitress',
'docutils',
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/favicon.ico b/docs/tutorials/wiki/src/authorization/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki/src/authorization/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/footerbg.png b/docs/tutorials/wiki/src/authorization/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki/src/authorization/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/headerbg.png b/docs/tutorials/wiki/src/authorization/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki/src/authorization/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/ie6.css b/docs/tutorials/wiki/src/authorization/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki/src/authorization/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/middlebg.png b/docs/tutorials/wiki/src/authorization/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki/src/authorization/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/pylons.css b/docs/tutorials/wiki/src/authorization/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki/src/authorization/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid-small.png b/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid.png b/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki/src/authorization/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/theme.css b/docs/tutorials/wiki/src/authorization/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki/src/authorization/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/theme.min.css b/docs/tutorials/wiki/src/authorization/tutorial/static/theme.min.css
new file mode 100644
index 000000000..2f924bcc5
--- /dev/null
+++ b/docs/tutorials/wiki/src/authorization/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a{color:#fff}.starter-template .links ul li a:hover{text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}} \ No newline at end of file
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/static/transparent.gif b/docs/tutorials/wiki/src/authorization/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki/src/authorization/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/templates/edit.pt b/docs/tutorials/wiki/src/authorization/tutorial/templates/edit.pt
index c3a0acf6b..823fa8972 100644
--- a/docs/tutorials/wiki/src/authorization/tutorial/templates/edit.pt
+++ b/docs/tutorials/wiki/src/authorization/tutorial/templates/edit.pt
@@ -1,58 +1,72 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.__name__} - Pyramid tutorial wiki (based on
- TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="/static/favicon.ico" />
- <link rel="stylesheet"
- href="/static/pylons.css"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="/static/ie6.css"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="/static/pyramid-small.png" />
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.__name__} - Pyramid tutorial wiki (based on
+ TurboGears 20-Minute Wiki)</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p tal:condition="logged_in" class="pull-right">
+ <a href="${request.application_url}/logout">Logout</a>
+ </p>
+ <p>
+ Editing <strong><span tal:replace="page.__name__">
+ Page Name Goes Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ <form action="${save_url}" method="post">
+ <div class="form-group">
+ <textarea class="form-control" name="body" tal:content="page.data" rows="10" cols="60"></textarea>
+ </div>
+ <div class="form-group">
+ <button type="submit" name="form.submitted" value="Save" class="btn btn-default">Save</button>
+ </div>
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Editing <b><span tal:replace="page.__name__">Page Name
- Goes Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right">
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- <div id="bottom">
- <div class="bottom">
- <form action="${save_url}" method="post">
- <textarea name="body" tal:content="page.data" rows="10"
- cols="60"/><br/>
- <input type="submit" name="form.submitted" value="Save"/>
- </form>
- </div>
- </div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/templates/login.pt b/docs/tutorials/wiki/src/authorization/tutorial/templates/login.pt
index 3612dccde..4a938e9bb 100644
--- a/docs/tutorials/wiki/src/authorization/tutorial/templates/login.pt
+++ b/docs/tutorials/wiki/src/authorization/tutorial/templates/login.pt
@@ -1,54 +1,74 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>Login - Pyramid tutorial wiki (based on TurboGears
- 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="/static/favicon.ico" />
- <link rel="stylesheet"
- href="/static/pylons.css"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="/static/ie6.css"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="/static/pyramid-small.png" />
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>Login - Pyramid tutorial wiki (based on
+ TurboGears 20-Minute Wiki)</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p>
+ <strong>
+ Login
+ </strong><br>
+ <span tal:replace="message"></span>
+ </p>
+ <form action="${url}" method="post">
+ <input type="hidden" name="came_from" value="${came_from}">
+ <div class="form-group">
+ <label for="login">Username</label>
+ <input type="text" name="login" value="${login}">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" name="password" value="${password}">
+ </div>
+ <div class="form-group">
+ <button type="submit" name="form.submitted" value="Log In" class="btn btn-default">Log In</button>
+ </div>
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- <b>Login</b><br/>
- <span tal:replace="message"/>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <div id="right" class="app-welcome align-right"></div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <form action="${url}" method="post">
- <input type="hidden" name="came_from" value="${came_from}"/>
- <input type="text" name="login" value="${login}"/><br/>
- <input type="password" name="password"
- value="${password}"/><br/>
- <input type="submit" name="form.submitted" value="Log In"/>
- </form>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt
index 13b41f823..1b30f42b6 100644
--- a/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt
@@ -1,73 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="/static/favicon.ico" />
- <link rel="stylesheet" href="/static/pylons.css" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="/static/ie6.css" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="/static/pyramid.png" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>ZODB Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">ZODB scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org/">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/templates/view.pt b/docs/tutorials/wiki/src/authorization/tutorial/templates/view.pt
index 90e20764d..fa35d758d 100644
--- a/docs/tutorials/wiki/src/authorization/tutorial/templates/view.pt
+++ b/docs/tutorials/wiki/src/authorization/tutorial/templates/view.pt
@@ -1,61 +1,72 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.__name__} - Pyramid tutorial wiki (based on
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.__name__} - Pyramid tutorial wiki (based on
TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="/static/favicon.ico" />
- <link rel="stylesheet"
- href="/static/pylons.css"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="/static/ie6.css"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="/static/pyramid-small.png" />
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p tal:condition="logged_in" class="pull-right">
+ <a href="${request.application_url}/logout">Logout</a>
+ </p>
+ <div tal:replace="structure content">
+ Page text goes here.
+ </div>
+ <p>
+ <a tal:attributes="href edit_url" href="">
+ Edit this page
+ </a>
+ </p>
+ <p>
+ Viewing <strong><span tal:replace="page.__name__">
+ Page Name Goes Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Viewing <b><span tal:replace="page.__name__">Page Name
- Goes Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right">
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
- </div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div tal:replace="structure content">
- Page text goes here.
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <p>
- <a tal:attributes="href edit_url" href="">
- Edit this page
- </a>
- </p>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/basiclayout/setup.py b/docs/tutorials/wiki/src/basiclayout/setup.py
index da79881ab..58a454f80 100644
--- a/docs/tutorials/wiki/src/basiclayout/setup.py
+++ b/docs/tutorials/wiki/src/basiclayout/setup.py
@@ -11,10 +11,10 @@ with open(os.path.join(here, 'CHANGES.txt')) as f:
requires = [
'pyramid',
'pyramid_chameleon',
+ 'pyramid_debugtoolbar',
+ 'pyramid_tm',
'pyramid_zodbconn',
'transaction',
- 'pyramid_tm',
- 'pyramid_debugtoolbar',
'ZODB3',
'waitress',
]
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/favicon.ico b/docs/tutorials/wiki/src/basiclayout/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/footerbg.png b/docs/tutorials/wiki/src/basiclayout/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/headerbg.png b/docs/tutorials/wiki/src/basiclayout/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/ie6.css b/docs/tutorials/wiki/src/basiclayout/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/middlebg.png b/docs/tutorials/wiki/src/basiclayout/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/pylons.css b/docs/tutorials/wiki/src/basiclayout/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid-small.png b/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid.png b/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki/src/basiclayout/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.css b/docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.min.css b/docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.min.css
new file mode 100644
index 000000000..2f924bcc5
--- /dev/null
+++ b/docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a{color:#fff}.starter-template .links ul li a:hover{text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}} \ No newline at end of file
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/static/transparent.gif b/docs/tutorials/wiki/src/basiclayout/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
index 13b41f823..1b30f42b6 100644
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
@@ -1,73 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="/static/favicon.ico" />
- <link rel="stylesheet" href="/static/pylons.css" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="/static/ie6.css" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="/static/pyramid.png" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>ZODB Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">ZODB scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org/">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/models/setup.py b/docs/tutorials/wiki/src/models/setup.py
index da79881ab..58a454f80 100644
--- a/docs/tutorials/wiki/src/models/setup.py
+++ b/docs/tutorials/wiki/src/models/setup.py
@@ -11,10 +11,10 @@ with open(os.path.join(here, 'CHANGES.txt')) as f:
requires = [
'pyramid',
'pyramid_chameleon',
+ 'pyramid_debugtoolbar',
+ 'pyramid_tm',
'pyramid_zodbconn',
'transaction',
- 'pyramid_tm',
- 'pyramid_debugtoolbar',
'ZODB3',
'waitress',
]
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/favicon.ico b/docs/tutorials/wiki/src/models/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki/src/models/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/footerbg.png b/docs/tutorials/wiki/src/models/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki/src/models/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/headerbg.png b/docs/tutorials/wiki/src/models/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki/src/models/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/ie6.css b/docs/tutorials/wiki/src/models/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki/src/models/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/middlebg.png b/docs/tutorials/wiki/src/models/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki/src/models/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/pylons.css b/docs/tutorials/wiki/src/models/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki/src/models/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki/src/models/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki/src/models/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/pyramid-small.png b/docs/tutorials/wiki/src/models/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki/src/models/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/pyramid.png b/docs/tutorials/wiki/src/models/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki/src/models/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki/src/models/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/theme.css b/docs/tutorials/wiki/src/models/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki/src/models/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/theme.min.css b/docs/tutorials/wiki/src/models/tutorial/static/theme.min.css
new file mode 100644
index 000000000..2f924bcc5
--- /dev/null
+++ b/docs/tutorials/wiki/src/models/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a{color:#fff}.starter-template .links ul li a:hover{text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}} \ No newline at end of file
diff --git a/docs/tutorials/wiki/src/models/tutorial/static/transparent.gif b/docs/tutorials/wiki/src/models/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki/src/models/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt
index 13b41f823..1b30f42b6 100644
--- a/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt
@@ -1,73 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="/static/favicon.ico" />
- <link rel="stylesheet" href="/static/pylons.css" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="/static/ie6.css" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="/static/pyramid.png" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>ZODB Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">ZODB scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org/">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/tests/setup.py b/docs/tutorials/wiki/src/tests/setup.py
index 2e7ed2398..b67b702cf 100644
--- a/docs/tutorials/wiki/src/tests/setup.py
+++ b/docs/tutorials/wiki/src/tests/setup.py
@@ -11,10 +11,10 @@ with open(os.path.join(here, 'CHANGES.txt')) as f:
requires = [
'pyramid',
'pyramid_chameleon',
+ 'pyramid_debugtoolbar',
+ 'pyramid_tm',
'pyramid_zodbconn',
'transaction',
- 'pyramid_tm',
- 'pyramid_debugtoolbar',
'ZODB3',
'waitress',
'docutils',
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/favicon.ico b/docs/tutorials/wiki/src/tests/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki/src/tests/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/footerbg.png b/docs/tutorials/wiki/src/tests/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki/src/tests/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/headerbg.png b/docs/tutorials/wiki/src/tests/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki/src/tests/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/ie6.css b/docs/tutorials/wiki/src/tests/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki/src/tests/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/middlebg.png b/docs/tutorials/wiki/src/tests/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki/src/tests/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/pylons.css b/docs/tutorials/wiki/src/tests/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki/src/tests/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki/src/tests/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki/src/tests/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/pyramid-small.png b/docs/tutorials/wiki/src/tests/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki/src/tests/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/pyramid.png b/docs/tutorials/wiki/src/tests/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki/src/tests/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki/src/tests/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/theme.css b/docs/tutorials/wiki/src/tests/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki/src/tests/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/theme.min.css b/docs/tutorials/wiki/src/tests/tutorial/static/theme.min.css
new file mode 100644
index 000000000..2f924bcc5
--- /dev/null
+++ b/docs/tutorials/wiki/src/tests/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a{color:#fff}.starter-template .links ul li a:hover{text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}} \ No newline at end of file
diff --git a/docs/tutorials/wiki/src/tests/tutorial/static/transparent.gif b/docs/tutorials/wiki/src/tests/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki/src/tests/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/tests/tutorial/templates/edit.pt b/docs/tutorials/wiki/src/tests/tutorial/templates/edit.pt
index c3a0acf6b..823fa8972 100644
--- a/docs/tutorials/wiki/src/tests/tutorial/templates/edit.pt
+++ b/docs/tutorials/wiki/src/tests/tutorial/templates/edit.pt
@@ -1,58 +1,72 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.__name__} - Pyramid tutorial wiki (based on
- TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="/static/favicon.ico" />
- <link rel="stylesheet"
- href="/static/pylons.css"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="/static/ie6.css"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="/static/pyramid-small.png" />
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.__name__} - Pyramid tutorial wiki (based on
+ TurboGears 20-Minute Wiki)</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p tal:condition="logged_in" class="pull-right">
+ <a href="${request.application_url}/logout">Logout</a>
+ </p>
+ <p>
+ Editing <strong><span tal:replace="page.__name__">
+ Page Name Goes Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ <form action="${save_url}" method="post">
+ <div class="form-group">
+ <textarea class="form-control" name="body" tal:content="page.data" rows="10" cols="60"></textarea>
+ </div>
+ <div class="form-group">
+ <button type="submit" name="form.submitted" value="Save" class="btn btn-default">Save</button>
+ </div>
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Editing <b><span tal:replace="page.__name__">Page Name
- Goes Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right">
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- <div id="bottom">
- <div class="bottom">
- <form action="${save_url}" method="post">
- <textarea name="body" tal:content="page.data" rows="10"
- cols="60"/><br/>
- <input type="submit" name="form.submitted" value="Save"/>
- </form>
- </div>
- </div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/tests/tutorial/templates/login.pt b/docs/tutorials/wiki/src/tests/tutorial/templates/login.pt
index 3612dccde..4a938e9bb 100644
--- a/docs/tutorials/wiki/src/tests/tutorial/templates/login.pt
+++ b/docs/tutorials/wiki/src/tests/tutorial/templates/login.pt
@@ -1,54 +1,74 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>Login - Pyramid tutorial wiki (based on TurboGears
- 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="/static/favicon.ico" />
- <link rel="stylesheet"
- href="/static/pylons.css"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="/static/ie6.css"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="/static/pyramid-small.png" />
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>Login - Pyramid tutorial wiki (based on
+ TurboGears 20-Minute Wiki)</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p>
+ <strong>
+ Login
+ </strong><br>
+ <span tal:replace="message"></span>
+ </p>
+ <form action="${url}" method="post">
+ <input type="hidden" name="came_from" value="${came_from}">
+ <div class="form-group">
+ <label for="login">Username</label>
+ <input type="text" name="login" value="${login}">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" name="password" value="${password}">
+ </div>
+ <div class="form-group">
+ <button type="submit" name="form.submitted" value="Log In" class="btn btn-default">Log In</button>
+ </div>
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- <b>Login</b><br/>
- <span tal:replace="message"/>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <div id="right" class="app-welcome align-right"></div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <form action="${url}" method="post">
- <input type="hidden" name="came_from" value="${came_from}"/>
- <input type="text" name="login" value="${login}"/><br/>
- <input type="password" name="password"
- value="${password}"/><br/>
- <input type="submit" name="form.submitted" value="Log In"/>
- </form>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt
index 13b41f823..1b30f42b6 100644
--- a/docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt
@@ -1,73 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="/static/favicon.ico" />
- <link rel="stylesheet" href="/static/pylons.css" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="/static/ie6.css" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="/static/pyramid.png" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>ZODB Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">ZODB scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org/">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/tests/tutorial/templates/view.pt b/docs/tutorials/wiki/src/tests/tutorial/templates/view.pt
index 90e20764d..fa35d758d 100644
--- a/docs/tutorials/wiki/src/tests/tutorial/templates/view.pt
+++ b/docs/tutorials/wiki/src/tests/tutorial/templates/view.pt
@@ -1,61 +1,72 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.__name__} - Pyramid tutorial wiki (based on
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.__name__} - Pyramid tutorial wiki (based on
TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="/static/favicon.ico" />
- <link rel="stylesheet"
- href="/static/pylons.css"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="/static/ie6.css"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="/static/pyramid-small.png" />
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p tal:condition="logged_in" class="pull-right">
+ <a href="${request.application_url}/logout">Logout</a>
+ </p>
+ <div tal:replace="structure content">
+ Page text goes here.
+ </div>
+ <p>
+ <a tal:attributes="href edit_url" href="">
+ Edit this page
+ </a>
+ </p>
+ <p>
+ Viewing <strong><span tal:replace="page.__name__">
+ Page Name Goes Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Viewing <b><span tal:replace="page.__name__">Page Name
- Goes Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right">
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
- </div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div tal:replace="structure content">
- Page text goes here.
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <p>
- <a tal:attributes="href edit_url" href="">
- Edit this page
- </a>
- </p>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/views/setup.py b/docs/tutorials/wiki/src/views/setup.py
index 5ab4f73cd..e2e96379d 100644
--- a/docs/tutorials/wiki/src/views/setup.py
+++ b/docs/tutorials/wiki/src/views/setup.py
@@ -11,10 +11,10 @@ with open(os.path.join(here, 'CHANGES.txt')) as f:
requires = [
'pyramid',
'pyramid_chameleon',
+ 'pyramid_debugtoolbar',
+ 'pyramid_tm',
'pyramid_zodbconn',
'transaction',
- 'pyramid_tm',
- 'pyramid_debugtoolbar',
'ZODB3',
'waitress',
'docutils',
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/favicon.ico b/docs/tutorials/wiki/src/views/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki/src/views/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/footerbg.png b/docs/tutorials/wiki/src/views/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki/src/views/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/headerbg.png b/docs/tutorials/wiki/src/views/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki/src/views/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/ie6.css b/docs/tutorials/wiki/src/views/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki/src/views/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/middlebg.png b/docs/tutorials/wiki/src/views/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki/src/views/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/pylons.css b/docs/tutorials/wiki/src/views/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki/src/views/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki/src/views/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki/src/views/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/pyramid-small.png b/docs/tutorials/wiki/src/views/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki/src/views/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/pyramid.png b/docs/tutorials/wiki/src/views/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki/src/views/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki/src/views/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/theme.css b/docs/tutorials/wiki/src/views/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki/src/views/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/theme.min.css b/docs/tutorials/wiki/src/views/tutorial/static/theme.min.css
new file mode 100644
index 000000000..2f924bcc5
--- /dev/null
+++ b/docs/tutorials/wiki/src/views/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a{color:#fff}.starter-template .links ul li a:hover{text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}} \ No newline at end of file
diff --git a/docs/tutorials/wiki/src/views/tutorial/static/transparent.gif b/docs/tutorials/wiki/src/views/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki/src/views/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki/src/views/tutorial/templates/edit.pt b/docs/tutorials/wiki/src/views/tutorial/templates/edit.pt
index 24ed2e592..b23f45d56 100644
--- a/docs/tutorials/wiki/src/views/tutorial/templates/edit.pt
+++ b/docs/tutorials/wiki/src/views/tutorial/templates/edit.pt
@@ -1,58 +1,69 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.__name__} - Pyramid tutorial wiki (based on
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.__name__} - Pyramid tutorial wiki (based on
TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="/static/favicon.ico" />
- <link rel="stylesheet"
- href="/static/pylons.css"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="/static/ie6.css"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="/static/pyramid-small.png" />
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p>
+ Editing <strong><span tal:replace="page.__name__">
+ Page Name Goes Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ <form action="${save_url}" method="post">
+ <div class="form-group">
+ <textarea class="form-control" name="body" tal:content="page.data" rows="10" cols="60"></textarea>
+ </div>
+ <div class="form-group">
+ <button type="submit" name="form.submitted" value="Save" class="btn btn-default">Save</button>
+ </div>
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Editing <b><span tal:replace="page.__name__">Page Name Goes
- Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <div id="right" class="app-welcome align-right"></div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <form action="${save_url}" method="post">
- <textarea name="body" tal:content="page.data" rows="10"
- cols="60"/><br/>
- <input type="submit" name="form.submitted" value="Save"/>
- </form>
</div>
</div>
- </div>
- <div id="footer">
- <div class="footer"
- >&copy; Copyright 2008-2011, Agendaless Consulting.</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt
index 50102aa20..1b30f42b6 100644
--- a/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt
@@ -1,76 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="/static/favicon.ico" />
- <link rel="stylesheet" href="/static/pylons.css" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="/static/ie6.css" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="/static/pyramid.png" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>ZODB Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">ZODB scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org/">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
- <div id="footer">
- <div class="footer">&copy; Copyright 2008-2012, Agendaless Consulting.</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/src/views/tutorial/templates/view.pt b/docs/tutorials/wiki/src/views/tutorial/templates/view.pt
index 424c4302a..93580658b 100644
--- a/docs/tutorials/wiki/src/views/tutorial/templates/view.pt
+++ b/docs/tutorials/wiki/src/views/tutorial/templates/view.pt
@@ -1,61 +1,69 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.__name__} - Pyramid tutorial wiki (based on
- TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="/static/favicon.ico" />
- <link rel="stylesheet"
- href="/static/pylons.css"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="/static/ie6.css"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="/static/pyramid-small.png" />
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.__name__} - Pyramid tutorial wiki (based on
+ TurboGears 20-Minute Wiki)</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <div tal:replace="structure content">
+ Page text goes here.
+ </div>
+ <p>
+ <a tal:attributes="href edit_url" href="">
+ Edit this page
+ </a>
+ </p>
+ <p>
+ Viewing <strong><span tal:replace="page.__name__">
+ Page Name Goes Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Viewing <b><span tal:replace="page.__name__">Page Name Goes
- Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right"></div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div tal:replace="structure content">
- Page text goes here.
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <p>
- <a tal:attributes="href edit_url" href="">
- Edit this page
- </a>
- </p>
</div>
</div>
- </div>
- <div id="footer">
- <div class="footer"
- >&copy; Copyright 2008-2011, Agendaless Consulting.</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst
index e724f3e18..e255812fc 100644
--- a/docs/tutorials/wiki/tests.rst
+++ b/docs/tutorials/wiki/tests.rst
@@ -2,38 +2,36 @@
Adding Tests
============
-We will now add tests for the models and the views and a few functional
-tests in the ``tests.py``. Tests ensure that an application works, and
-that it continues to work after some changes are made in the future.
+We will now add tests for the models and the views and a few functional tests
+in ``tests.py``. Tests ensure that an application works, and that it
+continues to work when changes are made in the future.
-
-Test the Models
+Test the models
===============
-We write tests for the model classes and the appmaker. Changing
-``tests.py``, we'll write a separate test class for each model class, and
+We write tests for the ``model`` classes and the ``appmaker``. Changing
+``tests.py``, we'll write a separate test class for each ``model`` class, and
we'll write a test class for the ``appmaker``.
To do so, we'll retain the ``tutorial.tests.ViewTests`` class that was
-generated as part of the ``zodb`` scaffold. We'll add three test
-classes: one for the ``Page`` model named ``PageModelTests``, one for the
-``Wiki`` model named ``WikiModelTests``, and one for the appmaker named
-``AppmakerTests``.
+generated as part of the ``zodb`` scaffold. We'll add three test classes: one
+for the ``Page`` model named ``PageModelTests``, one for the ``Wiki`` model
+named ``WikiModelTests``, and one for the appmaker named ``AppmakerTests``.
-Test the Views
+Test the views
==============
We'll modify our ``tests.py`` file, adding tests for each view function we
-added above. As a result, we'll *delete* the ``ViewTests`` test in the file,
-and add four other test classes: ``ViewWikiTests``, ``ViewPageTests``,
-``AddPageTests``, and ``EditPageTests``. These test the ``view_wiki``,
-``view_page``, ``add_page``, and ``edit_page`` views respectively.
-
+added previously. As a result, we'll *delete* the ``ViewTests`` class that
+the ``zodb`` scaffold provided, and add four other test classes:
+``ViewWikiTests``, ``ViewPageTests``, ``AddPageTests``, and ``EditPageTests``.
+These test the ``view_wiki``, ``view_page``, ``add_page``, and ``edit_page``
+views.
Functional tests
================
-We test the whole application, covering security aspects that are not
+We'll test the whole application, covering security aspects that are not
tested in the unit tests, like logging in, logging out, checking that
the ``viewer`` user cannot add or edit pages, but the ``editor`` user
can, and so on.
@@ -41,14 +39,14 @@ can, and so on.
View the results of all our edits to ``tests.py``
=================================================
-Once we're done with the ``tests.py`` module, it will look a lot like the
-below:
+Open the ``tutorial/tests.py`` module, and edit it such that it appears as
+follows:
.. literalinclude:: src/tests/tutorial/tests.py
:linenos:
:language: python
-Running the Tests
+Running the tests
=================
We can run these tests by using ``setup.py test`` in the same way we did in
@@ -62,7 +60,7 @@ Change the ``requires`` list in ``setup.py`` to include ``WebTest``.
:lines: 11-22
:emphasize-lines: 11
-After we've added a dependency on WebTest in ``setup.py``, we need to rerun
+After we've added a dependency on WebTest in ``setup.py``, we need to run
``setup.py develop`` to get WebTest installed into our virtualenv. Assuming
our shell's current working directory is the "tutorial" distribution
directory:
@@ -94,7 +92,7 @@ On Windows:
c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py test -q
-The expected result looks something like:
+The expected result should look like the following:
.. code-block:: text
diff --git a/docs/tutorials/wiki2/authorization.rst b/docs/tutorials/wiki2/authorization.rst
index 2e35574fd..1d810b05b 100644
--- a/docs/tutorials/wiki2/authorization.rst
+++ b/docs/tutorials/wiki2/authorization.rst
@@ -1,27 +1,25 @@
.. _wiki2_adding_authorization:
====================
-Adding Authorization
+Adding authorization
====================
:app:`Pyramid` provides facilities for :term:`authentication` and
:term:`authorization`. We'll make use of both features to provide security
to our application. Our application currently allows anyone with access to
-the server to view, edit, and add pages to our wiki. We'll change that
-to allow only people who are members of a *group* named ``group:editors``
-to add and edit wiki pages but we'll continue allowing
-anyone with access to the server to view pages.
+the server to view, edit, and add pages to our wiki. We'll change that to
+allow only people who are members of a *group* named ``group:editors`` to add
+and edit wiki pages but we'll continue allowing anyone with access to the
+server to view pages.
-We will also add a login page and a logout link on all the
-pages. The login page will be shown when a user is denied
-access to any of the views that require permission, instead of
-a default "403 Forbidden" page.
+We will also add a login page and a logout link on all the pages. The login
+page will be shown when a user is denied access to any of the views that
+require permission, instead of a default "403 Forbidden" page.
We will implement the access control with the following steps:
* Add users and groups (``security.py``, a new module).
-* Add an :term:`ACL` (``models.py`` and
- ``__init__.py``).
+* Add an :term:`ACL` (``models.py`` and ``__init__.py``).
* Add an :term:`authentication policy` and an :term:`authorization policy`
(``__init__.py``).
* Add :term:`permission` declarations to the ``edit_page`` and ``add_page``
@@ -32,12 +30,13 @@ Then we will add the login and logout feature:
* Add routes for /login and /logout (``__init__.py``).
* Add ``login`` and ``logout`` views (``views.py``).
* Add a login template (``login.pt``).
-* Make the existing views return a ``logged_in`` flag to the renderer (``views.py``).
+* Make the existing views return a ``logged_in`` flag to the renderer
+ (``views.py``).
* Add a "Logout" link to be shown when logged in and viewing or editing a page
(``view.pt``, ``edit.pt``).
-Access Control
+Access control
--------------
Add users and groups
@@ -53,21 +52,18 @@ following content:
The ``groupfinder`` function accepts a userid and a request and
returns one of these values:
-- If the userid exists in the system, it will return a
- sequence of group identifiers (or an empty sequence if the user
- isn't a member of any groups).
-- If the userid *does not* exist in the system, it will
- return ``None``.
+- If the userid exists in the system, it will return a sequence of group
+ identifiers (or an empty sequence if the user isn't a member of any groups).
+- If the userid *does not* exist in the system, it will return ``None``.
For example, ``groupfinder('editor', request )`` returns ``['group:editor']``,
-``groupfinder('viewer', request)`` returns [], and ``groupfinder('admin', request)``
-returns ``None``. We will use ``groupfinder()`` as an :term:`authentication policy`
-"callback" that will provide the :term:`principal` or principals
-for a user.
+``groupfinder('viewer', request)`` returns ``[]``, and ``groupfinder('admin',
+request)`` returns ``None``. We will use ``groupfinder()`` as an
+:term:`authentication policy` "callback" that will provide the
+:term:`principal` or principals for a user.
-In a production system, user and group
-data will most often come from a database, but here we use "dummy"
-data to represent user and groups sources.
+In a production system, user and group data will most often come from a
+database, but here we use "dummy" data to represent user and groups sources.
Add an ACL
~~~~~~~~~~
@@ -80,62 +76,60 @@ statement at the head:
:linenos:
:language: python
-Add the following class definition:
+Add the following class definition at the end:
.. literalinclude:: src/authorization/tutorial/models.py
:lines: 33-37
:linenos:
+ :lineno-start: 33
:language: python
-We import :data:`~pyramid.security.Allow`, an action that
-means that permission is allowed:, and
-:data:`~pyramid.security.Everyone`, a special :term:`principal`
-that is associated to all requests. Both are used in the
+We import :data:`~pyramid.security.Allow`, an action that means that
+permission is allowed, and :data:`~pyramid.security.Everyone`, a special
+:term:`principal` that is associated to all requests. Both are used in the
:term:`ACE` entries that make up the ACL.
-The ACL is a list that needs to be named `__acl__` and be an
-attribute of a class. We define an :term:`ACL` with two
-:term:`ACE` entries: the first entry allows any user the `view`
-permission. The second entry allows the ``group:editors``
-principal the `edit` permission.
+The ACL is a list that needs to be named `__acl__` and be an attribute of a
+class. We define an :term:`ACL` with two :term:`ACE` entries: the first entry
+allows any user the `view` permission. The second entry allows the
+``group:editors`` principal the `edit` permission.
-The ``RootFactory`` class that contains the ACL is a :term:`root factory`.
-We need to associate it to our :app:`Pyramid` application, so the ACL is
-provided to each view in the :term:`context` of the request, as
-the ``context`` attribute.
+The ``RootFactory`` class that contains the ACL is a :term:`root factory`. We
+need to associate it to our :app:`Pyramid` application, so the ACL is provided
+to each view in the :term:`context` of the request as the ``context``
+attribute.
-Open ``tutorial/tutorial/__init__.py`` and add a ``root_factory``
-parameter to our :term:`Configurator` constructor, that points to
-the class we created above:
+Open ``tutorial/tutorial/__init__.py`` and add a ``root_factory`` parameter to
+our :term:`Configurator` constructor, that points to the class we created
+above:
.. literalinclude:: src/authorization/tutorial/__init__.py
:lines: 24-25
:linenos:
:emphasize-lines: 2
+ :lineno-start: 16
:language: python
-(Only the highlighted line needs to be added.)
+Only the highlighted line needs to be added.
-We are now providing the ACL to the application. See
-:ref:`assigning_acls` for more information about what an
-:term:`ACL` represents.
+We are now providing the ACL to the application. See :ref:`assigning_acls`
+for more information about what an :term:`ACL` represents.
-.. note::
+.. note:: Although we don't use the functionality here, the ``factory`` used
+ to create route contexts may differ per-route as opposed to globally. See
+ the ``factory`` argument to :meth:`pyramid.config.Configurator.add_route`
+ for more info.
- Although we don't use the functionality here, the ``factory`` used
- to create route contexts may differ per-route as opposed to globally. See
- the ``factory`` argument to
- :meth:`pyramid.config.Configurator.add_route` for more info.
-
-Add Authentication and Authorization Policies
+Add authentication and authorization policies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Open ``tutorial/__init__.py`` and
-add these import statements:
+Open ``tutorial/tutorial/__init__.py`` and add the highlighted import
+statements:
.. literalinclude:: src/authorization/tutorial/__init__.py
- :lines: 2-3,7
+ :lines: 1-7
:linenos:
+ :emphasize-lines: 2-3,7
:language: python
Now add those policies to the configuration:
@@ -143,17 +137,18 @@ Now add those policies to the configuration:
.. literalinclude:: src/authorization/tutorial/__init__.py
:lines: 21-27
:linenos:
+ :lineno-start: 21
:emphasize-lines: 1-3,6-7
:language: python
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added.
-We are enabling an ``AuthTktAuthenticationPolicy``, which is based in an
-auth ticket that may be included in the request.
-We are also enabling an ``ACLAuthorizationPolicy``, which uses an ACL to
-determine the *allow* or *deny* outcome for a view.
+We are enabling an ``AuthTktAuthenticationPolicy``, which is based in an auth
+ticket that may be included in the request. We are also enabling an
+``ACLAuthorizationPolicy``, which uses an ACL to determine the *allow* or
+*deny* outcome for a view.
-Note that the :class:`~pyramid.authentication.AuthTktAuthenticationPolicy`
+Note that the :class:`pyramid.authentication.AuthTktAuthenticationPolicy`
constructor accepts two arguments: ``secret`` and ``callback``. ``secret`` is
a string representing an encryption key used by the "authentication ticket"
machinery represented by this policy: it is required. The ``callback`` is the
@@ -161,253 +156,251 @@ machinery represented by this policy: it is required. The ``callback`` is the
Add permission declarations
~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Open ``tutorial/tutorial/views.py`` and add a ``permission='edit'`` parameter
+to the ``@view_config`` decorators for ``add_page()`` and ``edit_page()``:
-Add a ``permission='edit'`` parameter to the ``@view_config``
-decorator for ``add_page()`` and ``edit_page()``, for example:
-
-.. code-block:: python
- :linenos:
- :emphasize-lines: 2
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 60-61
+ :emphasize-lines: 1-2
+ :language: python
- @view_config(route_name='add_page', renderer='templates/edit.pt',
- permission='edit')
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 75-76
+ :emphasize-lines: 1-2
+ :language: python
-(Only the highlighted line needs to be added.)
+Only the highlighted lines, along with their preceding commas, need to be
+edited and added.
-The result is that only users who possess the ``edit``
-permission at the time of the request may invoke those two views.
+The result is that only users who possess the ``edit`` permission at the time
+of the request may invoke those two views.
-Add a ``permission='view'`` parameter to the ``@view_config``
-decorator for ``view_wiki()`` and ``view_page()``, like this:
+Add a ``permission='view'`` parameter to the ``@view_config`` decorator for
+``view_wiki()`` and ``view_page()`` as follows:
-.. code-block:: python
- :linenos:
- :emphasize-lines: 2
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 30-31
+ :emphasize-lines: 1-2
+ :language: python
- @view_config(route_name='view_page', renderer='templates/view.pt',
- permission='view')
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 36-37
+ :emphasize-lines: 1-2
+ :language: python
-(Only the highlighted line needs to be added.)
+Only the highlighted lines, along with their preceding commas, need to be
+edited and added.
This allows anyone to invoke these two views.
-We are done with the changes needed to control access. The
-changes that follow will add the login and logout feature.
+We are done with the changes needed to control access. The changes that
+follow will add the login and logout feature.
-Login, Logout
+Login, logout
-------------
Add routes for /login and /logout
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Go back to ``tutorial/tutorial/__init__.py`` and add these two
-routes:
+Go back to ``tutorial/tutorial/__init__.py`` and add these two routes as
+highlighted:
.. literalinclude:: src/authorization/tutorial/__init__.py
- :lines: 31-32
- :linenos:
+ :lines: 30-33
+ :emphasize-lines: 2-3
:language: python
.. note:: The preceding lines must be added *before* the following
``view_page`` route definition:
.. literalinclude:: src/authorization/tutorial/__init__.py
- :lines: 32
- :linenos:
+ :lines: 33
:language: python
This is because ``view_page``'s route definition uses a catch-all
"replacement marker" ``/{pagename}`` (see :ref:`route_pattern_syntax`)
- which will catch any route that was not already caught by any
- route listed above it in ``__init__.py``. Hence, for ``login`` and
- ``logout`` views to have the opportunity of being matched
- (or "caught"), they must be above ``/{pagename}``.
+ which will catch any route that was not already caught by any route listed
+ above it in ``__init__.py``. Hence, for ``login`` and ``logout`` views to
+ have the opportunity of being matched (or "caught"), they must be above
+ ``/{pagename}``.
-Add Login and Logout Views
+Add login and logout views
~~~~~~~~~~~~~~~~~~~~~~~~~~
-We'll add a ``login`` view which renders a login form and processes
-the post from the login form, checking credentials.
+We'll add a ``login`` view which renders a login form and processes the post
+from the login form, checking credentials.
-We'll also add a ``logout`` view callable to our application and
-provide a link to it. This view will clear the credentials of the
-logged in user and redirect back to the front page.
+We'll also add a ``logout`` view callable to our application and provide a
+link to it. This view will clear the credentials of the logged in user and
+redirect back to the front page.
-Add the following import statements to the
-head of ``tutorial/tutorial/views.py``:
+Add the following import statements to the head of
+``tutorial/tutorial/views.py``:
.. literalinclude:: src/authorization/tutorial/views.py
:lines: 9-19
- :linenos:
- :emphasize-lines: 3,6-9,11
+ :emphasize-lines: 1-11
:language: python
-(Only the highlighted lines need to be added.)
+All the highlighted lines need to be added or edited.
-:meth:`~pyramid.view.forbidden_view_config` will be used
-to customize the default 403 Forbidden page.
-:meth:`~pyramid.security.remember` and
-:meth:`~pyramid.security.forget` help to create and
-expire an auth ticket cookie.
+:meth:`~pyramid.view.forbidden_view_config` will be used to customize the
+default 403 Forbidden page. :meth:`~pyramid.security.remember` and
+:meth:`~pyramid.security.forget` help to create and expire an auth ticket
+cookie.
-Now add the ``login`` and ``logout`` views:
+Now add the ``login`` and ``logout`` views at the end of the file:
.. literalinclude:: src/authorization/tutorial/views.py
:lines: 91-123
- :linenos:
:language: python
-``login()`` is decorated with two decorators:
+``login()`` has two decorators:
-- a ``@view_config`` decorator which associates it with the
- ``login`` route and makes it visible when we visit ``/login``,
-- a ``@forbidden_view_config`` decorator which turns it into
- an :term:`forbidden view`. ``login()`` will be invoked
- when a users tries to execute a view callable that
- they are not allowed to. For example, if a user has not logged in
- and tries to add or edit a Wiki page, he will be shown the
- login form before being allowed to continue on.
+- a ``@view_config`` decorator which associates it with the ``login`` route
+ and makes it visible when we visit ``/login``,
+- a ``@forbidden_view_config`` decorator which turns it into a
+ :term:`forbidden view`. ``login()`` will be invoked when a user tries to
+ execute a view callable for which they lack authorization. For example, if
+ a user has not logged in and tries to add or edit a Wiki page, they will be
+ shown the login form before being allowed to continue.
-The order of these two :term:`view configuration` decorators
-is unimportant.
+The order of these two :term:`view configuration` decorators is unimportant.
-``logout()`` is decorated with a ``@view_config`` decorator
-which associates it with the ``logout`` route. It will be
-invoked when we visit ``/logout``.
+``logout()`` is decorated with a ``@view_config`` decorator which associates
+it with the ``logout`` route. It will be invoked when we visit ``/logout``.
Add the ``login.pt`` Template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Create ``tutorial/tutorial/templates/login.pt`` with the following
-content:
+Create ``tutorial/tutorial/templates/login.pt`` with the following content:
.. literalinclude:: src/authorization/tutorial/templates/login.pt
- :language: xml
+ :language: html
-The above template is referred to within the login view we just
-added to ``views.py``.
+The above template is referenced in the login view that we just added in
+``views.py``.
-Return a logged_in flag to the renderer
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Return a ``logged_in`` flag to the renderer
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Add a ``logged_in`` parameter to the return value of
-``view_page()``, ``edit_page()`` and ``add_page()``,
-like this:
+Open ``tutorial/tutorial/views.py`` again. Add a ``logged_in`` parameter to
+the return value of ``view_page()``, ``edit_page()``, and ``add_page()`` as
+follows:
-.. code-block:: python
- :linenos:
- :emphasize-lines: 4
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 57-58
+ :emphasize-lines: 1-2
+ :language: python
- return dict(page = page,
- content = content,
- edit_url = edit_url,
- logged_in = request.authenticated_userid)
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 72-73
+ :emphasize-lines: 1-2
+ :language: python
+
+.. literalinclude:: src/authorization/tutorial/views.py
+ :lines: 85-89
+ :emphasize-lines: 3-4
+ :language: python
-(Only the highlighted line needs to be added.)
+Only the highlighted lines need to be added or edited.
-The :meth:`~pyramid.request.Request.authenticated_userid` property will be
-``None`` if the user is not authenticated.
+The :meth:`pyramid.request.Request.authenticated_userid` will be ``None`` if
+the user is not authenticated, or a userid if the user is authenticated.
Add a "Logout" link when logged in
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Open ``tutorial/tutorial/templates/edit.pt`` and
-``tutorial/tutorial/templates/view.pt`` and add this within the
-``<div id="right" class="app-welcome align-right">`` div:
-
-.. code-block:: xml
+``tutorial/tutorial/templates/view.pt`` and add the following code as
+indicated by the highlighted lines.
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
+.. literalinclude:: src/authorization/tutorial/templates/edit.pt
+ :lines: 34-38
+ :emphasize-lines: 3-5
+ :language: html
-The attribute ``tal:condition="logged_in"`` will make the element be
-included when ``logged_in`` is any user id. The link will invoke
-the logout view. The above element will not be included if ``logged_in``
-is ``None``, such as when a user is not authenticated.
+The attribute ``tal:condition="logged_in"`` will make the element be included
+when ``logged_in`` is any user id. The link will invoke the logout view. The
+above element will not be included if ``logged_in`` is ``None``, such as when
+a user is not authenticated.
-Seeing Our Changes
-------------------
+Reviewing our changes
+---------------------
-Our ``tutorial/tutorial/__init__.py`` will look something like this
-when we're done:
+Our ``tutorial/tutorial/__init__.py`` will look like this when we're done:
.. literalinclude:: src/authorization/tutorial/__init__.py
:linenos:
:emphasize-lines: 2-3,7,21-23,25-27,31-32
:language: python
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Our ``tutorial/tutorial/models.py`` will look something like this
-when we're done:
+Our ``tutorial/tutorial/models.py`` will look like this when we're done:
.. literalinclude:: src/authorization/tutorial/models.py
:linenos:
:emphasize-lines: 1-4,33-37
:language: python
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Our ``tutorial/tutorial/views.py`` will look something like this
-when we're done:
+Our ``tutorial/tutorial/views.py`` will look like this when we're done:
.. literalinclude:: src/authorization/tutorial/views.py
:linenos:
- :emphasize-lines: 11,14-19,25,31,37,58,61,73,76,88,91-117,119-123
+ :emphasize-lines: 9-11,14-19,25,31,37,58,61,73,76,88,91-117,119-123
:language: python
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Our ``tutorial/tutorial/templates/edit.pt`` template will look
-something like this when we're done:
+Our ``tutorial/tutorial/templates/edit.pt`` template will look like this when
+we're done:
.. literalinclude:: src/authorization/tutorial/templates/edit.pt
:linenos:
- :emphasize-lines: 41-43
- :language: xml
+ :emphasize-lines: 36-38
+ :language: html
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Our ``tutorial/tutorial/templates/view.pt`` template will look
-something like this when we're done:
+Our ``tutorial/tutorial/templates/view.pt`` template will look like this when
+we're done:
.. literalinclude:: src/authorization/tutorial/templates/view.pt
:linenos:
- :emphasize-lines: 41-43
- :language: xml
+ :emphasize-lines: 36-38
+ :language: html
-(Only the highlighted lines need to be added.)
+Only the highlighted lines need to be added or edited.
-Viewing the Application in a Browser
+Viewing the application in a browser
------------------------------------
We can finally examine our application in a browser (See
-:ref:`wiki2-start-the-application`). Launch a browser and visit
-each of the following URLs, check that the result is as expected:
-
-- http://localhost:6543/ invokes the
- ``view_wiki`` view. This always redirects to the ``view_page`` view
- of the FrontPage page object. It is executable by any user.
-
-- http://localhost:6543/FrontPage invokes
- the ``view_page`` view of the FrontPage page object.
-
-- http://localhost:6543/FrontPage/edit_page
- invokes the edit view for the FrontPage object. It is executable by
- only the ``editor`` user. If a different user (or the anonymous
- user) invokes it, a login form will be displayed. Supplying the
- credentials with the username ``editor``, password ``editor`` will
- display the edit page form.
-
-- http://localhost:6543/add_page/SomePageName
- invokes the add view for a page. It is executable by only
- the ``editor`` user. If a different user (or the anonymous user)
- invokes it, a login form will be displayed. Supplying the
- credentials with the username ``editor``, password ``editor`` will
- display the edit page form.
-
-- After logging in (as a result of hitting an edit or add page
- and submitting the login form with the ``editor``
- credentials), we'll see a Logout link in the upper right hand
- corner. When we click it, we're logged out, and redirected
- back to the front page.
+:ref:`wiki2-start-the-application`). Launch a browser and visit each of the
+following URLs, checking that the result is as expected:
+
+- http://localhost:6543/ invokes the ``view_wiki`` view. This always
+ redirects to the ``view_page`` view of the ``FrontPage`` page object. It
+ is executable by any user.
+
+- http://localhost:6543/FrontPage invokes the ``view_page`` view of the
+ ``FrontPage`` page object.
+
+- http://localhost:6543/FrontPage/edit_page invokes the edit view for the
+ FrontPage object. It is executable by only the ``editor`` user. If a
+ different user (or the anonymous user) invokes it, a login form will be
+ displayed. Supplying the credentials with the username ``editor``, password
+ ``editor`` will display the edit page form.
+
+- http://localhost:6543/add_page/SomePageName invokes the add view for a page.
+ It is executable by only the ``editor`` user. If a different user (or the
+ anonymous user) invokes it, a login form will be displayed. Supplying the
+ credentials with the username ``editor``, password ``editor`` will display
+ the edit page form.
+
+- After logging in (as a result of hitting an edit or add page and submitting
+ the login form with the ``editor`` credentials), we'll see a Logout link in
+ the upper right hand corner. When we click it, we're logged out, and
+ redirected back to the front page.
diff --git a/docs/tutorials/wiki2/background.rst b/docs/tutorials/wiki2/background.rst
index 1f9582903..b8afb8305 100644
--- a/docs/tutorials/wiki2/background.rst
+++ b/docs/tutorials/wiki2/background.rst
@@ -2,10 +2,12 @@
Background
==========
-This tutorial presents a :app:`Pyramid` application that uses technologies
-which will be familiar to someone with SQL database experience. It uses
+This version of the :app:`Pyramid` wiki tutorial presents a
+:app:`Pyramid` application that uses technologies which will be
+familiar to someone with SQL database experience. It uses
:term:`SQLAlchemy` as a persistence mechanism and :term:`url dispatch` to map
-URLs to code.
+URLs to code. It can also be followed by people without any prior
+Python web framework experience.
To code along with this tutorial, the developer will need a UNIX
machine with development tools (Mac OS X with XCode, any Linux or BSD
diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst
index 05781c044..695d7f15b 100644
--- a/docs/tutorials/wiki2/basiclayout.rst
+++ b/docs/tutorials/wiki2/basiclayout.rst
@@ -4,16 +4,17 @@ Basic Layout
The starter files generated by the ``alchemy`` scaffold are very basic, but
they provide a good orientation for the high-level patterns common to most
-:term:`url dispatch` -based :app:`Pyramid` projects.
+:term:`URL dispatch`-based :app:`Pyramid` projects.
-Application Configuration with ``__init__.py``
+Application configuration with ``__init__.py``
----------------------------------------------
A directory on disk can be turned into a Python :term:`package` by containing
an ``__init__.py`` file. Even if empty, this marks a directory as a Python
-package. We use ``__init__.py`` both as a marker indicating the directory
-it's contained within is a package, and to contain configuration code.
+package. We use ``__init__.py`` both as a marker, indicating the directory
+in which it's contained is a package, and to contain application configuration
+code.
Open ``tutorial/tutorial/__init__.py``. It should already contain
the following:
@@ -114,7 +115,7 @@ used when the URL is ``/``:
:lines: 19
:language: py
-Since this route has a ``pattern`` equalling ``/`` it is the route that will
+Since this route has a ``pattern`` equaling ``/`` it is the route that will
be matched when the URL ``/`` is visited, e.g. ``http://localhost:6543/``.
``main`` next calls the ``scan`` method of the configurator
@@ -136,7 +137,7 @@ Finally, ``main`` is finished configuring things, so it uses the
:lines: 21
:language: py
-View Declarations via ``views.py``
+View declarations via ``views.py``
----------------------------------
The main function of a web framework is mapping each URL pattern to code (a
@@ -167,7 +168,7 @@ Note that ``my_view()`` accepts a single argument named ``request``. This is
the standard call signature for a Pyramid :term:`view callable`.
Remember in our ``__init__.py`` when we executed the
-:meth:`pyramid.config.Configurator.scan` method, i.e. ``config.scan()``? The
+:meth:`pyramid.config.Configurator.scan` method ``config.scan()``? The
purpose of calling the scan method was to find and process this
``@view_config`` decorator in order to create a view configuration within our
application. Without being processed by ``scan``, the decorator effectively
@@ -175,7 +176,7 @@ does nothing. ``@view_config`` is inert without being detected via a
:term:`scan`.
The sample ``my_view()`` created by the scaffold uses a ``try:`` and ``except:``
-clause, to detect if there is a problem accessing the project database and
+clause to detect if there is a problem accessing the project database and
provide an alternate error response. That response will include the text
shown at the end of the file, which will be displayed in the browser to
inform the user about possible actions to take to solve the problem.
@@ -203,7 +204,7 @@ Let's examine this in detail. First, we need some imports to support later code:
Next we set up a SQLAlchemy ``DBSession`` object:
.. literalinclude:: src/basiclayout/tutorial/models.py
- :lines: 16
+ :lines: 17
:language: py
``scoped_session`` and ``sessionmaker`` are standard SQLAlchemy helpers.
@@ -219,7 +220,7 @@ We also need to create a declarative ``Base`` object to use as a
base class for our model:
.. literalinclude:: src/basiclayout/tutorial/models.py
- :lines: 17
+ :lines: 18
:language: py
Our model classes will inherit from this ``Base`` class so they can be
@@ -246,5 +247,8 @@ The ``MyModel`` class has a ``__tablename__`` attribute. This informs
SQLAlchemy which table to use to store the data representing instances of this
class.
+The Index import and the Index object creation is not required for this
+tutorial, and will be removed in the next step.
+
That's about all there is to it regarding models, views, and initialization
code in our stock application.
diff --git a/docs/tutorials/wiki2/definingmodels.rst b/docs/tutorials/wiki2/definingmodels.rst
index e30af12b2..b2d9bf83a 100644
--- a/docs/tutorials/wiki2/definingmodels.rst
+++ b/docs/tutorials/wiki2/definingmodels.rst
@@ -7,26 +7,27 @@ be to define a :term:`domain model` constructor representing a wiki page.
We'll do this inside our ``models.py`` file.
-Making Edits to ``models.py``
------------------------------
+Edit ``models.py``
+------------------
.. note::
There is nothing special about the filename ``models.py``. A
- project may have many models throughout its codebase in arbitrarily-named
+ project may have many models throughout its codebase in arbitrarily named
files. Files implementing models often have ``model`` in their filenames
- (or they may live in a Python subpackage of your application package named
- ``models``) , but this is only by convention.
+ or they may live in a Python subpackage of your application package named
+ ``models``, but this is only by convention.
-Open ``tutorial/tutorial/models.py`` file and edit it to look like the
+Open ``tutorial/tutorial/models.py`` file and edit it to look like the
following:
.. literalinclude:: src/models/tutorial/models.py
:linenos:
:language: py
- :emphasize-lines: 20-22,25
+ :emphasize-lines: 20-22,24,25
-(The highlighted lines are the ones that need to be changed.)
+The highlighted lines are the ones that need to be changed, as well as
+removing lines that reference ``Index``.
The first thing we've done is remove the stock ``MyModel`` class
from the generated ``models.py`` file. The ``MyModel`` class is only a
@@ -44,74 +45,74 @@ this class inherits from an instance of
As you can see, our ``Page`` class has a class level attribute
``__tablename__`` which equals the string ``'pages'``. This means that
SQLAlchemy will store our wiki data in a SQL table named ``pages``. Our
-``Page`` class will also have class-level attributes named ``id``, ``name`` and
-``data`` (all instances of :class:`sqlalchemy.schema.Column`).
-These will map to columns in the ``pages`` table.
-The ``id`` attribute will be the primary key in the table.
-The ``name`` attribute will be a text attribute, each value of
-which needs to be unique within the column. The ``data`` attribute is a text
-attribute that will hold the body of each page.
+``Page`` class will also have class-level attributes named ``id``, ``name``
+and ``data`` (all instances of :class:`sqlalchemy.schema.Column`). These will
+map to columns in the ``pages`` table. The ``id`` attribute will be the
+primary key in the table. The ``name`` attribute will be a text attribute,
+each value of which needs to be unique within the column. The ``data``
+attribute is a text attribute that will hold the body of each page.
Changing ``scripts/initializedb.py``
------------------------------------
We haven't looked at the details of this file yet, but within the ``scripts``
-directory of your ``tutorial`` package is a file named ``initializedb.py``. Code
-in this file is executed whenever we run the ``initialize_tutorial_db`` command
-(as we did in the installation step of this tutorial).
+directory of your ``tutorial`` package is a file named ``initializedb.py``.
+Code in this file is executed whenever we run the ``initialize_tutorial_db``
+command, as we did in the installation step of this tutorial.
-Since we've changed our model, we need to make changes to our ``initializedb.py``
-script. In particular, we'll replace our import of ``MyModel`` with one of
-``Page`` and we'll change the very end of the script to create a ``Page``
-rather than a ``MyModel`` and add it to our ``DBSession``.
+Since we've changed our model, we need to make changes to our
+``initializedb.py`` script. In particular, we'll replace our import of
+``MyModel`` with one of ``Page`` and we'll change the very end of the script
+to create a ``Page`` rather than a ``MyModel`` and add it to our
+``DBSession``.
-Open ``tutorial/tutorial/scripts/initializedb.py`` and edit it to look like the
-following:
+Open ``tutorial/tutorial/scripts/initializedb.py`` and edit it to look like
+the following:
.. literalinclude:: src/models/tutorial/scripts/initializedb.py
:linenos:
:language: python
- :emphasize-lines: 14,36
+ :emphasize-lines: 14,31,36
-(Only the highlighted lines need to be changed.)
+Only the highlighted lines need to be changed, as well as removing the lines
+referencing ``pyramid.scripts.common`` and ``options`` under the ``main``
+function.
-Installing the Project and re-initializing the Database
+Installing the project and re-initializing the database
-------------------------------------------------------
Because our model has changed, in order to reinitialize the database, we need
-to rerun the ``initialize_tutorial_db`` command to pick up the changes you've made
-to both the models.py file and to the initializedb.py file.
-See :ref:`initialize_db_wiki2` for instructions.
+to rerun the ``initialize_tutorial_db`` command to pick up the changes you've
+made to both the models.py file and to the initializedb.py file. See
+:ref:`initialize_db_wiki2` for instructions.
Success will look something like this::
- 2011-11-27 01:22:45,277 INFO [sqlalchemy.engine.base.Engine][MainThread]
- PRAGMA table_info("pages")
- 2011-11-27 01:22:45,277 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
- 2011-11-27 01:22:45,277 INFO [sqlalchemy.engine.base.Engine][MainThread]
- CREATE TABLE pages (
- id INTEGER NOT NULL,
- name TEXT,
- data TEXT,
- PRIMARY KEY (id),
- UNIQUE (name)
- )
-
-
- 2011-11-27 01:22:45,278 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
- 2011-11-27 01:22:45,397 INFO [sqlalchemy.engine.base.Engine][MainThread]
- COMMIT
- 2011-11-27 01:22:45,400 INFO [sqlalchemy.engine.base.Engine][MainThread]
- BEGIN (implicit)
- 2011-11-27 01:22:45,401 INFO [sqlalchemy.engine.base.Engine][MainThread]
- INSERT INTO pages (name, data) VALUES (?, ?)
- 2011-11-27 01:22:45,401 INFO [sqlalchemy.engine.base.Engine][MainThread]
- ('FrontPage', 'This is the front page')
- 2011-11-27 01:22:45,402 INFO [sqlalchemy.engine.base.Engine][MainThread]
- COMMIT
-
-Viewing the Application in a Browser
-------------------------------------
+ 2015-05-24 15:34:14,542 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1
+ 2015-05-24 15:34:14,542 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] ()
+ 2015-05-24 15:34:14,543 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
+ 2015-05-24 15:34:14,543 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] ()
+ 2015-05-24 15:34:14,543 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] PRAGMA table_info("pages")
+ 2015-05-24 15:34:14,544 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ()
+ 2015-05-24 15:34:14,544 INFO [sqlalchemy.engine.base.Engine:1097][MainThread]
+ CREATE TABLE pages (
+ id INTEGER NOT NULL,
+ name TEXT,
+ data TEXT,
+ PRIMARY KEY (id),
+ UNIQUE (name)
+ )
+
+
+ 2015-05-24 15:34:14,545 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ()
+ 2015-05-24 15:34:14,546 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT
+ 2015-05-24 15:34:14,548 INFO [sqlalchemy.engine.base.Engine:646][MainThread] BEGIN (implicit)
+ 2015-05-24 15:34:14,549 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO pages (name, data) VALUES (?, ?)
+ 2015-05-24 15:34:14,549 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('FrontPage', 'This is the front page')
+ 2015-05-24 15:34:14,550 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT
+
+View the application in a browser
+---------------------------------
We can't. At this point, our system is in a "non-runnable" state; we'll need
to change view-related files in the next chapter to be able to start the
diff --git a/docs/tutorials/wiki2/definingviews.rst b/docs/tutorials/wiki2/definingviews.rst
index 49dbed50f..0b495445a 100644
--- a/docs/tutorials/wiki2/definingviews.rst
+++ b/docs/tutorials/wiki2/definingviews.rst
@@ -11,8 +11,8 @@ The request object has a dictionary as an attribute named ``matchdict``. A
substrings of the path in the :term:`request` URL. For instance, if a call to
:meth:`pyramid.config.Configurator.add_route` has the pattern ``/{one}/{two}``,
and a user visits ``http://example.com/foo/bar``, our pattern would be matched
-against ``/foo/bar`` and the ``matchdict`` would look like: ``{'one':'foo',
-'two':'bar'}``
+against ``/foo/bar`` and the ``matchdict`` would look like ``{'one':'foo',
+'two':'bar'}``.
Declaring Dependencies in Our ``setup.py`` File
===============================================
@@ -23,26 +23,27 @@ application was generated by the ``pcreate`` command; it doesn't know
about our custom application requirements.
We need to add a dependency on the ``docutils`` package to our ``tutorial``
-package's ``setup.py`` file by assigning this dependency to the ``requires`` parameter in ``setup()``.
+package's ``setup.py`` file by assigning this dependency to the ``requires``
+parameter in the ``setup()`` function.
Open ``tutorial/setup.py`` and edit it to look like the following:
.. literalinclude:: src/views/setup.py
:linenos:
- :language: python
:emphasize-lines: 20
+ :language: python
-(Only the highlighted line needs to be added.)
+Only the highlighted line needs to be added.
Running ``setup.py develop``
============================
-Since a new software dependency was added, you will need to rerun ``python
-setup.py develop`` inside the root of the ``tutorial`` package to obtain and
-register the newly added dependency distribution.
+Since a new software dependency was added, you will need to run ``python
+setup.py develop`` again inside the root of the ``tutorial`` package to obtain
+and register the newly added dependency distribution.
Make sure your current working directory is the root of the project (the
-directory in which setup.py lives) and execute the following command.
+directory in which ``setup.py`` lives) and execute the following command.
On UNIX:
@@ -63,21 +64,24 @@ like::
Finished processing dependencies for tutorial==0.0
-Changing the ``views.py`` File
-==============================
+Adding view functions in ``views.py``
+=====================================
-It's time for a major change. Open ``tutorial/tutorial/views.py`` and edit it to look like the following:
+It's time for a major change. Open ``tutorial/tutorial/views.py`` and edit it
+to look like the following:
.. literalinclude:: src/views/tutorial/views.py
:linenos:
:language: python
- :emphasize-lines: 1-7,12,15-70
+ :emphasize-lines: 1-7,14,16-72
-(The highlighted lines are the ones that need to be added or edited.)
+The highlighted lines need to be added or edited.
-We got rid of the ``my_view`` view function and its decorator that was
-added when we originally rendered the ``alchemy`` scaffold. It was only an
-example and isn't relevant to our application.
+We added some imports and created a regular expression to find "WikiWords".
+
+We got rid of the ``my_view`` view function and its decorator that was added
+when we originally rendered the ``alchemy`` scaffold. It was only an example
+and isn't relevant to our application.
Then we added four :term:`view callable` functions to our ``views.py``
module:
@@ -87,13 +91,12 @@ module:
* ``add_page()`` - Allows the user to add a page.
* ``edit_page()`` - Allows the user to edit a page.
-We'll describe each one briefly and show the resulting ``views.py`` file
-afterward.
+We'll describe each one briefly in the following sections.
.. note::
There is nothing special about the filename ``views.py``. A project may
- have many view callables throughout its codebase in arbitrarily-named
+ have many view callables throughout its codebase in arbitrarily named
files. Files implementing view callables often have ``view`` in their
filenames (or may live in a Python subpackage of your application package
named ``views``), but this is only by convention.
@@ -101,39 +104,44 @@ afterward.
The ``view_wiki`` view function
-------------------------------
-``view_wiki()`` is the :term:`default view` that gets called when a request
-is made to the root URL of our wiki. It always redirects to
-a URL which represents the path to our "FrontPage".
+Following is the code for the ``view_wiki`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
- :lines: 18-21
+ :lines: 20-24
+ :lineno-start: 20
:linenos:
:language: python
-``view_wiki()`` returns an instance of the
-:class:`pyramid.httpexceptions.HTTPFound` class (instances of which implement
-the :class:`pyramid.interfaces.IResponse` interface like
-:class:`pyramid.response.Response` does).
+``view_wiki()`` is the :term:`default view` that gets called when a request is
+made to the root URL of our wiki. It always redirects to an URL which
+represents the path to our "FrontPage".
-It uses the :meth:`pyramid.request.Request.route_url` API to construct a
-URL to the ``FrontPage`` page (e.g. ``http://localhost:6543/FrontPage``), which
-is used as the "location" of the ``HTTPFound`` response, forming an HTTP redirect.
+The ``view_wiki`` view callable always redirects to the URL of a Page resource
+named "FrontPage". To do so, it returns an instance of the
+:class:`pyramid.httpexceptions.HTTPFound` class (instances of which implement
+the :class:`pyramid.interfaces.IResponse` interface, like
+:class:`pyramid.response.Response` does). It uses the
+:meth:`pyramid.request.Request.route_url` API to construct an URL to the
+``FrontPage`` page (i.e., ``http://localhost:6543/FrontPage``), and uses it as
+the "location" of the ``HTTPFound`` response, forming an HTTP redirect.
The ``view_page`` view function
-------------------------------
-``view_page()`` is used to display a single page of our
-wiki. It renders the :term:`reStructuredText` body of a page (stored as
-the ``data`` attribute of a ``Page`` model object) as HTML. Then it substitutes an
-HTML anchor for each *WikiWord* reference in the rendered HTML using a
-compiled regular expression.
+Here is the code for the ``view_page`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
- :lines: 23-43
+ :lines: 25-45
+ :lineno-start: 25
:linenos:
:language: python
-The ``check()`` function is used as the first argument to
+``view_page()`` is used to display a single page of our wiki. It renders the
+:term:`reStructuredText` body of a page (stored as the ``data`` attribute of a
+``Page`` model object) as HTML. Then it substitutes an HTML anchor for each
+*WikiWord* reference in the rendered HTML using a compiled regular expression.
+
+The curried function named ``check`` is used as the first argument to
``wikiwords.sub``, indicating that it should be called to provide a value for
each WikiWord match found in the content. If the wiki already contains a
page with the matched WikiWord name, ``check()`` generates a view
@@ -156,6 +164,14 @@ renderer used will be the ``templates/view.pt`` template, as indicated in the
The ``add_page`` view function
------------------------------
+Here is the code for the ``add_page`` view function and its decorator:
+
+.. literalinclude:: src/views/tutorial/views.py
+ :lines: 47-58
+ :lineno-start: 47
+ :linenos:
+ :language: python
+
``add_page()`` is invoked when a user clicks on a *WikiWord* which
isn't yet represented as a page in the system. The ``check`` function
within the ``view_page`` view generates URLs to this view.
@@ -164,26 +180,21 @@ when we want to add a page object. The ``matchdict`` attribute of the
request passed to the ``add_page()`` view will have the values we need
to construct URLs and find model objects.
-.. literalinclude:: src/views/tutorial/views.py
- :lines: 45-56
- :linenos:
- :language: python
-
The ``matchdict`` will have a ``'pagename'`` key that matches the name of
the page we'd like to add. If our add view is invoked via,
-e.g. ``http://localhost:6543/add_page/SomeName``, the value for
+e.g., ``http://localhost:6543/add_page/SomeName``, the value for
``'pagename'`` in the ``matchdict`` will be ``'SomeName'``.
-If the view execution *is* a result of a form submission (i.e. the expression
-``'form.submitted' in request.params`` is ``True``), we scrape the page body
+If the view execution *is* a result of a form submission (i.e., the expression
+``'form.submitted' in request.params`` is ``True``), we grab the page body
from the form data, create a Page object with this page body and the name
taken from ``matchdict['pagename']``, and save it into the database using
``DBSession.add``. We then redirect back to the ``view_page`` view for the
newly created page.
-If the view execution is *not* a result of a form submission (i.e. the
+If the view execution is *not* a result of a form submission (i.e., the
expression ``'form.submitted' in request.params`` is ``False``), the view
-callable renders a template. To do so, it generates a "save url" which the
+callable renders a template. To do so, it generates a ``save_url`` which the
template uses as the form post URL during rendering. We're lazy here, so
we're going to use the same template (``templates/edit.pt``) for the add
view as well as the page edit view. To do so we create a dummy Page object
@@ -194,38 +205,41 @@ with this view to a response.
The ``edit_page`` view function
-------------------------------
+Here is the code for the ``edit_page`` view function and its decorator:
+
+.. literalinclude:: src/views/tutorial/views.py
+ :lines: 60-72
+ :lineno-start: 60
+ :linenos:
+ :language: python
+
``edit_page()`` is invoked when a user clicks the "Edit this
Page" button on the view form. It renders an edit form but it also acts as
the handler for the form it renders. The ``matchdict`` attribute of the
request passed to the ``edit_page`` view will have a ``'pagename'`` key
matching the name of the page the user wants to edit.
-.. literalinclude:: src/views/tutorial/views.py
- :lines: 58-70
- :linenos:
- :language: python
-
-If the view execution *is* a result of a form submission (i.e. the expression
+If the view execution *is* a result of a form submission (i.e., the expression
``'form.submitted' in request.params`` is ``True``), the view grabs the
``body`` element of the request parameters and sets it as the ``data``
attribute of the page object. It then redirects to the ``view_page`` view
of the wiki page.
-If the view execution is *not* a result of a form submission (i.e. the
+If the view execution is *not* a result of a form submission (i.e., the
expression ``'form.submitted' in request.params`` is ``False``), the view
simply renders the edit form, passing the page object and a ``save_url``
which will be used as the action of the generated form.
-Adding Templates
+Adding templates
================
The ``view_page``, ``add_page`` and ``edit_page`` views that we've added
-reference a :term:`template`. Each template is a :term:`Chameleon` :term:`ZPT`
-template. These templates will live in the ``templates`` directory of our
-tutorial package. Chameleon templates must have a ``.pt`` extension to be
-recognized as such.
+reference a :term:`template`. Each template is a :term:`Chameleon`
+:term:`ZPT` template. These templates will live in the ``templates``
+directory of our tutorial package. Chameleon templates must have a ``.pt``
+extension to be recognized as such.
-The ``view.pt`` Template
+The ``view.pt`` template
------------------------
Create ``tutorial/tutorial/templates/view.pt`` and add the following
@@ -233,20 +247,18 @@ content:
.. literalinclude:: src/views/tutorial/templates/view.pt
:linenos:
- :language: xml
+ :language: html
This template is used by ``view_page()`` for displaying a single
wiki page. It includes:
-- A ``div`` element that is replaced with the ``content``
- value provided by the view (rows 45-47). ``content``
- contains HTML, so the ``structure`` keyword is used
- to prevent escaping it (i.e. changing ">" to "&gt;", etc.)
-- A link that points
- at the "edit" URL which invokes the ``edit_page`` view for
- the page being viewed (rows 49-51).
+- A ``div`` element that is replaced with the ``content`` value provided by
+ the view (lines 36-38). ``content`` contains HTML, so the ``structure``
+ keyword is used to prevent escaping it (i.e., changing ">" to "&gt;", etc.)
+- A link that points at the "edit" URL which invokes the ``edit_page`` view
+ for the page being viewed (lines 40-42).
-The ``edit.pt`` Template
+The ``edit.pt`` template
------------------------
Create ``tutorial/tutorial/templates/edit.pt`` and add the following
@@ -254,44 +266,38 @@ content:
.. literalinclude:: src/views/tutorial/templates/edit.pt
:linenos:
- :language: xml
+ :language: html
-This template is used by ``add_page()`` and ``edit_page()`` for adding
-and editing a wiki page. It displays
-a page containing a form that includes:
+This template is used by ``add_page()`` and ``edit_page()`` for adding and
+editing a wiki page. It displays a page containing a form that includes:
- A 10 row by 60 column ``textarea`` field named ``body`` that is filled
- with any existing page data when it is rendered (rows 46-47).
-- A submit button that has the name ``form.submitted`` (row 48).
+ with any existing page data when it is rendered (line 45).
+- A submit button that has the name ``form.submitted`` (line 48).
-The form POSTs back to the "save_url" argument supplied
-by the view (row 45). The view will use the ``body`` and
-``form.submitted`` values.
+The form POSTs back to the ``save_url`` argument supplied by the view (line
+43). The view will use the ``body`` and ``form.submitted`` values.
-.. note:: Our templates use a ``request`` object that
- none of our tutorial views return in their dictionary.
- ``request`` is one of several
- names that are available "by default" in a template when a template
- renderer is used. See :ref:`renderer_system_values` for
- information about other names that are available by default
- when a template is used as a renderer.
+.. note:: Our templates use a ``request`` object that none of our tutorial
+ views return in their dictionary. ``request`` is one of several names that
+ are available "by default" in a template when a template renderer is used.
+ See :ref:`renderer_system_values` for information about other names that
+ are available by default when a template is used as a renderer.
Static Assets
-------------
-Our templates name a single static asset named ``pylons.css``. We don't need
-to create this file within our package's ``static`` directory because it was
-provided at the time we created the project. This file is a little too long
-to replicate within the body of this guide, however it is available `online
-<https://github.com/Pylons/pyramid/blob/master/docs/tutorials/wiki2/src/views/tutorial/static/pylons.css>`_.
+Our templates name static assets, including CSS and images. We don't need
+to create these files within our package's ``static`` directory because they
+were provided at the time we created the project.
-This CSS file will be accessed via
-e.g. ``http://localhost:6543/static/pylons.css`` by virtue of the call to
+As an example, the CSS file will be accessed via
+``http://localhost:6543/static/theme.css`` by virtue of the call to the
``add_static_view`` directive we've made in the ``__init__.py`` file. Any
number and type of static assets can be placed in this directory (or
subdirectories) and are just referred to by URL or by using the convenience
-method ``static_url``
-e.g. ``request.static_url('{{package}}:static/foo.css')`` within templates.
+method ``static_url``, e.g.,
+``request.static_url('<package>:static/foo.css')`` within templates.
Adding Routes to ``__init__.py``
================================
@@ -334,33 +340,30 @@ something like:
.. literalinclude:: src/views/tutorial/__init__.py
:linenos:
- :language: python
:emphasize-lines: 19-22
+ :language: python
-(The highlighted lines are the ones that need to be added or edited.)
+The highlighted lines are the ones that need to be added or edited.
-Viewing the Application in a Browser
+Viewing the application in a browser
====================================
We can finally examine our application in a browser (See
:ref:`wiki2-start-the-application`). Launch a browser and visit
-each of the following URLs, check that the result is as expected:
+each of the following URLs, checking that the result is as expected:
-- http://localhost:6543 in a browser invokes the
- ``view_wiki`` view. This always redirects to the ``view_page`` view
- of the FrontPage page object.
+- http://localhost:6543/ invokes the ``view_wiki`` view. This always
+ redirects to the ``view_page`` view of the ``FrontPage`` page object.
-- http://localhost:6543/FrontPage in a browser invokes
- the ``view_page`` view of the front page object.
+- http://localhost:6543/FrontPage invokes the ``view_page`` view of the front
+ page object.
-- http://localhost:6543/FrontPage/edit_page in a browser
- invokes the edit view for the front page object.
+- http://localhost:6543/FrontPage/edit_page invokes the edit view for the
+ front page object.
-- http://localhost:6543/add_page/SomePageName in a
- browser invokes the add view for a page.
+- http://localhost:6543/add_page/SomePageName invokes the add view for a page.
- To generate an error, visit http://localhost:6543/foobars/edit_page which
- will generate a ``NoResultFound: No row was found for one()`` error.
- You'll see an interactive traceback facility provided
- by :term:`pyramid_debugtoolbar`.
-
+ will generate a ``NoResultFound: No row was found for one()`` error. You'll
+ see an interactive traceback facility provided by
+ :term:`pyramid_debugtoolbar`.
diff --git a/docs/tutorials/wiki2/design.rst b/docs/tutorials/wiki2/design.rst
index df2c83398..52f2ce7a5 100644
--- a/docs/tutorials/wiki2/design.rst
+++ b/docs/tutorials/wiki2/design.rst
@@ -1,6 +1,6 @@
-==========
+======
Design
-==========
+======
Following is a quick overview of the design of our wiki application, to help
us understand the changes that we will be making as we work through the
@@ -9,7 +9,7 @@ tutorial.
Overall
-------
-We choose to use :term:`reStructuredText` markup in the wiki text. Translation
+We choose to use :term:`reStructuredText` markup in the wiki text. Translation
from reStructuredText to HTML is provided by the widely used ``docutils``
Python module. We will add this module in the dependency list on the project
``setup.py`` file.
@@ -37,8 +37,8 @@ Views
-----
There will be three views to handle the normal operations of adding,
-editing and viewing wiki pages, plus one view for the wiki front page.
-Two templates will be used, one for viewing, and one for both for adding
+editing, and viewing wiki pages, plus one view for the wiki front page.
+Two templates will be used, one for viewing, and one for both adding
and editing wiki pages.
The default templating systems in :app:`Pyramid` are
@@ -53,12 +53,14 @@ Security
We'll eventually be adding security to our application. The components we'll
use to do this are below.
-- USERS, a dictionary mapping users names to their corresponding passwords.
+- USERS, a dictionary mapping :term:`userids <userid>` to their
+ corresponding passwords.
-- GROUPS, a dictionary mapping user names to a list of groups they belong to.
+- GROUPS, a dictionary mapping :term:`userids <userid>` to a
+ list of groups to which they belong.
- ``groupfinder``, an *authorization callback* that looks up USERS and
- GROUPS. It will be provided in a new *security.py* file.
+ GROUPS. It will be provided in a new ``security.py`` file.
- An :term:`ACL` is attached to the root :term:`resource`. Each row below
details an :term:`ACE`:
@@ -100,7 +102,7 @@ listed in the following table:
| | with existing | | | |
| | content. | | | |
| | | | | |
-| | If the form is | | | |
+| | If the form was | | | |
| | submitted, redirect | | | |
| | to /PageName | | | |
+----------------------+-----------------------+-------------+------------+------------+
@@ -110,7 +112,7 @@ listed in the following table:
| | the edit form | | | |
| | without content. | | | |
| | | | | |
-| | If the form is | | | |
+| | If the form was | | | |
| | submitted, | | | |
| | redirect to | | | |
| | /PageName | | | |
@@ -118,12 +120,12 @@ listed in the following table:
| /login | Display login form, | login | login.pt | |
| | Forbidden [3]_ | | | |
| | | | | |
-| | If the form is | | | |
+| | If the form was | | | |
| | submitted, | | | |
| | authenticate. | | | |
| | | | | |
| | - If authentication | | | |
-| | successful, | | | |
+| | succeeds, | | | |
| | redirect to the | | | |
| | page that we | | | |
| | came from. | | | |
@@ -143,6 +145,6 @@ listed in the following table:
when there is no view name.
.. [2] Pyramid will return a default 404 Not Found page
if the page *PageName* does not exist yet.
-.. [3] pyramid.exceptions.Forbidden is reached when a
+.. [3] ``pyramid.exceptions.Forbidden`` is reached when a
user tries to invoke a view that is
not authorized by the authorization policy.
diff --git a/docs/tutorials/wiki2/distributing.rst b/docs/tutorials/wiki2/distributing.rst
index 3b048a141..fee50a1cf 100644
--- a/docs/tutorials/wiki2/distributing.rst
+++ b/docs/tutorials/wiki2/distributing.rst
@@ -2,11 +2,11 @@
Distributing Your Application
=============================
-Once your application works properly, you can create a "tarball" from
-it by using the ``setup.py sdist`` command. The following commands
-assume your current working directory is the ``tutorial`` package
-we've created and that the parent directory of the ``tutorial``
-package is a virtualenv representing a :app:`Pyramid` environment.
+Once your application works properly, you can create a "tarball" from it by
+using the ``setup.py sdist`` command. The following commands assume your
+current working directory is the ``tutorial`` package we've created and that
+the parent directory of the ``tutorial`` package is a virtualenv representing
+a :app:`Pyramid` environment.
On UNIX:
@@ -25,18 +25,16 @@ The output of such a command will be something like:
.. code-block:: text
running sdist
- # ... more output ...
+ # .. more output ..
creating dist
tar -cf dist/tutorial-0.0.tar tutorial-0.0
gzip -f9 dist/tutorial-0.0.tar
removing 'tutorial-0.0' (and everything under it)
-Note that this command creates a tarball in the "dist" subdirectory
-named ``tutorial-0.0.tar.gz``. You can send this file to your friends
-to show them your cool new application. They should be able to
-install it by pointing the ``easy_install`` command directly at it.
-Or you can upload it to `PyPI <http://pypi.python.org>`_ and share it
-with the rest of the world, where it can be downloaded via
-``easy_install`` remotely like any other package people download from
-PyPI.
-
+Note that this command creates a tarball in the "dist" subdirectory named
+``tutorial-0.0.tar.gz``. You can send this file to your friends to show them
+your cool new application. They should be able to install it by pointing the
+``easy_install`` command directly at it. Or you can upload it to `PyPI
+<http://pypi.python.org>`_ and share it with the rest of the world, where it
+can be downloaded via ``easy_install`` remotely like any other package people
+download from PyPI.
diff --git a/docs/tutorials/wiki2/index.rst b/docs/tutorials/wiki2/index.rst
index 0a614cb23..0a3873dcd 100644
--- a/docs/tutorials/wiki2/index.rst
+++ b/docs/tutorials/wiki2/index.rst
@@ -3,7 +3,7 @@
SQLAlchemy + URL Dispatch Wiki Tutorial
=======================================
-This tutorial introduces a :term:`SQLAlchemy` and :term:`url dispatch` -based
+This tutorial introduces a :term:`SQLAlchemy` and :term:`url dispatch`-based
:app:`Pyramid` application to a developer familiar with Python. When the
tutorial is finished, the developer will have created a basic Wiki
application with authentication.
@@ -26,4 +26,3 @@ which corresponds to the same location if you have Pyramid sources.
tests
distributing
-
diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst
index e21bf7108..595dbd940 100644
--- a/docs/tutorials/wiki2/installation.rst
+++ b/docs/tutorials/wiki2/installation.rst
@@ -2,22 +2,41 @@
Installation
============
-Before You Begin
+Before you begin
================
This tutorial assumes that you have already followed the steps in
-:ref:`installing_chapter`, thereby satisfying the following
-requirements.
+:ref:`installing_chapter`, except **do not create a virtualenv or install
+Pyramid**. Thereby you will satisfy the following requirements.
* Python interpreter is installed on your operating system
* :term:`setuptools` or :term:`distribute` is installed
* :term:`virtualenv` is installed
-Create and Use a Virtual Python Environment
+Create directory to contain the project
+---------------------------------------
+
+We need a workspace for our project files.
+
+On UNIX
+^^^^^^^
+
+.. code-block:: text
+
+ $ mkdir ~/pyramidtut
+
+On Windows
+^^^^^^^^^^
+
+.. code-block:: text
+
+ c:\> mkdir pyramidtut
+
+Create and use a virtual Python environment
-------------------------------------------
Next let's create a `virtualenv` workspace for our project. We will
-use the `VENV` environment variable instead of absolute path of the
+use the `VENV` environment variable instead of the absolute path of the
virtual environment.
On UNIX
@@ -33,8 +52,6 @@ On UNIX
On Windows
^^^^^^^^^^
-Set the `VENV` environment variable.
-
.. code-block:: text
c:\> set VENV=c:\pyramidtut
@@ -48,13 +65,13 @@ Python 2.7:
c:\> c:\Python27\Scripts\virtualenv %VENV%
-Python 3.2:
+Python 3.3:
.. code-block:: text
- c:\> c:\Python32\Scripts\virtualenv %VENV%
+ c:\> c:\Python33\Scripts\virtualenv %VENV%
-Install Pyramid Into the Virtual Python Environment
+Install Pyramid into the virtual Python environment
---------------------------------------------------
On UNIX
@@ -69,9 +86,9 @@ On Windows
.. code-block:: text
- c:\env> %VENV%\Scripts\easy_install pyramid
+ c:\> %VENV%\Scripts\easy_install pyramid
-Install SQLite3 and Its Development Packages
+Install SQLite3 and its development packages
--------------------------------------------
If you used a package manager to install your Python or if you compiled
@@ -87,7 +104,7 @@ the Debian system and apt-get, the command would be the following:
$ sudo apt-get install libsqlite3-dev
-Change Directory to Your Virtual Python Environment
+Change directory to your virtual Python environment
---------------------------------------------------
Change directory to the ``pyramidtut`` directory.
@@ -108,7 +125,7 @@ On Windows
.. _sql_making_a_project:
-Making a Project
+Making a project
================
Your next step is to create a project. For this tutorial we will use
@@ -117,17 +134,16 @@ that uses :term:`SQLAlchemy` and :term:`URL dispatch`.
:app:`Pyramid` supplies a variety of scaffolds to generate sample
projects. We will use `pcreate`—a script that comes with Pyramid to
-quickly and easily generate scaffolds usually with a single command—to
+quickly and easily generate scaffolds, usually with a single command—to
create the scaffold for our project.
-By passing in `alchemy` into the `pcreate` command, the script creates
+By passing `alchemy` into the `pcreate` command, the script creates
the files needed to use SQLAlchemy. By passing in our application name
`tutorial`, the script inserts that application name into all the
required files. For example, `pcreate` creates the
``initialize_tutorial_db`` in the ``pyramidtut/bin`` directory.
-The below instructions assume your current working directory is the
-"virtualenv" named "pyramidtut".
+The below instructions assume your current working directory is "pyramidtut".
On UNIX
-------
@@ -141,7 +157,7 @@ On Windows
.. code-block:: text
- c:\pyramidtut> %VENV%\pcreate -s alchemy tutorial
+ c:\pyramidtut> %VENV%\Scripts\pcreate -s alchemy tutorial
.. note:: If you are using Windows, the ``alchemy``
scaffold may not deal gracefully with installation into a
@@ -151,7 +167,7 @@ On Windows
.. _installing_project_in_dev_mode:
-Installing the Project in Development Mode
+Installing the project in development mode
==========================================
In order to do development on the project easily, you must "register"
@@ -184,8 +200,8 @@ the following::
.. _sql_running_tests:
-Running the Tests
-=================
+Run the tests
+=============
After you've installed the project in development mode, you may run
the tests for the project.
@@ -212,8 +228,8 @@ For a successful test run, you should see output that ends like this::
OK
-Exposing Test Coverage Information
-==================================
+Expose test coverage information
+================================
You can run the ``nosetests`` command to see test coverage
information. This runs the tests in the same way that ``setup.py
@@ -258,33 +274,31 @@ On Windows
If successful, you will see output something like this::
- .
- Name Stmts Miss Cover Missing
- ------------------------------------------------
- tutorial 11 7 36% 9-15
- tutorial.models 17 0 100%
- tutorial.scripts 0 0 100%
- tutorial.tests 24 0 100%
- tutorial.views 6 0 100%
- ------------------------------------------------
- TOTAL 58 7 88%
- ----------------------------------------------------------------------
- Ran 1 test in 0.459s
+ .
+ Name Stmts Miss Cover Missing
+ ---------------------------------------------------
+ tutorial.py 13 9 31% 13-21
+ tutorial/models.py 12 0 100%
+ tutorial/scripts.py 0 0 100%
+ tutorial/views.py 11 0 100%
+ ---------------------------------------------------
+ TOTAL 36 9 75%
+ ----------------------------------------------------------------------
+ Ran 2 tests in 0.643s
- OK
+ OK
Looks like our package doesn't quite have 100% test coverage.
-
.. _initialize_db_wiki2:
-Initializing the Database
+Initializing the database
=========================
We need to use the ``initialize_tutorial_db`` :term:`console
script` to initialize our database.
-Type the following command, make sure you are still in the ``tutorial``
+Type the following command, making sure you are still in the ``tutorial``
directory (the directory with a ``development.ini`` in it):
On UNIX
@@ -303,28 +317,30 @@ On Windows
The output to your console should be something like this::
- 2011-11-26 14:42:25,012 INFO [sqlalchemy.engine.base.Engine][MainThread]
- PRAGMA table_info("models")
- 2011-11-26 14:42:25,013 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
- 2011-11-26 14:42:25,013 INFO [sqlalchemy.engine.base.Engine][MainThread]
- CREATE TABLE models (
- id INTEGER NOT NULL,
- name VARCHAR(255),
- value INTEGER,
- PRIMARY KEY (id),
- UNIQUE (name)
- )
- 2011-11-26 14:42:25,013 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
- 2011-11-26 14:42:25,135 INFO [sqlalchemy.engine.base.Engine][MainThread]
- COMMIT
- 2011-11-26 14:42:25,137 INFO [sqlalchemy.engine.base.Engine][MainThread]
- BEGIN (implicit)
- 2011-11-26 14:42:25,138 INFO [sqlalchemy.engine.base.Engine][MainThread]
- INSERT INTO models (name, value) VALUES (?, ?)
- 2011-11-26 14:42:25,139 INFO [sqlalchemy.engine.base.Engine][MainThread]
- (u'one', 1)
- 2011-11-26 14:42:25,140 INFO [sqlalchemy.engine.base.Engine][MainThread]
- COMMIT
+ 2015-05-23 16:49:49,609 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1
+ 2015-05-23 16:49:49,609 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] ()
+ 2015-05-23 16:49:49,610 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
+ 2015-05-23 16:49:49,610 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] ()
+ 2015-05-23 16:49:49,610 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] PRAGMA table_info("models")
+ 2015-05-23 16:49:49,610 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ()
+ 2015-05-23 16:49:49,612 INFO [sqlalchemy.engine.base.Engine:1097][MainThread]
+ CREATE TABLE models (
+ id INTEGER NOT NULL,
+ name TEXT,
+ value INTEGER,
+ PRIMARY KEY (id)
+ )
+
+
+ 2015-05-23 16:49:49,612 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ()
+ 2015-05-23 16:49:49,613 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT
+ 2015-05-23 16:49:49,613 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] CREATE UNIQUE INDEX my_index ON models (name)
+ 2015-05-23 16:49:49,613 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ()
+ 2015-05-23 16:49:49,614 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT
+ 2015-05-23 16:49:49,616 INFO [sqlalchemy.engine.base.Engine:646][MainThread] BEGIN (implicit)
+ 2015-05-23 16:49:49,617 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO models (name, value) VALUES (?, ?)
+ 2015-05-23 16:49:49,617 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('one', 1)
+ 2015-05-23 16:49:49,618 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT
Success! You should now have a ``tutorial.sqlite`` file in your current working
directory. This will be a SQLite database with a single table defined in it
@@ -332,8 +348,8 @@ directory. This will be a SQLite database with a single table defined in it
.. _wiki2-start-the-application:
-Starting the Application
-========================
+Start the application
+=====================
Start the application.
@@ -351,6 +367,11 @@ On Windows
c:\pyramidtut\tutorial> %VENV%\Scripts\pserve development.ini --reload
+.. note::
+
+ Your OS firewall, if any, may pop up a dialog asking for authorization
+ to allow python to accept incoming network connections.
+
If successful, you will see something like this on your console::
Starting subprocess with file monitor
@@ -359,31 +380,34 @@ If successful, you will see something like this on your console::
This means the server is ready to accept requests.
-At this point, when you visit ``http://localhost:6543/`` in your web browser,
-you will see the generated application's default page.
+Visit the application in a browser
+==================================
+
+In a browser, visit `http://localhost:6543/ <http://localhost:6543>`_. You
+will see the generated application's default page.
One thing you'll notice is the "debug toolbar" icon on right hand side of the
page. You can read more about the purpose of the icon at
:ref:`debug_toolbar`. It allows you to get information about your
application while you develop.
-Decisions the ``alchemy`` Scaffold Has Made For You
-=================================================================
+Decisions the ``alchemy`` scaffold has made for you
+===================================================
-Creating a project using the ``alchemy`` scaffold makes
-the following assumptions:
+Creating a project using the ``alchemy`` scaffold makes the following
+assumptions:
- you are willing to use :term:`SQLAlchemy` as a database access tool
-- you are willing to use :term:`url dispatch` to map URLs to code.
+- you are willing to use :term:`URL dispatch` to map URLs to code
- you want to use ``ZopeTransactionExtension`` and ``pyramid_tm`` to scope
sessions to requests
.. note::
- :app:`Pyramid` supports any persistent storage mechanism (e.g. object
- database or filesystem files, etc). It also supports an additional
+ :app:`Pyramid` supports any persistent storage mechanism (e.g., object
+ database or filesystem files). It also supports an additional
mechanism to map URLs to code (:term:`traversal`). However, for the
- purposes of this tutorial, we'll only be using url dispatch and
+ purposes of this tutorial, we'll only be using URL dispatch and
SQLAlchemy.
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/favicon.ico b/docs/tutorials/wiki2/src/authorization/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki2/src/authorization/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/footerbg.png b/docs/tutorials/wiki2/src/authorization/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki2/src/authorization/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/headerbg.png b/docs/tutorials/wiki2/src/authorization/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki2/src/authorization/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/ie6.css b/docs/tutorials/wiki2/src/authorization/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki2/src/authorization/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/middlebg.png b/docs/tutorials/wiki2/src/authorization/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki2/src/authorization/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/pylons.css b/docs/tutorials/wiki2/src/authorization/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki2/src/authorization/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid-small.png b/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid.png b/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/theme.css b/docs/tutorials/wiki2/src/authorization/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/theme.min.css b/docs/tutorials/wiki2/src/authorization/tutorial/static/theme.min.css
new file mode 100644
index 000000000..2f924bcc5
--- /dev/null
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a{color:#fff}.starter-template .links ul li a:hover{text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}} \ No newline at end of file
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/static/transparent.gif b/docs/tutorials/wiki2/src/authorization/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki2/src/authorization/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/templates/edit.pt b/docs/tutorials/wiki2/src/authorization/tutorial/templates/edit.pt
index ca28b9fa5..ed355434d 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/templates/edit.pt
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/templates/edit.pt
@@ -1,62 +1,72 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.name} - Pyramid tutorial wiki (based on
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.name} - Pyramid tutorial wiki (based on
TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/pylons.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/ie6.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="${request.static_url('tutorial:static/pyramid-small.png')}" />
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p tal:condition="logged_in" class="pull-right">
+ <a href="${request.application_url}/logout">Logout</a>
+ </p>
+ <p>
+ Editing <strong><span tal:replace="page.name">Page Name Goes
+ Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ <form action="${save_url}" method="post">
+ <div class="form-group">
+ <textarea class="form-control" name="body" tal:content="page.data" rows="10" cols="60"></textarea>
+ </div>
+ <div class="form-group">
+ <button type="submit" name="form.submitted" value="Save" class="btn btn-default">Save</button>
+ </div>
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Editing <b><span tal:replace="page.name">Page Name
- Goes Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right">
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- <div id="bottom">
- <div class="bottom">
- <form action="${save_url}" method="post">
- <textarea name="body" tal:content="page.data" rows="10"
- cols="60"/><br/>
- <input type="submit" name="form.submitted" value="Save"/>
- </form>
- </div>
- </div>
- </div>
- <div id="footer">
- <div class="footer"
- >&copy; Copyright 2008-2011, Agendaless Consulting.</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/templates/login.pt b/docs/tutorials/wiki2/src/authorization/tutorial/templates/login.pt
index 64e592ea9..4a938e9bb 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/templates/login.pt
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/templates/login.pt
@@ -1,58 +1,74 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>Login - Pyramid tutorial wiki (based on TurboGears
- 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/pylons.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/ie6.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="${request.static_url('tutorial:static/pyramid-small.png')}" />
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>Login - Pyramid tutorial wiki (based on
+ TurboGears 20-Minute Wiki)</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p>
+ <strong>
+ Login
+ </strong><br>
+ <span tal:replace="message"></span>
+ </p>
+ <form action="${url}" method="post">
+ <input type="hidden" name="came_from" value="${came_from}">
+ <div class="form-group">
+ <label for="login">Username</label>
+ <input type="text" name="login" value="${login}">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" name="password" value="${password}">
+ </div>
+ <div class="form-group">
+ <button type="submit" name="form.submitted" value="Log In" class="btn btn-default">Log In</button>
+ </div>
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- <b>Login</b><br/>
- <span tal:replace="message"/>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <div id="right" class="app-welcome align-right"></div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <form action="${url}" method="post">
- <input type="hidden" name="came_from" value="${came_from}"/>
- <input type="text" name="login" value="${login}"/><br/>
- <input type="password" name="password"
- value="${password}"/><br/>
- <input type="submit" name="form.submitted" value="Log In"/>
- </form>
</div>
</div>
- </div>
- <div id="footer">
- <div class="footer"
- >&copy; Copyright 2008-2011, Agendaless Consulting.</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt
index cf3da2073..c9b0cec21 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt
@@ -1,76 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="${request.static_url('tutorial:static/pyramid.png')}" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>Alchemy Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Alchemy scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
- <div id="footer">
- <div class="footer">&copy; Copyright 2008-2011, Agendaless Consulting.</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/templates/view.pt b/docs/tutorials/wiki2/src/authorization/tutorial/templates/view.pt
index 5a69818c1..02cb8e73b 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/templates/view.pt
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/templates/view.pt
@@ -1,65 +1,72 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.name} - Pyramid tutorial wiki (based on
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.name} - Pyramid tutorial wiki (based on
TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/pylons.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/ie6.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="${request.static_url('tutorial:static/pyramid-small.png')}" />
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p tal:condition="logged_in" class="pull-right">
+ <a href="${request.application_url}/logout">Logout</a>
+ </p>
+ <div tal:replace="structure content">
+ Page text goes here.
+ </div>
+ <p>
+ <a tal:attributes="href edit_url" href="">
+ Edit this page
+ </a>
+ </p>
+ <p>
+ Viewing <strong><span tal:replace="page.name">
+ Page Name Goes Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Viewing <b><span tal:replace="page.name">Page Name
- Goes Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right">
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
- </div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div tal:replace="structure content">
- Page text goes here.
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <p>
- <a tal:attributes="href edit_url" href="">
- Edit this page
- </a>
- </p>
</div>
</div>
- </div>
- <div id="footer">
- <div class="footer"
- >&copy; Copyright 2008-2011, Agendaless Consulting.</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py b/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py
index 0cdd4bbc3..11ddccadb 100644
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py
@@ -2,6 +2,7 @@ from sqlalchemy import (
Column,
Integer,
Text,
+ Index,
)
from sqlalchemy.ext.declarative import declarative_base
@@ -22,3 +23,5 @@ class MyModel(Base):
id = Column(Integer, primary_key=True)
name = Column(Text, unique=True)
value = Column(Integer)
+
+Index('my_index', MyModel.name, unique=True, mysql_length=255)
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/favicon.ico b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/footerbg.png b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/headerbg.png b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/ie6.css b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/middlebg.png b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pylons.css b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid-small.png b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid.png b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/theme.css b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/theme.min.css b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/theme.min.css
new file mode 100644
index 000000000..2f924bcc5
--- /dev/null
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a{color:#fff}.starter-template .links ul li a:hover{text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}} \ No newline at end of file
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/transparent.gif b/docs/tutorials/wiki2/src/basiclayout/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt
index ca4e0af26..c9b0cec21 100644
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt
@@ -1,73 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="${request.static_url('tutorial:static/pyramid.png')}" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>Alchemy Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Alchemy scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/favicon.ico b/docs/tutorials/wiki2/src/models/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki2/src/models/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/footerbg.png b/docs/tutorials/wiki2/src/models/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki2/src/models/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/headerbg.png b/docs/tutorials/wiki2/src/models/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki2/src/models/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/ie6.css b/docs/tutorials/wiki2/src/models/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki2/src/models/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/middlebg.png b/docs/tutorials/wiki2/src/models/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki2/src/models/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/pylons.css b/docs/tutorials/wiki2/src/models/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki2/src/models/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki2/src/models/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki2/src/models/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/pyramid-small.png b/docs/tutorials/wiki2/src/models/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki2/src/models/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/pyramid.png b/docs/tutorials/wiki2/src/models/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki2/src/models/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki2/src/models/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/theme.css b/docs/tutorials/wiki2/src/models/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki2/src/models/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/theme.min.css b/docs/tutorials/wiki2/src/models/tutorial/static/theme.min.css
new file mode 100644
index 000000000..2f924bcc5
--- /dev/null
+++ b/docs/tutorials/wiki2/src/models/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a{color:#fff}.starter-template .links ul li a:hover{text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}} \ No newline at end of file
diff --git a/docs/tutorials/wiki2/src/models/tutorial/static/transparent.gif b/docs/tutorials/wiki2/src/models/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki2/src/models/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt
index ca4e0af26..c9b0cec21 100644
--- a/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt
@@ -1,73 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="${request.static_url('tutorial:static/pyramid.png')}" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>Alchemy Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Alchemy scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/favicon.ico b/docs/tutorials/wiki2/src/tests/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki2/src/tests/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/footerbg.png b/docs/tutorials/wiki2/src/tests/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki2/src/tests/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/headerbg.png b/docs/tutorials/wiki2/src/tests/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki2/src/tests/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/ie6.css b/docs/tutorials/wiki2/src/tests/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki2/src/tests/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/middlebg.png b/docs/tutorials/wiki2/src/tests/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki2/src/tests/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/pylons.css b/docs/tutorials/wiki2/src/tests/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki2/src/tests/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid-small.png b/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid.png b/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki2/src/tests/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/theme.css b/docs/tutorials/wiki2/src/tests/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki2/src/tests/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/theme.min.css b/docs/tutorials/wiki2/src/tests/tutorial/static/theme.min.css
new file mode 100644
index 000000000..2f924bcc5
--- /dev/null
+++ b/docs/tutorials/wiki2/src/tests/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a{color:#fff}.starter-template .links ul li a:hover{text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}} \ No newline at end of file
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/static/transparent.gif b/docs/tutorials/wiki2/src/tests/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki2/src/tests/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/templates/edit.pt b/docs/tutorials/wiki2/src/tests/tutorial/templates/edit.pt
index 2004273fe..50e55c850 100644
--- a/docs/tutorials/wiki2/src/tests/tutorial/templates/edit.pt
+++ b/docs/tutorials/wiki2/src/tests/tutorial/templates/edit.pt
@@ -1,58 +1,74 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.name} - Pyramid tutorial wiki (based on
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.name} - Pyramid tutorial wiki (based on
TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/pylons.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/ie6.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="${request.static_url('tutorial:static/pyramid-small.png')}" />
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p>
+ Editing <strong><span tal:replace="page.name">Page Name Goes
+ Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ <p class="pull-right">
+ <span tal:condition="logged_in">
+ <a href="${request.application_url}/logout">Logout</a>
+ </span>
+ </p>
+ <form action="${save_url}" method="post">
+ <div class="form-group">
+ <textarea class="form-control" name="body" tal:content="page.data" rows="10" cols="60"></textarea>
+ </div>
+ <div class="form-group">
+ <button type="submit" name="form.submitted" value="Save" class="btn btn-default">Save</button>
+ </div>
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Editing <b><span tal:replace="page.name">Page Name
- Goes Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right">
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- <div id="bottom">
- <div class="bottom">
- <form action="${save_url}" method="post">
- <textarea name="body" tal:content="page.data" rows="10"
- cols="60"/><br/>
- <input type="submit" name="form.submitted" value="Save"/>
- </form>
- </div>
- </div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt
index 6c1ca924a..c9b0cec21 100644
--- a/docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt
@@ -1,73 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="${request.static_url('tutorial:static/pyramid.png')}" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>Alchemy Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Alchemy scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/templates/view.pt b/docs/tutorials/wiki2/src/tests/tutorial/templates/view.pt
index 19c50fb36..4e5772de0 100644
--- a/docs/tutorials/wiki2/src/tests/tutorial/templates/view.pt
+++ b/docs/tutorials/wiki2/src/tests/tutorial/templates/view.pt
@@ -1,61 +1,74 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.name} - Pyramid tutorial wiki (based on
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.name} - Pyramid tutorial wiki (based on
TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/pylons.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/ie6.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="${request.static_url('tutorial:static/pyramid-small.png')}" />
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <div tal:replace="structure content">
+ Page text goes here.
+ </div>
+ <p>
+ <a tal:attributes="href edit_url" href="">
+ Edit this page
+ </a>
+ </p>
+ <p>
+ Viewing <strong><span tal:replace="page.name">
+ Page Name Goes Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ <p class="pull-right">
+ <span tal:condition="logged_in">
+ <a href="${request.application_url}/logout">Logout</a>
+ </span>
+ </p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Viewing <b><span tal:replace="page.name">Page Name
- Goes Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right">
- <span tal:condition="logged_in">
- <a href="${request.application_url}/logout">Logout</a>
- </span>
- </div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div tal:replace="structure content">
- Page text goes here.
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <p>
- <a tal:attributes="href edit_url" href="">
- Edit this page
- </a>
- </p>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/favicon.ico b/docs/tutorials/wiki2/src/views/tutorial/static/favicon.ico
deleted file mode 100644
index 71f837c9e..000000000
--- a/docs/tutorials/wiki2/src/views/tutorial/static/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/footerbg.png b/docs/tutorials/wiki2/src/views/tutorial/static/footerbg.png
deleted file mode 100644
index 1fbc873da..000000000
--- a/docs/tutorials/wiki2/src/views/tutorial/static/footerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/headerbg.png b/docs/tutorials/wiki2/src/views/tutorial/static/headerbg.png
deleted file mode 100644
index 0596f2020..000000000
--- a/docs/tutorials/wiki2/src/views/tutorial/static/headerbg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/ie6.css b/docs/tutorials/wiki2/src/views/tutorial/static/ie6.css
deleted file mode 100644
index b7c8493d8..000000000
--- a/docs/tutorials/wiki2/src/views/tutorial/static/ie6.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* html img,
-* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
-this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
-this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
-this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
-);}
-#wrap{display:table;height:100%}
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/middlebg.png b/docs/tutorials/wiki2/src/views/tutorial/static/middlebg.png
deleted file mode 100644
index 2369cfb7d..000000000
--- a/docs/tutorials/wiki2/src/views/tutorial/static/middlebg.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/pylons.css b/docs/tutorials/wiki2/src/views/tutorial/static/pylons.css
deleted file mode 100644
index 4b1c017cd..000000000
--- a/docs/tutorials/wiki2/src/views/tutorial/static/pylons.css
+++ /dev/null
@@ -1,372 +0,0 @@
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
-{
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%; /* 16px */
- vertical-align: baseline;
- background: transparent;
-}
-
-body
-{
- line-height: 1;
-}
-
-ol, ul
-{
- list-style: none;
-}
-
-blockquote, q
-{
- quotes: none;
-}
-
-blockquote:before, blockquote:after, q:before, q:after
-{
- content: '';
- content: none;
-}
-
-:focus
-{
- outline: 0;
-}
-
-ins
-{
- text-decoration: none;
-}
-
-del
-{
- text-decoration: line-through;
-}
-
-table
-{
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-sub
-{
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
-}
-
-sup
-{
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
-}
-
-ul, menu, dir
-{
- display: block;
- list-style-type: disc;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-ol
-{
- display: block;
- list-style-type: decimal-leading-zero;
- margin: 1em 0;
- padding-left: 40px;
-}
-
-li
-{
- display: list-item;
-}
-
-ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir
-{
- list-style-type: circle;
-}
-
-ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir
-{
- list-style-type: square;
-}
-
-.hidden
-{
- display: none;
-}
-
-p
-{
- line-height: 1.5em;
-}
-
-h1
-{
- font-size: 1.75em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h2
-{
- font-size: 1.5em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h3
-{
- font-size: 1.25em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-h4
-{
- font-size: 1em;
- line-height: 1.7em;
- font-family: helvetica, verdana;
-}
-
-html, body
-{
- width: 100%;
- height: 100%;
-}
-
-body
-{
- margin: 0;
- padding: 0;
- background-color: #fff;
- position: relative;
- font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
-}
-
-a
-{
- color: #1b61d6;
- text-decoration: none;
-}
-
-a:hover
-{
- color: #e88f00;
- text-decoration: underline;
-}
-
-body h1, body h2, body h3, body h4, body h5, body h6
-{
- font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif;
- font-weight: 400;
- color: #373839;
- font-style: normal;
-}
-
-#wrap
-{
- min-height: 100%;
-}
-
-#header, #footer
-{
- width: 100%;
- color: #fff;
- height: 40px;
- position: absolute;
- text-align: center;
- line-height: 40px;
- overflow: hidden;
- font-size: 12px;
- vertical-align: middle;
-}
-
-#header
-{
- background: #000;
- top: 0;
- font-size: 14px;
-}
-
-#footer
-{
- bottom: 0;
- background: #000 url(footerbg.png) repeat-x 0 top;
- position: relative;
- margin-top: -40px;
- clear: both;
-}
-
-.header, .footer
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.wrapper
-{
- width: 100%;
-}
-
-#top, #top-small, #bottom
-{
- width: 100%;
-}
-
-#top
-{
- color: #000;
- height: 230px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#top-small
-{
- color: #000;
- height: 60px;
- background: #fff url(headerbg.png) repeat-x 0 top;
- position: relative;
-}
-
-#bottom
-{
- color: #222;
- background-color: #fff;
-}
-
-.top, .top-small, .middle, .bottom
-{
- width: 750px;
- margin-right: auto;
- margin-left: auto;
-}
-
-.top
-{
- padding-top: 40px;
-}
-
-.top-small
-{
- padding-top: 10px;
-}
-
-#middle
-{
- width: 100%;
- height: 100px;
- background: url(middlebg.png) repeat-x;
- border-top: 2px solid #fff;
- border-bottom: 2px solid #b2b2b2;
-}
-
-.app-welcome
-{
- margin-top: 25px;
-}
-
-.app-name
-{
- color: #000;
- font-weight: 700;
-}
-
-.bottom
-{
- padding-top: 50px;
-}
-
-#left
-{
- width: 350px;
- float: left;
- padding-right: 25px;
-}
-
-#right
-{
- width: 350px;
- float: right;
- padding-left: 25px;
-}
-
-.align-left
-{
- text-align: left;
-}
-
-.align-right
-{
- text-align: right;
-}
-
-.align-center
-{
- text-align: center;
-}
-
-ul.links
-{
- margin: 0;
- padding: 0;
-}
-
-ul.links li
-{
- list-style-type: none;
- font-size: 14px;
-}
-
-form
-{
- border-style: none;
-}
-
-fieldset
-{
- border-style: none;
-}
-
-input
-{
- color: #222;
- border: 1px solid #ccc;
- font-family: sans-serif;
- font-size: 12px;
- line-height: 16px;
-}
-
-input[type=text], input[type=password]
-{
- width: 205px;
-}
-
-input[type=submit]
-{
- background-color: #ddd;
- font-weight: 700;
-}
-
-/*Opera Fix*/
-body:before
-{
- content: "";
- height: 100%;
- float: left;
- width: 0;
- margin-top: -32767px;
-}
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/pyramid-16x16.png b/docs/tutorials/wiki2/src/views/tutorial/static/pyramid-16x16.png
new file mode 100644
index 000000000..979203112
--- /dev/null
+++ b/docs/tutorials/wiki2/src/views/tutorial/static/pyramid-16x16.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/pyramid-small.png b/docs/tutorials/wiki2/src/views/tutorial/static/pyramid-small.png
deleted file mode 100644
index a5bc0ade7..000000000
--- a/docs/tutorials/wiki2/src/views/tutorial/static/pyramid-small.png
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/pyramid.png b/docs/tutorials/wiki2/src/views/tutorial/static/pyramid.png
index 347e05549..4ab837be9 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/static/pyramid.png
+++ b/docs/tutorials/wiki2/src/views/tutorial/static/pyramid.png
Binary files differ
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/theme.css b/docs/tutorials/wiki2/src/views/tutorial/static/theme.css
new file mode 100644
index 000000000..0f4b1a4d4
--- /dev/null
+++ b/docs/tutorials/wiki2/src/views/tutorial/static/theme.css
@@ -0,0 +1,154 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
+body {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+ color: #ffffff;
+ background: #bc2131;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 300;
+}
+p {
+ font-weight: 300;
+}
+.font-normal {
+ font-weight: 400;
+}
+.font-semi-bold {
+ font-weight: 600;
+}
+.font-bold {
+ font-weight: 700;
+}
+.starter-template {
+ margin-top: 250px;
+}
+.starter-template .content {
+ margin-left: 10px;
+}
+.starter-template .content h1 {
+ margin-top: 10px;
+ font-size: 60px;
+}
+.starter-template .content h1 .smaller {
+ font-size: 40px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead {
+ font-size: 25px;
+ color: #f2b7bd;
+}
+.starter-template .content .lead .font-normal {
+ color: #ffffff;
+}
+.starter-template .links {
+ float: right;
+ right: 0;
+ margin-top: 125px;
+}
+.starter-template .links ul {
+ display: block;
+ padding: 0;
+ margin: 0;
+}
+.starter-template .links ul li {
+ list-style: none;
+ display: inline;
+ margin: 0 10px;
+}
+.starter-template .links ul li:first-child {
+ margin-left: 0;
+}
+.starter-template .links ul li:last-child {
+ margin-right: 0;
+}
+.starter-template .links ul li.current-version {
+ color: #f2b7bd;
+ font-weight: 400;
+}
+.starter-template .links ul li a, a {
+ color: #f2b7bd;
+ text-decoration: underline;
+}
+.starter-template .links ul li a:hover, a:hover {
+ color: #ffffff;
+ text-decoration: underline;
+}
+.starter-template .links ul li .icon-muted {
+ color: #eb8b95;
+ margin-right: 5px;
+}
+.starter-template .links ul li:hover .icon-muted {
+ color: #ffffff;
+}
+.starter-template .copyright {
+ margin-top: 10px;
+ font-size: 0.9em;
+ color: #f2b7bd;
+ text-transform: lowercase;
+ float: right;
+ right: 0;
+}
+@media (max-width: 1199px) {
+ .starter-template .content h1 {
+ font-size: 45px;
+ }
+ .starter-template .content h1 .smaller {
+ font-size: 30px;
+ }
+ .starter-template .content .lead {
+ font-size: 20px;
+ }
+}
+@media (max-width: 991px) {
+ .starter-template {
+ margin-top: 0;
+ }
+ .starter-template .logo {
+ margin: 40px auto;
+ }
+ .starter-template .content {
+ margin-left: 0;
+ text-align: center;
+ }
+ .starter-template .content h1 {
+ margin-bottom: 20px;
+ }
+ .starter-template .links {
+ float: none;
+ text-align: center;
+ margin-top: 60px;
+ }
+ .starter-template .copyright {
+ float: none;
+ text-align: center;
+ }
+}
+@media (max-width: 767px) {
+ .starter-template .content h1 .smaller {
+ font-size: 25px;
+ display: block;
+ }
+ .starter-template .content .lead {
+ font-size: 16px;
+ }
+ .starter-template .links {
+ margin-top: 40px;
+ }
+ .starter-template .links ul li {
+ display: block;
+ margin: 0;
+ }
+ .starter-template .links ul li .icon-muted {
+ display: none;
+ }
+ .starter-template .copyright {
+ margin-top: 20px;
+ }
+}
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/theme.min.css b/docs/tutorials/wiki2/src/views/tutorial/static/theme.min.css
new file mode 100644
index 000000000..0d25de5b6
--- /dev/null
+++ b/docs/tutorials/wiki2/src/views/tutorial/static/theme.min.css
@@ -0,0 +1 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);body{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#fff;background:#bc2131}h1,h2,h3,h4,h5,h6{font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300}p{font-weight:300}.font-normal{font-weight:400}.font-semi-bold{font-weight:600}.font-bold{font-weight:700}.starter-template{margin-top:250px}.starter-template .content{margin-left:10px}.starter-template .content h1{margin-top:10px;font-size:60px}.starter-template .content h1 .smaller{font-size:40px;color:#f2b7bd}.starter-template .content .lead{font-size:25px;color:#f2b7bd}.starter-template .content .lead .font-normal{color:#fff}.starter-template .links{float:right;right:0;margin-top:125px}.starter-template .links ul{display:block;padding:0;margin:0}.starter-template .links ul li{list-style:none;display:inline;margin:0 10px}.starter-template .links ul li:first-child{margin-left:0}.starter-template .links ul li:last-child{margin-right:0}.starter-template .links ul li.current-version{color:#f2b7bd;font-weight:400}.starter-template .links ul li a,a{color:#f2b7bd;text-decoration:underline}.starter-template .links ul li a:hover,a:hover{color:#fff;text-decoration:underline}.starter-template .links ul li .icon-muted{color:#eb8b95;margin-right:5px}.starter-template .links ul li:hover .icon-muted{color:#fff}.starter-template .copyright{margin-top:10px;font-size:.9em;color:#f2b7bd;text-transform:lowercase;float:right;right:0}@media (max-width:1199px){.starter-template .content h1{font-size:45px}.starter-template .content h1 .smaller{font-size:30px}.starter-template .content .lead{font-size:20px}}@media (max-width:991px){.starter-template{margin-top:0}.starter-template .logo{margin:40px auto}.starter-template .content{margin-left:0;text-align:center}.starter-template .content h1{margin-bottom:20px}.starter-template .links{float:none;text-align:center;margin-top:60px}.starter-template .copyright{float:none;text-align:center}}@media (max-width:767px){.starter-template .content h1 .smaller{font-size:25px;display:block}.starter-template .content .lead{font-size:16px}.starter-template .links{margin-top:40px}.starter-template .links ul li{display:block;margin:0}.starter-template .links ul li .icon-muted{display:none}.starter-template .copyright{margin-top:20px}}
diff --git a/docs/tutorials/wiki2/src/views/tutorial/static/transparent.gif b/docs/tutorials/wiki2/src/views/tutorial/static/transparent.gif
deleted file mode 100644
index 0341802e5..000000000
--- a/docs/tutorials/wiki2/src/views/tutorial/static/transparent.gif
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/wiki2/src/views/tutorial/templates/edit.pt b/docs/tutorials/wiki2/src/views/tutorial/templates/edit.pt
index 5f962bbf5..c0c1b6c20 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/templates/edit.pt
+++ b/docs/tutorials/wiki2/src/views/tutorial/templates/edit.pt
@@ -1,54 +1,69 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.name} - Pyramid tutorial wiki (based on
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.name} - Pyramid tutorial wiki (based on
TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/pylons.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/ie6.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="${request.static_url('tutorial:static/pyramid-small.png')}" />
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <p>
+ Editing <strong><span tal:replace="page.name">Page Name Goes
+ Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ <form action="${save_url}" method="post">
+ <div class="form-group">
+ <textarea class="form-control" name="body" tal:content="page.data" rows="10" cols="60"></textarea>
+ </div>
+ <div class="form-group">
+ <button type="submit" name="form.submitted" value="Save" class="btn btn-default">Save</button>
+ </div>
+ </form>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Editing <b><span tal:replace="page.name">Page Name Goes
- Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <div id="right" class="app-welcome align-right"></div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <form action="${save_url}" method="post">
- <textarea name="body" tal:content="page.data" rows="10"
- cols="60"/><br/>
- <input type="submit" name="form.submitted" value="Save"/>
- </form>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt
index ca4e0af26..c9b0cec21 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt
@@ -1,73 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>The Pyramid Web Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css" media="screen" />
- <link rel="stylesheet" href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css" media="screen" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="${request.static_url('tutorial:static/pyramid.png')}" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid Web Framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/current/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>Alchemy Scaffold for The Pyramid Web Framework</title>
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Alchemy scaffold</span></h1>
+ <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
+ </div>
+ </div>
</div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonsproject.org">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonsproject.org/projects/pyramid/current/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
+ <div class="row">
+ <div class="links">
+ <ul>
+ <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
+ <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
+ <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
+ <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
</ul>
+ </div>
+ </div>
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/views/tutorial/templates/view.pt b/docs/tutorials/wiki2/src/views/tutorial/templates/view.pt
index 78c0d2d4c..0f564b16c 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/templates/view.pt
+++ b/docs/tutorials/wiki2/src/views/tutorial/templates/view.pt
@@ -1,57 +1,69 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head>
- <title>${page.name} - Pyramid tutorial wiki (based on
+<!DOCTYPE html>
+<html lang="${request.locale_name}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="pyramid web application">
+ <meta name="author" content="Pylons Project">
+ <link rel="shortcut icon" href="${request.static_url('tutorial:static/pyramid-16x16.png')}">
+
+ <title>${page.name} - Pyramid tutorial wiki (based on
TurboGears 20-Minute Wiki)</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon"
- href="${request.static_url('tutorial:static/favicon.ico')}" />
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/pylons.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet"
- href="${request.static_url('tutorial:static/ie6.css')}"
- type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
-</head>
-<body>
- <div id="wrap">
- <div id="top-small">
- <div class="top-small align-center">
- <div>
- <img width="220" height="50" alt="pyramid"
- src="${request.static_url('tutorial:static/pyramid-small.png')}" />
+
+ <!-- Bootstrap core CSS -->
+ <link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+
+ <!-- Custom styles for this scaffold -->
+ <link href="${request.static_url('tutorial:static/theme.css')}" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+
+ <div class="starter-template">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <img class="logo img-responsive" src="${request.static_url('tutorial:static/pyramid.png')}" alt="pyramid web framework">
+ </div>
+ <div class="col-md-10">
+ <div class="content">
+ <div tal:replace="structure content">
+ Page text goes here.
+ </div>
+ <p>
+ <a tal:attributes="href edit_url" href="">
+ Edit this page
+ </a>
+ </p>
+ <p>
+ Viewing <strong><span tal:replace="page.name">
+ Page Name Goes Here</span></strong>
+ </p>
+ <p>You can return to the
+ <a href="${request.application_url}">FrontPage</a>.
+ </p>
+ </div>
+ </div>
</div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-right">
- <div id="left" class="app-welcome align-left">
- Viewing <b><span tal:replace="page.name">Page Name
- Goes Here</span></b><br/>
- You can return to the
- <a href="${request.application_url}">FrontPage</a>.<br/>
- </div>
- <div id="right" class="app-welcome align-right"></div>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div tal:replace="structure content">
- Page text goes here.
+ <div class="row">
+ <div class="copyright">
+ Copyright &copy; Pylons Project
+ </div>
</div>
- <p>
- <a tal:attributes="href edit_url" href="">
- Edit this page
- </a>
- </p>
</div>
</div>
- </div>
-</body>
+
+
+ <!-- Bootstrap core JavaScript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script>
+ <script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
+ </body>
</html>
diff --git a/docs/tutorials/wiki2/src/views/tutorial/views.py b/docs/tutorials/wiki2/src/views/tutorial/views.py
index b41d4ab40..a3707dab5 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/views.py
+++ b/docs/tutorials/wiki2/src/views/tutorial/views.py
@@ -6,6 +6,7 @@ from pyramid.httpexceptions import (
HTTPFound,
HTTPNotFound,
)
+
from pyramid.view import view_config
from .models import (
diff --git a/docs/tutorials/wiki2/tests.rst b/docs/tutorials/wiki2/tests.rst
index 9aca0c5b7..9db95334a 100644
--- a/docs/tutorials/wiki2/tests.rst
+++ b/docs/tutorials/wiki2/tests.rst
@@ -2,29 +2,25 @@
Adding Tests
============
-We will now add tests for the models and the views and a few functional
-tests in the ``tests.py``. Tests ensure that an application works, and
-that it continues to work after changes are made in the future.
+We will now add tests for the models and the views and a few functional tests
+in ``tests.py``. Tests ensure that an application works, and that it
+continues to work when changes are made in the future.
+Test the models
+===============
+To test the model class ``Page`` we'll add a new ``PageModelTests`` class to
+our ``tests.py`` file that was generated as part of the ``alchemy`` scaffold.
-Testing the Models
-==================
+Test the views
+==============
-To test the model class ``Page`` we'll add a new ``PageModelTests``
-class to our ``tests.py`` file that was generated as part of the
-``alchemy`` scaffold.
-
-Testing the Views
-=================
-
-We'll modify our ``tests.py`` file, adding tests for each view
-function we added above. As a result, we'll *delete* the
-``ViewTests`` class that the ``alchemy`` scaffold provided, and add
-four other test classes: ``ViewWikiTests``, ``ViewPageTests``,
-``AddPageTests``, and ``EditPageTests``. These test the
-``view_wiki``, ``view_page``, ``add_page``, and ``edit_page`` views
-respectively.
+We'll modify our ``tests.py`` file, adding tests for each view function we
+added previously. As a result, we'll *delete* the ``ViewTests`` class that
+the ``alchemy`` scaffold provided, and add four other test classes:
+``ViewWikiTests``, ``ViewPageTests``, ``AddPageTests``, and ``EditPageTests``.
+These test the ``view_wiki``, ``view_page``, ``add_page``, and ``edit_page``
+views.
Functional tests
================
@@ -34,16 +30,17 @@ tested in the unit tests, like logging in, logging out, checking that
the ``viewer`` user cannot add or edit pages, but the ``editor`` user
can, and so on.
-Viewing the results of all our edits to ``tests.py``
-====================================================
+View the results of all our edits to ``tests.py``
+=================================================
-Once we're done with the ``tests.py`` module, it will look a lot like:
+Open the ``tutorial/tests.py`` module, and edit it such that it appears as
+follows:
.. literalinclude:: src/tests/tutorial/tests.py
:linenos:
:language: python
-Running the Tests
+Running the tests
=================
We can run these tests by using ``setup.py test`` in the same way we did in
@@ -57,7 +54,7 @@ Change the ``requires`` list in ``setup.py`` to include ``WebTest``.
:lines: 11-22
:emphasize-lines: 11
-After we've added a dependency on WebTest in ``setup.py``, we need to rerun
+After we've added a dependency on WebTest in ``setup.py``, we need to run
``setup.py develop`` to get WebTest installed into our virtualenv. Assuming
our shell's current working directory is the "tutorial" distribution
directory:
@@ -89,7 +86,7 @@ On Windows:
c:\pyramidtut\tutorial> %VENV%\Scripts\python setup.py test -q
-The expected result ends something like:
+The expected result should look like the following:
.. code-block:: text
diff --git a/docs/whatsnew-1.0.rst b/docs/whatsnew-1.0.rst
index 9541f0a28..0ed6e21fc 100644
--- a/docs/whatsnew-1.0.rst
+++ b/docs/whatsnew-1.0.rst
@@ -1,4 +1,4 @@
-What's New In Pyramid 1.0
+What's New in Pyramid 1.0
=========================
This article explains the new features in Pyramid version 1.0 as compared to
diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst
index 99737b6d8..a5c7f3393 100644
--- a/docs/whatsnew-1.1.rst
+++ b/docs/whatsnew-1.1.rst
@@ -1,4 +1,4 @@
-What's New In Pyramid 1.1
+What's New in Pyramid 1.1
=========================
This article explains the new features in Pyramid version 1.1 as compared to
diff --git a/docs/whatsnew-1.2.rst b/docs/whatsnew-1.2.rst
index a9fc38908..9ff933ace 100644
--- a/docs/whatsnew-1.2.rst
+++ b/docs/whatsnew-1.2.rst
@@ -1,4 +1,4 @@
-What's New In Pyramid 1.2
+What's New in Pyramid 1.2
=========================
This article explains the new features in :app:`Pyramid` version 1.2 as
diff --git a/docs/whatsnew-1.3.rst b/docs/whatsnew-1.3.rst
index 2606c3df3..8de69c450 100644
--- a/docs/whatsnew-1.3.rst
+++ b/docs/whatsnew-1.3.rst
@@ -1,4 +1,4 @@
-What's New In Pyramid 1.3
+What's New in Pyramid 1.3
=========================
This article explains the new features in :app:`Pyramid` version 1.3 as
@@ -18,7 +18,7 @@ Python 3 Compatibility
.. image:: python-3.png
Pyramid continues to run on Python 2, but Pyramid is now also Python 3
-compatible. To use Pyramid under Python 3, Python 3.2 or better is required.
+compatible. To use Pyramid under Python 3, Python 3.3 or better is required.
Many Pyramid add-ons are already Python 3 compatible. For example,
``pyramid_debugtoolbar``, ``pyramid_jinja2``, ``pyramid_exclog``,
@@ -523,10 +523,11 @@ Documentation Enhancements
:ref:`making_a_console_script`.
- Removed the "Running Pyramid on Google App Engine" tutorial from the main
- docs. It survives on in the Cookbook
- (http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/deployment/gae.html).
- Rationale: it provides the correct info for the Python 2.5 version of GAE
- only, and this version of Pyramid does not support Python 2.5.
+ docs. It survives on in the Pyramid Community Cookbook as
+ :ref:`Pyramid on Google's App Engine (using appengine-monkey)
+ <cookbook:appengine_tutorial>`. Rationale: it provides the correct info for
+ the Python 2.5 version of GAE only, and this version of Pyramid does not
+ support Python 2.5.
- Updated the :ref:`changing_the_forbidden_view` section, replacing
explanations of registering a view using ``add_view`` or ``view_config``
diff --git a/docs/whatsnew-1.4.rst b/docs/whatsnew-1.4.rst
index 505b9d798..fce889854 100644
--- a/docs/whatsnew-1.4.rst
+++ b/docs/whatsnew-1.4.rst
@@ -1,4 +1,4 @@
-What's New In Pyramid 1.4
+What's New in Pyramid 1.4
=========================
This article explains the new features in :app:`Pyramid` version 1.4 as
diff --git a/docs/whatsnew-1.5.rst b/docs/whatsnew-1.5.rst
index 1d863c937..a477ce5ec 100644
--- a/docs/whatsnew-1.5.rst
+++ b/docs/whatsnew-1.5.rst
@@ -1,4 +1,4 @@
-What's New In Pyramid 1.5
+What's New in Pyramid 1.5
=========================
This article explains the new features in :app:`Pyramid` version 1.5 as
@@ -136,6 +136,8 @@ Feature Additions
The feature additions in Pyramid 1.5 follow.
+- Python 3.4 compatibility.
+
- Add ``pdistreport`` script, which prints the Python version in use, the
Pyramid version in use, and the version number and location of all Python
distributions currently installed.
diff --git a/docs/whatsnew-1.6.rst b/docs/whatsnew-1.6.rst
new file mode 100644
index 000000000..f5c307b5d
--- /dev/null
+++ b/docs/whatsnew-1.6.rst
@@ -0,0 +1,248 @@
+What's New in Pyramid 1.6
+=========================
+
+This article explains the new features in :app:`Pyramid` version 1.6 as
+compared to its predecessor, :app:`Pyramid` 1.5. It also documents backwards
+incompatibilities between the two versions and deprecations added to
+:app:`Pyramid` 1.6, as well as software dependency changes and notable
+documentation additions.
+
+
+Backwards Incompatibilities
+---------------------------
+
+- IPython and BPython support have been removed from pshell in the core. To
+ continue using them on Pyramid 1.6+, you must install the binding packages
+ explicitly. One way to do this is by adding ``pyramid_ipython`` (or
+ ``pyramid_bpython``) to the ``install_requires`` section of your package's
+ ``setup.py`` file, then re-running ``setup.py develop``::
+
+ setup(
+ #...
+ install_requires=[
+ 'pyramid_ipython', # new dependency
+ 'pyramid',
+ #...
+ ],
+ )
+
+- ``request.response`` will no longer be mutated when using the
+ :func:`~pyramid.renderers.render_to_response` API. It is now necessary to
+ pass in a ``response=`` argument to
+ :func:`~pyramid.renderers.render_to_response` if you wish to supply the
+ renderer with a custom response object. If you do not pass one, then a
+ response object will be created using the current response factory. Almost
+ all renderers mutate the ``request.response`` response object (for example,
+ the JSON renderer sets ``request.response.content_type`` to
+ ``application/json``). However, when invoking ``render_to_response``, it is
+ not expected that the response object being returned would be the same one
+ used later in the request. The response object returned from
+ ``render_to_response`` is now explicitly different from ``request.response``.
+ This does not change the API of a renderer. See
+ https://github.com/Pylons/pyramid/pull/1563
+
+- In an effort to combat a common issue it is now a
+ :class:`~pyramid.exceptions.ConfigurationError` to register a view
+ callable that is actually an unbound method when using the default view
+ mapper. As unbound methods do not exist in PY3+ possible errors are detected
+ by checking if the first parameter is named ``self``. For example,
+ `config.add_view(ViewClass.some_method, ...)` should actually be
+ `config.add_view(ViewClass, attr='some_method)'`. This was always an issue
+ in Pyramid on PY2 but the backward incompatibility is on PY3+ where you may
+ not use a function with the first parameter named ``self``. In this case
+ it looks too much like a common error and the exception will be raised.
+ See https://github.com/Pylons/pyramid/pull/1498
+
+
+Feature Additions
+-----------------
+
+- Python 3.5 and pypy3 compatibility.
+
+- ``pserve --reload`` will no longer crash on syntax errors. See
+ https://github.com/Pylons/pyramid/pull/2044
+
+- Cache busting for static resources has been added and is available via a new
+ :meth:`pyramid.config.Configurator.add_cache_buster` API. Core APIs are
+ shipped for both cache busting via query strings and via asset manifests for
+ integrating into custom asset pipelines. See
+ https://github.com/Pylons/pyramid/pull/1380 and
+ https://github.com/Pylons/pyramid/pull/1583 and
+ https://github.com/Pylons/pyramid/pull/2171
+
+- Assets can now be overidden by an absolute path on the filesystem when using
+ the :meth:`~pyramid.config.Configurator.override_asset` API. This makes it
+ possible to fully support serving up static content from a mutable directory
+ while still being able to use the :meth:`~pyramid.request.Request.static_url`
+ API and :meth:`~pyramid.config.Configurator.add_static_view`. Previously it
+ was not possible to use :meth:`~pyramid.config.Configurator.add_static_view`
+ with an absolute path **and** generate urls to the content. This change
+ replaces the call, ``config.add_static_view('/abs/path', 'static')``, with
+ ``config.add_static_view('myapp:static', 'static')`` and
+ ``config.override_asset(to_override='myapp:static/',
+ override_with='/abs/path/')``. The ``myapp:static`` asset spec is completely
+ made up and does not need to exist—it is used for generating URLs via
+ ``request.static_url('myapp:static/foo.png')``. See
+ https://github.com/Pylons/pyramid/issues/1252
+
+- Added :meth:`~pyramid.config.Configurator.set_response_factory` and the
+ ``response_factory`` keyword argument to the constructor of
+ :class:`~pyramid.config.Configurator` for defining a factory that will return
+ a custom ``Response`` class. See https://github.com/Pylons/pyramid/pull/1499
+
+- Added :attr:`pyramid.config.Configurator.root_package` attribute and init
+ parameter to assist with includible packages that wish to resolve resources
+ relative to the package in which the configurator was created. This is
+ especially useful for add-ons that need to load asset specs from settings, in
+ which case it may be natural for a developer to define imports or assets
+ relative to the top-level package. See
+ https://github.com/Pylons/pyramid/pull/1337
+
+- 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``
+ output by showing the module instead of just ``__repr__``. See
+ https://github.com/Pylons/pyramid/pull/1488
+
+- ``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
+
+- Support keyword-only arguments and function annotations in views in Python 3.
+ See https://github.com/Pylons/pyramid/pull/1556
+
+- The ``append_slash`` argument of
+ :meth:`~pyramid.config.Configurator.add_notfound_view()` will now accept
+ anything that implements the :class:`~pyramid.interfaces.IResponse` interface
+ and will use that as the response class instead of the default
+ :class:`~pyramid.httpexceptions.HTTPFound`. See
+ https://github.com/Pylons/pyramid/pull/1610
+
+- The :class:`~pyramid.config.Configurator` has grown the ability to allow
+ actions to call other actions during a commit cycle. This enables much more
+ logic to be placed into actions, such as the ability to invoke other actions
+ or group them for improved conflict detection. We have also exposed and
+ documented the configuration phases that Pyramid uses in order to further
+ assist in building conforming add-ons. See
+ https://github.com/Pylons/pyramid/pull/1513
+
+- Allow an iterator to be returned from a renderer. Previously it was only
+ possible to return bytes or unicode. See
+ https://github.com/Pylons/pyramid/pull/1417
+
+- Improve robustness to timing attacks in the
+ :class:`~pyramid.authentication.AuthTktCookieHelper` and the
+ :class:`~pyramid.session.SignedCookieSessionFactory` classes by using the
+ stdlib's ``hmac.compare_digest`` if it is available (such as Python 2.7.7+
+ and 3.3+). See https://github.com/Pylons/pyramid/pull/1457
+
+- Improve the readability of the ``pcreate`` shell script output. See
+ https://github.com/Pylons/pyramid/pull/1453
+
+- Make it simple to define ``notfound`` and ``forbidden`` views that wish to
+ use the default exception-response view, but with altered predicates and
+ other configuration options. The ``view`` argument is now optional in
+ :meth:`~pyramid.config.Configurator.add_notfound_view` and
+ :meth:`~pyramid.config.Configurator.add_forbidden_view` See
+ https://github.com/Pylons/pyramid/issues/494
+
+- The ``pshell`` script will now load a ``PYTHONSTARTUP`` file if one is
+ defined in the environment prior to launching the interpreter. See
+ https://github.com/Pylons/pyramid/pull/1448
+
+- Add new HTTP exception objects for status codes ``428 Precondition
+ Required``, ``429 Too Many Requests`` and ``431 Request Header Fields Too
+ Large`` in ``pyramid.httpexceptions``. See
+ https://github.com/Pylons/pyramid/pull/1372/files
+
+- ``pcreate`` when run without a scaffold argument will now print information
+ on the missing flag, as well as a list of available scaffolds. See
+ https://github.com/Pylons/pyramid/pull/1566 and
+ https://github.com/Pylons/pyramid/issues/1297
+
+- ``pcreate`` will now ask for confirmation if invoked with an argument for a
+ project name that already exists or is importable in the current environment.
+ See https://github.com/Pylons/pyramid/issues/1357 and
+ https://github.com/Pylons/pyramid/pull/1837
+
+- Add :func:`pyramid.request.apply_request_extensions` function which can be
+ used in testing to apply any request extensions configured via
+ ``config.add_request_method``. Previously it was only possible to test the
+ extensions by going through Pyramid's router. See
+ https://github.com/Pylons/pyramid/pull/1581
+
+- Make it possible to subclass ``pyramid.request.Request`` and also use
+ ``pyramid.request.Request.add_request.method``. See
+ https://github.com/Pylons/pyramid/issues/1529
+
+- Additional shells for ``pshell`` can now be registered as entry points. See
+ https://github.com/Pylons/pyramid/pull/1891 and
+ https://github.com/Pylons/pyramid/pull/2012
+
+- The variables injected into ``pshell`` are now displayed with their
+ docstrings instead of the default ``str(obj)`` when possible. See
+ https://github.com/Pylons/pyramid/pull/1929
+
+
+Deprecations
+------------
+
+- The ``pserve`` command's daemonization features, as well as
+ ``--monitor-restart``, have been deprecated. This includes the
+ ``[start,stop,restart,status]`` subcommands, as well as the ``--daemon``,
+ ``--stop-daemon``, ``--pid-file``, ``--status``, ``--user``, and ``--group``
+ flags. See https://github.com/Pylons/pyramid/pull/2120 and
+ https://github.com/Pylons/pyramid/pull/2189 and
+ https://github.com/Pylons/pyramid/pull/1641
+
+ Please use a real process manager in the future instead of relying on
+ ``pserve`` to daemonize itself. Many options exist, including your operating
+ system's services, such as Systemd or Upstart, as well as Python-based
+ solutions like Circus and Supervisor.
+
+ See https://github.com/Pylons/pyramid/pull/1641 and
+ https://github.com/Pylons/pyramid/pull/2120
+
+- The ``principal`` argument to :func:`pyramid.security.remember` was renamed
+ to ``userid``. Using ``principal`` as the argument name still works and will
+ continue to work for the next few releases, but a deprecation warning is
+ printed.
+
+
+Scaffolding Enhancements
+------------------------
+
+- Added line numbers to the log formatters in the scaffolds to assist with
+ debugging. See https://github.com/Pylons/pyramid/pull/1326
+
+- Updated scaffold generating machinery to return the version of :app:`Pyramid`
+ and its documentation for use in scaffolds. Updated ``starter``, ``alchemy``
+ and ``zodb`` templates to have links to correctly versioned documentation,
+ and to reflect which :app:`Pyramid` was used to generate the scaffold.
+
+- Removed non-ASCII copyright symbol from templates, as this was causing the
+ scaffolds to fail for project generation.
+
+
+Documentation Enhancements
+--------------------------
+
+- Removed logging configuration from Quick Tutorial ``ini`` files, except for
+ scaffolding- and logging-related chapters, to avoid needing to explain it too
+ early.
+
+- Improve and clarify the documentation on what :app:`Pyramid` defines as a
+ ``principal`` and a ``userid`` in its security APIs. See
+ https://github.com/Pylons/pyramid/pull/1399
+
+- Moved the documentation for ``accept`` on
+ :meth:`pyramid.config.Configurator.add_view` to no longer be part of the
+ predicate list. See https://github.com/Pylons/pyramid/issues/1391 for a bug
+ report stating ``not_`` was failing on ``accept``. Discussion with @mcdonc
+ led to the conclusion that it should not be documented as a predicate.
+ See https://github.com/Pylons/pyramid/pull/1487 for this PR.
+
+- Clarify a previously-implied detail of the ``ISession.invalidate`` API
+ documentation.
+
+- Add documentation of command line programs (``p*`` scripts). See
+ https://github.com/Pylons/pyramid/pull/2191