summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2013-08-20 10:15:49 -0400
committerChris McDonough <chrism@plope.com>2013-08-20 10:15:49 -0400
commit70dbf740b5b3500edbcc4b2dff376f43e6250d79 (patch)
tree4bd5335585247a0cc8154149a6c6765fabf10075 /docs
parent0d37d81949bc82de1bd9c1193f282909f9576c3a (diff)
parente64e71523d70261b551ba41f13f389ebf1324f1b (diff)
downloadpyramid-70dbf740b5b3500edbcc4b2dff376f43e6250d79.tar.gz
pyramid-70dbf740b5b3500edbcc4b2dff376f43e6250d79.tar.bz2
pyramid-70dbf740b5b3500edbcc4b2dff376f43e6250d79.zip
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs')
m---------docs/_themes0
-rw-r--r--docs/authorintro.rst2
-rw-r--r--docs/conf.py29
-rw-r--r--docs/copyright.rst2
-rw-r--r--docs/designdefense.rst5
-rw-r--r--docs/glossary.rst4
-rw-r--r--docs/index.rst102
-rw-r--r--docs/latexindex.rst16
-rw-r--r--docs/narr/MyProject/myproject/templates/mytemplate.pt4
-rw-r--r--docs/narr/commandline.rst6
-rw-r--r--docs/narr/events.rst6
-rw-r--r--docs/narr/extconfig.rst4
-rw-r--r--docs/narr/hooks.rst4
-rw-r--r--docs/narr/install.rst350
-rw-r--r--docs/narr/project.rst6
-rw-r--r--docs/narr/sessions.rst2
-rw-r--r--docs/narr/templates.rst4
-rw-r--r--docs/narr/viewconfig.rst2
-rw-r--r--docs/narr/webob.rst2
-rw-r--r--docs/quick_tour.rst860
-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.mobin0 -> 460 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.mobin0 -> 461 bytes
-rw-r--r--docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.po21
-rw-r--r--docs/quick_tour/awesome/awesome/models.py8
-rw-r--r--docs/quick_tour/awesome/awesome/static/favicon.icobin0 -> 1406 bytes
-rw-r--r--docs/quick_tour/awesome/awesome/static/logo.pngbin0 -> 6641 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.cfg28
-rw-r--r--docs/quick_tour/awesome/setup.py36
-rw-r--r--docs/quick_tour/hello_world/app.py16
-rw-r--r--docs/quick_tour/jinja2/app.py11
-rw-r--r--docs/quick_tour/jinja2/hello_world.jinja28
-rw-r--r--docs/quick_tour/jinja2/views.py8
-rw-r--r--docs/quick_tour/json/app.py15
-rw-r--r--docs/quick_tour/json/hello_world.jinja210
-rw-r--r--docs/quick_tour/json/hello_world.pt17
-rw-r--r--docs/quick_tour/json/views.py13
-rw-r--r--docs/quick_tour/package/CHANGES.txt4
-rw-r--r--docs/quick_tour/package/MANIFEST.in2
-rw-r--r--docs/quick_tour/package/README.txt4
-rw-r--r--docs/quick_tour/package/development.ini54
-rw-r--r--docs/quick_tour/package/hello_world/__init__.py34
-rw-r--r--docs/quick_tour/package/hello_world/init.py34
-rw-r--r--docs/quick_tour/package/hello_world/locale/de/LC_MESSAGES/hello_world.mobin0 -> 460 bytes
-rw-r--r--docs/quick_tour/package/hello_world/locale/de/LC_MESSAGES/hello_world.po21
-rw-r--r--docs/quick_tour/package/hello_world/locale/fr/LC_MESSAGES/hello_world.mobin0 -> 461 bytes
-rw-r--r--docs/quick_tour/package/hello_world/locale/fr/LC_MESSAGES/hello_world.po21
-rw-r--r--docs/quick_tour/package/hello_world/locale/hello_world.pot21
-rw-r--r--docs/quick_tour/package/hello_world/models.py8
-rw-r--r--docs/quick_tour/package/hello_world/static/favicon.icobin0 -> 1406 bytes
-rw-r--r--docs/quick_tour/package/hello_world/static/logo.pngbin0 -> 6641 bytes
-rw-r--r--docs/quick_tour/package/hello_world/static/pylons.css73
-rw-r--r--docs/quick_tour/package/hello_world/templates/mytemplate.jinja290
-rw-r--r--docs/quick_tour/package/hello_world/tests.py20
-rw-r--r--docs/quick_tour/package/hello_world/views.py22
-rw-r--r--docs/quick_tour/package/message-extraction.ini3
-rw-r--r--docs/quick_tour/package/setup.cfg28
-rw-r--r--docs/quick_tour/package/setup.py41
-rw-r--r--docs/quick_tour/requests/app.py24
-rw-r--r--docs/quick_tour/routing/app.py12
-rw-r--r--docs/quick_tour/routing/views.py10
-rw-r--r--docs/quick_tour/sqla_demo/CHANGES.txt4
-rw-r--r--docs/quick_tour/sqla_demo/MANIFEST.in2
-rw-r--r--docs/quick_tour/sqla_demo/README.txt14
-rw-r--r--docs/quick_tour/sqla_demo/development.ini71
-rw-r--r--docs/quick_tour/sqla_demo/production.ini62
-rw-r--r--docs/quick_tour/sqla_demo/setup.cfg27
-rw-r--r--docs/quick_tour/sqla_demo/setup.py44
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo.sqlitebin0 -> 3072 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/__init__.py20
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/models.py29
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/scripts/__init__.py1
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/scripts/initializedb.py37
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/favicon.icobin0 -> 1406 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/footerbg.pngbin0 -> 333 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/headerbg.pngbin0 -> 203 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/ie6.css8
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/middlebg.pngbin0 -> 2797 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/pylons.css372
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/pyramid-small.pngbin0 -> 7044 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/pyramid.pngbin0 -> 33055 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/static/transparent.gifbin0 -> 49 bytes
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/templates/mytemplate.pt76
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/tests.py33
-rw-r--r--docs/quick_tour/sqla_demo/sqla_demo/views.py37
-rw-r--r--docs/quick_tour/static_assets/app.py14
-rw-r--r--docs/quick_tour/static_assets/hello_world.jinja210
-rw-r--r--docs/quick_tour/static_assets/hello_world.pt16
-rw-r--r--docs/quick_tour/static_assets/static/app.css4
-rw-r--r--docs/quick_tour/static_assets/views.py6
-rw-r--r--docs/quick_tour/templating/app.py10
-rw-r--r--docs/quick_tour/templating/hello_world.pt9
-rw-r--r--docs/quick_tour/templating/views.py8
-rw-r--r--docs/quick_tour/view_classes/app.py13
-rw-r--r--docs/quick_tour/view_classes/delete.jinja29
-rw-r--r--docs/quick_tour/view_classes/edit.jinja29
-rw-r--r--docs/quick_tour/view_classes/hello.jinja217
-rw-r--r--docs/quick_tour/view_classes/views.py32
-rw-r--r--docs/quick_tour/views/app.py13
-rw-r--r--docs/quick_tour/views/views.py29
-rw-r--r--docs/tutorials/bfg/index.rst2
-rw-r--r--docs/tutorials/modwsgi/index.rst2
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/tutorials/wiki2/installation.rst6
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt4
-rw-r--r--docs/whatsnew-1.5.rst9
125 files changed, 3196 insertions, 340 deletions
diff --git a/docs/_themes b/docs/_themes
-Subproject 8673c4a14f192c15f1949dc9862821e60f31604
+Subproject a181b85d4ca08fa109ee2786d4f1b5b17e9b458
diff --git a/docs/authorintro.rst b/docs/authorintro.rst
index b3cd68494..ebc6bcff8 100644
--- a/docs/authorintro.rst
+++ b/docs/authorintro.rst
@@ -2,7 +2,7 @@
Author Introduction
=====================
-Welcome to "The :app:`Pyramid` Web Application Framework". In this
+Welcome to "The :app:`Pyramid` Web Framework". In this
introduction, I'll describe the audience for this book, I'll describe
the book content, I'll provide some context regarding the genesis of
:app:`Pyramid`, and I'll thank some important people.
diff --git a/docs/conf.py b/docs/conf.py
index e50c0c60a..a7a4a441a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -57,10 +57,25 @@ extensions = [
# Looks for objects in external projects
intersphinx_mapping = {
+ 'tutorials': ('http://docs.pylonsproject.org/projects/pyramid_tutorials/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),
+ 'beaker': (
+ 'http://docs.pylonsproject.org/projects/pyramid_beaker/en/latest',
+ None),
'who': ('http://docs.repoze.org/who/latest', None),
'python': ('http://docs.python.org', None),
'python3': ('http://docs.python.org/3', None),
@@ -87,7 +102,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General substitutions.
-project = 'The Pyramid Web Application Development Framework'
+project = 'The Pyramid Web Framework'
thisyear = datetime.datetime.now().year
copyright = '2008-%s, Agendaless Consulting' % thisyear
@@ -181,7 +196,7 @@ html_theme_options = dict(
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
-html_title = 'The Pyramid Web Application Development Framework v%s' % release
+html_title = 'The Pyramid Web Framework v%s' % release
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = 'Home'
@@ -206,7 +221,7 @@ html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-#html_use_smartypants = True
+html_use_smartypants = False # people use cutnpaste in some places
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
@@ -253,7 +268,7 @@ latex_additional_files = ['_static/latex-note.png', '_static/latex-warning.png']
# (source start file, target name, title, author, document class [howto/manual]).
latex_documents = [
('latexindex', 'pyramid.tex',
- 'The Pyramid Web Application Development Framework',
+ 'The Pyramid Web Framework',
'Chris McDonough', 'manual'),
]
@@ -388,7 +403,7 @@ latex_elements = {
'wrapperclass': 'book',
'date': '',
'releasename': 'Version',
- 'title': r'The Pyramid Web Application \newline Development Framework',
+ 'title': r'The Pyramid Web Framework',
# 'pointsize':'12pt', # uncomment for 12pt version
}
@@ -493,7 +508,7 @@ def resig(app, what, name, obj, options, signature, return_annotation):
# -- Options for Epub output ---------------------------------------------------
# Bibliographic Dublin Core info.
-epub_title = 'The Pyramid Web Application Development Framework, Version %s' \
+epub_title = 'The Pyramid Web Framework, Version %s' \
% release
epub_author = 'Chris McDonough'
epub_publisher = 'Agendaless Consulting'
@@ -511,7 +526,7 @@ epub_scheme = 'ISBN'
epub_identifier = '0615445675'
# A unique identification for the text.
-epub_uid = 'The Pyramid Web Application Development Framework, Version %s' \
+epub_uid = 'The Pyramid Web Framework, Version %s' \
% release
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
diff --git a/docs/copyright.rst b/docs/copyright.rst
index 8f3a5f5e7..980335827 100644
--- a/docs/copyright.rst
+++ b/docs/copyright.rst
@@ -1,7 +1,7 @@
Copyright, Trademarks, and Attributions
=======================================
-*The Pyramid Web Application Development Framework, Version 1.1*
+*The Pyramid Web Framework, Version 1.1*
by Chris McDonough
diff --git a/docs/designdefense.rst b/docs/designdefense.rst
index ea46053a0..cebcf6218 100644
--- a/docs/designdefense.rst
+++ b/docs/designdefense.rst
@@ -1295,6 +1295,9 @@ predictability.
a registry in another module. This has the effect that
double-registrations will never be performed.
+
+.. _routes_need_ordering:
+
Routes Need Relative Ordering
+++++++++++++++++++++++++++++
@@ -1458,7 +1461,7 @@ code below:
def afunc():
for i in range(10):
- print i
+ 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
diff --git a/docs/glossary.rst b/docs/glossary.rst
index abc37c7f8..8ade889a3 100644
--- a/docs/glossary.rst
+++ b/docs/glossary.rst
@@ -1018,3 +1018,7 @@ Glossary
system. See :ref:`registering_thirdparty_predicates` for more
information.
+ add-on
+ A Python :term:`distribution` that uses Pyramid's extensibility
+ to plug into a Pyramid application and provide extra,
+ configurable services. \ No newline at end of file
diff --git a/docs/index.rst b/docs/index.rst
index 5dfbbce1e..d2a0008a8 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,11 +1,11 @@
.. _index:
-=================================================
-The Pyramid Web Application Development Framework
-=================================================
+=========================
+The Pyramid Web Framework
+=========================
-:app:`Pyramid` is a small, fast, down-to-earth Python web application
-development framework. It is developed as part of the `Pylons Project
+: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>`_.
@@ -31,18 +31,37 @@ Front Matter
copyright.rst
conventions.rst
-What's New
-==========
+.. _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.
.. toctree::
- :maxdepth: 1
+ :hidden:
+
+ quick_tour
+
+* :doc:`quick_tour` goes through the major features in Pyramid, covering
+ a little about a lot.
+
+* To see a minimal Pyramid web application, check out
+ :ref:`firstapp_chapter`.
+
+* For help getting Pyramid set up, try
+ :ref:`installing_chapter`.
+
+* 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>`.
+
+* Need help? See :ref:`Support and
+ Development <support-and-development>`.
- whatsnew-1.5
- whatsnew-1.4
- whatsnew-1.3
- whatsnew-1.2
- whatsnew-1.1
- whatsnew-1.0
.. _html_narrative_documentation:
@@ -110,6 +129,8 @@ platforms.
tutorials/bfg/index.rst
tutorials/modwsgi/index.rst
+.. _html_api_documentation:
+
API Documentation
=================
@@ -127,6 +148,12 @@ Change History
.. toctree::
:maxdepth: 1
+ whatsnew-1.5
+ whatsnew-1.4
+ whatsnew-1.3
+ whatsnew-1.2
+ whatsnew-1.1
+ whatsnew-1.0
changes
Design Documents
@@ -137,51 +164,7 @@ Design Documents
designdefense
-Sample Applications
-===================
-
-.. note::
-
- These applications run only on Python 2.x, and so do some of their
- dependencies.
-
-`cluegun <https://github.com/Pylons/cluegun>`_ is a simple pastebin
-application based on Rocky Burt's `ClueBin
-<http://pypi.python.org/pypi/ClueBin/0.2.3>`_. It demonstrates form
-processing, security, and the use of :term:`ZODB` within a :app:`Pyramid`
-application. Check this application out via:
-
-.. code-block:: text
-
- git clone git://github.com/Pylons/cluegun.git
-
-`virginia <https://github.com/Pylons/virginia>`_ is a very simple dynamic
-file rendering application. It is willing to render structured text
-documents, HTML documents, and images from a filesystem directory.
-It's also a good example of :term:`traversal`. An
-earlier version of this application runs the `repoze.org
-<http://repoze.org>`_ website. Check this application out via:
-
-.. code-block:: text
-
- git clone git://github.com/Pylons/virginia.git
-
-`shootout <https://github.com/Pylons/shootout>`_ is an example "idea
-competition" application by Carlos de la Guardia and Lukasz Fidosz. It
-demonstrates :term:`URL dispatch`, simple authentication, integration
-with `SQLAlchemy <http://www.sqlalchemy.org/>`_ and ``pyramid_simpleform``.
-Check this application out of version control via:
-
-.. code-block:: text
-
- git clone git://github.com/Pylons/shootout.git
-
-`KARL <http://karlproject.org>`_ is a moderately-sized application (roughly
-80K lines of Python code) built on top of :app:`Pyramid`. It is an open
-source web system for collaboration, organizational intranets, and knowledge
-management. It provides facilities for wikis, calendars, manuals, searching,
-tagging, commenting, and file uploads. See the `KARL site
-<http://karlproject.org>`_ for download and installation details.
+.. _support-and-development:
Support and Development
=======================
@@ -216,6 +199,7 @@ Index and Glossary
* :ref:`genindex`
* :ref:`search`
+
.. toctree::
:hidden:
diff --git a/docs/latexindex.rst b/docs/latexindex.rst
index e2ba108ee..eb14f5076 100644
--- a/docs/latexindex.rst
+++ b/docs/latexindex.rst
@@ -2,14 +2,14 @@
.. _latexindex:
-=================================================
-The Pyramid Web Application Development Framework
-=================================================
+=========================
+The Pyramid Web Framework
+=========================
.. frontmatter::
Front Matter
-============
+@@@@@@@@@@@@
.. toctree::
:maxdepth: 1
@@ -23,7 +23,7 @@ Front Matter
.. _narrative_documentation:
Narrative Documentation
-=======================
+@@@@@@@@@@@@@@@@@@@@@@@
.. toctree::
:maxdepth: 1
@@ -71,7 +71,7 @@ Narrative Documentation
.. _tutorials:
Tutorials
-=========
+@@@@@@@@@
.. toctree::
:maxdepth: 1
@@ -84,7 +84,7 @@ Tutorials
.. _api_documentation:
API Documentation
-=================
+@@@@@@@@@@@@@@@@@
.. toctree::
:maxdepth: 1
@@ -95,7 +95,7 @@ API Documentation
.. backmatter::
Glossary and Index
-==================
+@@@@@@@@@@@@@@@@@@
.. toctree::
:maxdepth: 1
diff --git a/docs/narr/MyProject/myproject/templates/mytemplate.pt b/docs/narr/MyProject/myproject/templates/mytemplate.pt
index 0bfac946e..0fccba624 100644
--- a/docs/narr/MyProject/myproject/templates/mytemplate.pt
+++ b/docs/narr/MyProject/myproject/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/narr/commandline.rst b/docs/narr/commandline.rst
index 17e5227fa..58b9bdd21 100644
--- a/docs/narr/commandline.rst
+++ b/docs/narr/commandline.rst
@@ -538,7 +538,7 @@ representing Pyramid your application configuration as a single argument:
from pyramid.paster import bootstrap
env = bootstrap('/path/to/my/development.ini')
- print env['request'].route_url('home')
+ print(env['request'].route_url('home'))
:func:`pyramid.paster.bootstrap` returns a dictionary containing
framework-related information. This dictionary will always contain a
@@ -606,7 +606,7 @@ to load instead of ``main``:
from pyramid.paster import bootstrap
env = bootstrap('/path/to/my/development.ini#another')
- print env['request'].route_url('home')
+ print(env['request'].route_url('home'))
The above example specifies the ``another`` ``app``, ``pipeline``, or
``composite`` section of your PasteDeploy configuration file. The ``app``
@@ -643,7 +643,7 @@ the desired request and passing it into :func:`~pyramid.paster.bootstrap`:
request = Request.blank('/', base_url='https://example.com/prefix')
env = bootstrap('/path/to/my/development.ini#another', request=request)
- print env['request'].application_url
+ print(env['request'].application_url)
# will print 'https://example.com/prefix'
Now you can readily use Pyramid's APIs for generating URLs:
diff --git a/docs/narr/events.rst b/docs/narr/events.rst
index 11af89ca6..2accb3dbe 100644
--- a/docs/narr/events.rst
+++ b/docs/narr/events.rst
@@ -26,7 +26,7 @@ subscriber is a function that accepts a single argument named `event`:
:linenos:
def mysubscriber(event):
- print event
+ print(event)
The above is a subscriber that simply prints the event to the console
when it's called.
@@ -113,10 +113,10 @@ your application like so:
:linenos:
def handle_new_request(event):
- print 'request', event.request
+ print('request', event.request)
def handle_new_response(event):
- print 'response', event.response
+ 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
diff --git a/docs/narr/extconfig.rst b/docs/narr/extconfig.rst
index 659056952..6587aef92 100644
--- a/docs/narr/extconfig.rst
+++ b/docs/narr/extconfig.rst
@@ -55,7 +55,7 @@ method of the Configurator:
:linenos:
def mysubscriber(event):
- print event.request
+ print(event.request)
config.add_newrequest_subscriber(mysubscriber)
@@ -79,7 +79,7 @@ able to install it and subsequently do:
:linenos:
def mysubscriber(event):
- print event.request
+ print(event.request)
from pyramid.config import Configurator
config = Configurator()
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index 37a74b53a..3a2568775 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -291,7 +291,7 @@ actually execute the function until accessed.
return sum(args)
def prop(request):
- print "getting the property"
+ print("getting the property")
return "the property"
config = Configurator()
@@ -332,7 +332,7 @@ Here is an example of passing a class to ``Configurator.add_request_method``:
# use @property if you don't want to cache the result
@reify
def prop(self):
- print "getting the property"
+ print("getting the property")
return "the property"
config = Configurator()
diff --git a/docs/narr/install.rst b/docs/narr/install.rst
index 8fc63f3a4..fb67b899b 100644
--- a/docs/narr/install.rst
+++ b/docs/narr/install.rst
@@ -9,49 +9,50 @@ Installing :app:`Pyramid`
Before You Install
------------------
-You will need `Python <http://python.org>`_ version 2.6 or better to
-run :app:`Pyramid`.
+You will need `Python <http://python.org>`_ version 2.6 or better to run
+:app:`Pyramid`.
.. sidebar:: Python Versions
- As of this writing, :app:`Pyramid` has been tested under Python 2.6,
- Python 2.7, Python 3.2, and Python 3.3. :app:`Pyramid` does not
- run under any version of Python before 2.6.
+ As of this writing, :app:`Pyramid` has been tested under Python 2.6, Python
+ 2.7, Python 3.2, and Python 3.3. :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 on :term:`PyPy` (1.9+).
+: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
+on :term:`PyPy` (1.9+).
-:app:`Pyramid` installation does not require the compilation of any
-C code, so you need only a Python interpreter that meets the
-requirements mentioned.
+:app:`Pyramid` installation does not require the compilation of any C code, so
+you need only a Python interpreter that meets the requirements mentioned.
For Mac OS X Users
~~~~~~~~~~~~~~~~~~
From `Python.org <http://python.org/download/mac/>`_:
- Python comes pre-installed on Mac OS X, but due to Apple's release
- cycle, it's often one or even two years old. The overwhelming
- recommendation of the "MacPython" community is to upgrade your
- Python by downloading and installing a newer version from
- `the Python standard release page <http://python.org/download/releases/>`_.
+ Python comes pre-installed on Mac OS X, but due to Apple's release cycle,
+ it's often one or even two years old. The overwhelming recommendation of
+ the "MacPython" community is to upgrade your Python by downloading and
+ installing a newer version from `the Python standard release page
+ <http://python.org/download/releases/>`_.
-It is recommended to download one of the *installer* versions, unless you prefer to install your Python through a packgage manager (e.g., macports or homebrew) or to build your Python from source.
+It is recommended to download one of the *installer* versions, unless you
+prefer to install your Python through a packgage manager (e.g., macports or
+homebrew) or to build your Python from source.
-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.
+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.
-If you use an installer for your Python, then you can skip to the
-section :ref:`installing_unix`.
+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 your system doesn't have a Python interpreter, and you're on UNIX,
-you can either install Python using your operating system's package
-manager *or* you can install Python from source fairly easily on any
-UNIX system that has development tools.
+If your system doesn't have a Python interpreter, and you're on UNIX, you can
+either install Python using your operating system's package manager *or* you
+can install Python from source fairly easily on any UNIX system that has
+development tools.
.. index::
pair: install; Python (from package, UNIX)
@@ -59,9 +60,8 @@ UNIX system that has development tools.
Package Manager Method
++++++++++++++++++++++
-You can use your system's "package manager" to install Python.
-Each package manager is slightly different, but the "flavor" of
-them is usually the same.
+You can use your system's "package manager" to install Python. Each package
+manager is slightly different, but the "flavor" of them is usually the same.
For example, on a Debian or Ubuntu system, use the following command:
@@ -82,28 +82,27 @@ invokable via ``python2.7`` from a shell prompt.
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. 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
+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.
+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. Often these can be installed via the package
-manager. For example, this works to do so on an Ubuntu Linux system:
+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:
.. code-block:: text
$ sudo apt-get install build-essential
-On Mac OS X, installing `XCode
-<http://developer.apple.com/tools/xcode/>`_ has much the same effect.
+On Mac OS X, installing `XCode <http://developer.apple.com/tools/xcode/>`_ has
+much the same effect.
-Once you've got development tools installed on your system, you can
-install a Python 2.7 interpreter from *source*, on the same system,
-using the following commands:
+Once you've got development tools installed on your system, you can install a
+Python 2.7 interpreter from *source*, on the same system, using the following
+commands:
.. code-block:: text
@@ -117,9 +116,8 @@ using the following commands:
$ ./configure --prefix=$HOME/opt/Python-2.7.3
$ make && make install
-Once these steps are performed, the Python interpreter will be
-invokable via ``$HOME/opt/Python-2.7.3/bin/python`` from a shell
-prompt.
+Once these steps are performed, the Python interpreter will be invokable via
+``$HOME/opt/Python-2.7.3/bin/python`` from a shell prompt.
.. index::
pair: install; Python (from package, Windows)
@@ -127,24 +125,21 @@ prompt.
If You Don't Yet Have A Python Interpreter (Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If your Windows system doesn't have a Python interpreter, you'll need
-to install it by downloading a Python 2.7-series interpreter
-executable from `python.org's download section
-<http://python.org/download/>`_ (the files labeled "Windows
-Installer"). Once you've downloaded it, double click on the
-executable and accept the defaults during the installation process.
-You may also need to download and install the `Python for Windows
-extensions <http://sourceforge.net/projects/pywin32/files/>`_.
+If your Windows system doesn't have a Python interpreter, you'll need to
+install it by downloading a Python 2.7-series interpreter executable from
+`python.org's download section <http://python.org/download/>`_ (the files
+labeled "Windows Installer"). Once you've downloaded it, double click on the
+executable and accept the defaults during the installation process. You may
+also need to download and install the Python for Windows extensions.
.. warning::
- After you install Python on Windows, you may need to add the
- ``C:\Python27`` directory to your environment's ``Path`` in order
- to make it possible to invoke Python from a command prompt by
- typing ``python``. To do so, right click ``My Computer``, select
- ``Properties`` --> ``Advanced Tab`` --> ``Environment Variables``
- and add that directory to the end of the ``Path`` environment
- variable.
+ After you install Python on Windows, you may need to add the ``C:\Python27``
+ directory to your environment's ``Path`` in order to make it possible to
+ invoke Python from a command prompt by typing ``python``. To do so, right
+ click ``My Computer``, select ``Properties`` --> ``Advanced Tab`` -->
+ ``Environment Variables`` and add that directory to the end of the ``Path``
+ environment variable.
.. index::
single: installing on UNIX
@@ -154,27 +149,26 @@ extensions <http://sourceforge.net/projects/pywin32/files/>`_.
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 installed in your Python version. This can be
-done by using the :term:`virtualenv` package. Using a virtualenv will
-also prevent :app:`Pyramid` from globally installing versions of
-packages that are not compatible with your system Python.
+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
+installed in your Python version. This can be done by using the
+:term:`virtualenv` package. Using a virtualenv will also prevent
+:app:`Pyramid` from globally installing versions of packages that are not
+compatible with your system Python.
To set up a virtualenv in which to install :app:`Pyramid`, first ensure that
-:term:`setuptools` or :term:`distribute` is installed. To do so, invoke
-``import setuptools`` within the Python interpreter you'd like to run
-:app:`Pyramid` under.
+:term:`setuptools` is installed. To do so, invoke ``import setuptools`` within
+the Python interpreter you'd like to run :app:`Pyramid` under.
-The following command will not display anything if setuptools or distribute is
-already installed:
+The following command will not display anything if setuptools is already
+installed:
.. code-block:: text
$ python2.7 -c 'import setuptools'
-Running the same command will yield the following output if setuptools or
-distribute is not yet installed:
+Running the same command will yield the following output if setuptools is not
+yet installed:
.. code-block:: text
@@ -183,62 +177,35 @@ distribute is not yet installed:
ImportError: No module named setuptools
If ``import setuptools`` raises an :exc:`ImportError` as it does above, you
-will need to install setuptools or distribute manually.
+will need to install setuptools manually.
If you are using a "system" Python (one installed by your OS distributor or a
-3rd-party packager such as Fink or MacPorts), you can usually install the
-setuptools or distribute package by using your system's package manager. If
-you cannot do this, or if you're using a self-installed version of Python,
-you will need to install setuptools or distribute "by hand". Installing
-setuptools or distribute "by hand" is always a reasonable thing to do, even
-if your package manager already has a pre-chewed version of setuptools for
-installation.
+third-party packager such as Fink or MacPorts), you can usually install the
+setuptools package by using your system's package manager. If you cannot do
+this, or if you're using a self-installed version of Python, you will need to
+install setuptools "by hand". Installing setuptools "by hand" is always a
+reasonable thing to do, even if your package manager already has a pre-chewed
+version of setuptools for installation.
-If you're using Python 2, you'll want to install ``setuptools``. If you're
-using Python 3, you'll want to install ``distribute``. Below we tell you how
-to do both.
-
-Installing Setuptools On Python 2
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Installing Setuptools
+~~~~~~~~~~~~~~~~~~~~~
To install setuptools by hand under Python 2, first download `ez_setup.py
-<http://peak.telecommunity.com/dist/ez_setup.py>`_ then invoke it using the
-Python interpreter into which you want to install setuptools.
+<https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py>`_ then invoke
+it using the Python interpreter into which you want to install setuptools.
.. code-block:: text
$ python ez_setup.py
-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:
-
-.. code-block:: text
-
- $ sudo python ez_setup.py
-
-Installing Distribute On Python 3
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-``setuptools`` doesn't work under Python 3. Instead, you can use
-``distribute``, which is a fork of setuptools. To
-install it, first download `distribute_setup.py
-<http://python-distribute.org/distribute_setup.py>`_ then invoke it using the
-Python interpreter into which you want to install setuptools.
-
-.. code-block:: text
-
- $ python3 distribute_setup.py
-
-Once this command is invoked, distribute 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:
.. code-block:: text
- $ sudo python3 distribute_setup.py
+ $ sudo python ez_setup.py
.. index::
pair: install; virtualenv
@@ -246,9 +213,9 @@ remediate this, you may need to do:
Installing the ``virtualenv`` Package
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Once you've got setuptools or distribute installed, you should install the
-:term:`virtualenv` package. To install the :term:`virtualenv` package into
-your setuptools-enabled Python interpreter, use the ``easy_install`` command.
+Once you've got setuptools installed, you should install the :term:`virtualenv`
+package. To install the :term:`virtualenv` package into your
+setuptools-enabled Python interpreter, use the ``easy_install`` command.
.. warning::
@@ -261,16 +228,16 @@ your setuptools-enabled Python interpreter, use the ``easy_install`` command.
Turing-complete.
If you insist on using ``pyvenv``, you'll need to understand how to install
- software such as ``distribute`` into the virtual environment manually,
- which this guide does not cover.
+ software such as ``setuptools`` into the virtual environment manually, which
+ this guide does not cover.
.. code-block:: text
$ easy_install virtualenv
This command should succeed, and tell you that the virtualenv package is now
-installed. If it fails due to permission errors, you may need to install it
-as your system's administrative user. For example:
+installed. If it fails due to permission errors, you may need to install it as
+your system's administrative user. For example:
.. code-block:: text
@@ -289,36 +256,34 @@ you can then create a virtual environment. To do so, invoke the following:
.. code-block:: text
$ export VENV=~/env
- $ virtualenv --no-site-packages $VENV
+ $ virtualenv $VENV
New python executable in /home/foo/env/bin/python
Installing setuptools.............done.
-You can either follow the use of the environment variable, ``$VENV``,
-or replace it with the root directory of the :term:`virtualenv`.
-In that case, the `export` command can be skipped.
-If you choose the former approach, ensure that it's an absolute path.
+You can either follow the use of the environment variable, ``$VENV``, or
+replace it with the root directory of the :term:`virtualenv`. In that case, the
+`export` command can be skipped. If you choose the former approach, ensure that
+it's an absolute path.
.. warning::
- Using ``--no-site-packages`` when generating your
- virtualenv is *very important*. This flag provides the necessary
- isolation for running the set of packages required by
- :app:`Pyramid`. If you do not specify ``--no-site-packages``,
- it's possible that :app:`Pyramid` will not install properly into
- the virtualenv, or, even if it does, may not run properly,
- depending on the packages you've already got installed into your
- Python's "main" site-packages dir.
+ Avoid using the ``--system-site-packages`` option when creating the
+ virtualenv unless you know what you are doing. For versions of virtualenv
+ prior to 1.7, make sure to use the ``--no-site-packages`` option, because
+ this option was formerly not the default and may produce undesirable
+ results.
-.. warning:: *do not* use ``sudo`` to run the
- ``virtualenv`` script. It's perfectly acceptable (and desirable)
- to create a virtualenv as a normal user.
+.. warning::
+
+ *do not* use ``sudo`` to run the ``virtualenv`` script. It's perfectly
+ acceptable (and desirable) to create a virtualenv as a normal user.
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:
+After you've got your virtualenv installed, you may install :app:`Pyramid`
+itself using the following commands:
.. code-block:: text
@@ -335,91 +300,39 @@ complete, as it downloads and installs a number of dependencies.
Installing :app:`Pyramid` on a Windows System
-------------------------------------------------
-You can use Pyramid on Windows under Python 2 or under Python 3. Directions
-for both versions are included below.
-
-Windows Using Python 2
-~~~~~~~~~~~~~~~~~~~~~~
+You can use Pyramid on Windows under Python 2 or 3.
-#. Install the most recent `Python 2.7.x version
+#. Download and install the most recent `Python 2.7.x or 3.3.x version
<http://www.python.org/download/>`_ for your system.
-#. Install the `Python for Windows extensions
- <http://sourceforge.net/projects/pywin32/files/>`_. Make sure to
- pick the right download for Python 2.7 and install it using the
- same Python installation from the previous step.
+#. Download and install the `Python for Windows extensions
+ <http://sourceforge.net/projects/pywin32/files/pywin32/>`_. Carefully read
+ the README.txt file at the end of the list of builds, and follow its
+ directions. Make sure you get the proper 32- or 64-bit build and Python
+ version.
-#. Install latest :term:`setuptools` distribution into the Python you
- obtained/installed/found in the step above: download `ez_setup.py
- <http://peak.telecommunity.com/dist/ez_setup.py>`_ and run it using
- the ``python`` interpreter of your Python 2.7 installation using a
- command prompt:
+#. Install latest :term:`setuptools` distribution into the Python from step 1
+ above: download `ez_setup.py
+ <https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py>`_ and run
+ it using the ``python`` interpreter of your Python 2.7 or 3.3 installation
+ using a command prompt:
.. code-block:: text
+ # modify the command according to the python version, e.g.:
+ # for Python 2.7:
c:\> c:\Python27\python ez_setup.py
+ # for Python 3.3:
+ c:\> c:\Python33\python ez_setup.py
#. Install `virtualenv`:
.. code-block:: text
- c:\> c:\Python27\Scripts\easy_install virtualenv
-
-#. Make a :term:`virtualenv` workspace:
-
- .. code-block:: text
-
- c:\> set VENV=c:\env
- c:\> c:\Python27\Scripts\virtualenv --no-site-packages %VENV%
-
- You can either follow the use of the environment variable, ``%VENV%``,
- or replace it with the root directory of the :term:`virtualenv`.
- In that case, the `set` command can be skipped.
- If you choose the former approach, ensure that it's an absolute path.
-
-#. (Optional) Consider using ``%VENV%\Scripts\activate.bat`` to make your shell
- environment wired to use the virtualenv.
-
-#. Use ``easy_install`` to get :app:`Pyramid` and its direct dependencies
- installed:
-
- .. code-block:: text
-
- c:\env> %VENV%\Scripts\easy_install pyramid
-
-Windows Using Python 3
-~~~~~~~~~~~~~~~~~~~~~~
-
-#. Install, or find the latest version of `Python 3.x
- <http://www.python.org/download/>`_ for your system and which is
- supported by Pyramid.
-
-#. Install the `Python for Windows extensions
- <http://sourceforge.net/projects/pywin32/files/>`_. Make sure to
- pick the right download for Python 3.x and install it using the
- same Python installation from the previous step.
-
-#. Install latest :term:`distribute` distribution into the Python you
- obtained/installed/found in the step above: download `distribute_setup.py
- <http://python-distribute.org/distribute_setup.py>`_ and run it using the
- ``python`` interpreter of your Python 3.x installation using a command
- prompt:
-
- .. code-block:: text
-
# modify the command according to the python version, e.g.:
- # for Python 3.2.x:
- c:\> c:\Python32\python distribute_setup.py
- # for Python 3.3.x:
- c:\> c:\Python33\python distribute_setup.py
-
-#. Install :term:`virtualenv`:
-
- .. code-block:: text
-
- # for Python 3.2.x:
- c:\> c:\Python32\Scripts\easy_install virtualenv
- # for Python 3.3.x:
+ # for Python 2.7:
+ c:\> c:\Python27\Scripts\easy_install virtualenv
+ # for Python 3.3:
c:\> c:\Python33\Scripts\easy_install virtualenv
#. Make a :term:`virtualenv` workspace:
@@ -427,15 +340,16 @@ Windows Using Python 3
.. code-block:: text
c:\> set VENV=c:\env
- # for Python 3.2.x:
- c:\> c:\Python32\Scripts\virtualenv --no-site-packages %VENV%
- # for Python 3.3.x:
- c:\> c:\Python33\Scripts\virtualenv --no-site-packages %VENV%
-
- You can either follow the use of the environment variable, ``%VENV%``,
- or replace it with the root directory of the :term:`virtualenv`.
- In that case, the `set` command can be skipped.
- If you choose the former approach, ensure that it's an absolute path.
+ # modify the command according to the python version, e.g.:
+ # for Python 2.7:
+ c:\> c:\Python27\Scripts\virtualenv %VENV%
+ # for Python 3.3:
+ c:\> c:\Python33\Scripts\virtualenv %VENV%
+
+ You can either follow the use of the environment variable, ``%VENV%``, or
+ replace it with the root directory of the :term:`virtualenv`. In that case,
+ the `set` command can be skipped. If you choose the former approach, ensure
+ that it's an absolute path.
#. (Optional) Consider using ``%VENV%\Scripts\activate.bat`` to make your shell
environment wired to use the virtualenv.
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index e25f3012a..52f13d5a8 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -49,9 +49,7 @@ The included scaffolds are these:
URL mapping via :term:`URL dispatch` and no persistence mechanism.
``zodb``
- URL mapping via :term:`traversal` and persistence via :term:`ZODB`. *Note
- that, as of this writing, this scaffold will not run under Python 3, only
- under Python 2.*
+ URL mapping via :term:`traversal` and persistence via :term:`ZODB`.
``alchemy``
URL mapping via :term:`URL dispatch` and persistence via
@@ -992,6 +990,8 @@ 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
-----------------------------
diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst
index 82440060c..358977089 100644
--- a/docs/narr/sessions.rst
+++ b/docs/narr/sessions.rst
@@ -188,6 +188,8 @@ implementation in the :mod:`pyramid.session` module as inspiration.
.. index::
single: flash messages
+.. _flash_messages:
+
Flash Messages
--------------
diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst
index af5ad6c5c..26bb6b6cd 100644
--- a/docs/narr/templates.rst
+++ b/docs/narr/templates.rst
@@ -616,6 +616,8 @@ extension so that these ``svn:ignore`` patterns work.
.. index::
pair: debugging; templates
+.. _debugging_templates:
+
Debugging Templates
-------------------
@@ -711,7 +713,7 @@ look like:
<h1 class="title">Welcome to <code>${project}</code>, an
application generated by the <a
href="http://docs.pylonsproject.org/projects/pyramid/current/"
- >pyramid</a> web application framework.</h1>
+ >pyramid</a> web framework.</h1>
</body>
</html>
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst
index 6a064c209..e09fd83ab 100644
--- a/docs/narr/viewconfig.rst
+++ b/docs/narr/viewconfig.rst
@@ -1005,6 +1005,8 @@ invoked as the result of the ``http_cache`` argument to view configuration.
.. index::
pair: view configuration; debugging
+.. _debugging_view_configuration:
+
Debugging View Configuration
----------------------------
diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst
index c0ca450b1..f0a4b5a0b 100644
--- a/docs/narr/webob.rst
+++ b/docs/narr/webob.rst
@@ -287,7 +287,7 @@ When such a request reaches a view in your application, the
@view_config(renderer='string')
def aview(request):
- print request.json_body
+ print(request.json_body)
return 'OK'
For the above view, printed to the console will be:
diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst
new file mode 100644
index 000000000..f75533220
--- /dev/null
+++ b/docs/quick_tour.rst
@@ -0,0 +1,860 @@
+.. _quick_tour:
+
+=====================
+Quick Tour of Pyramid
+=====================
+
+Pyramid lets you start small and finish big. This *Quick Tour* guide
+walks you through many of Pyramid's key features. Let's put the
+emphasis on *start* by doing a quick tour through Pyramid, with
+snippets of code to illustrate major concepts.
+
+.. note::
+
+ We use Python 3 in our samples. Pyramid was one of the first
+ (October 2011) web frameworks to fully support Python 3. You can
+ use Python 3 as well for this guide, but you can also use Python 2.7.
+
+Python Setup
+============
+
+First things first: we need our Python environment in ship-shape.
+Pyramid encourages standard Python development practices (virtual
+environments, packaging tools, logging, etc.) so let's get our working
+area in place. For Python 3.3:
+
+.. code-block:: bash
+
+ $ pyvenv-3.3 env33
+ $ source env33/bin/activate
+ $ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python
+
+If ``wget`` complains with a certificate error, run it with:
+
+.. code-block:: bash
+
+ $ wget --no-check-certificate
+
+In these steps above we first made a :term:`virtualenv` and then
+"activated" it, which adjusted our path to look first in
+``env33/bin`` for commands (such as ``python``). We next downloaded
+Python's packaging support and installed it, giving us the
+``easy_install`` command-line script for adding new packages. Python
+2.7 users will need to use ``virtualenv`` instead of ``pyvenv`` to make
+their virtual environment.
+
+.. 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.
+
+.. seealso:: See Also: Python 3's :mod:`venv module <python3:venv>`,
+ the ``setuptools`` `installation
+ instructions <https://pypi.python.org/pypi/setuptools/0.9.8#installation-instructions>`_,
+ `easy_install help <https://pypi.python.org/pypi/setuptools/0.9.8#using-setuptools-and-easyinstall>`_,
+ and Pyramid's :ref:`Before You Install <installing_chapter>`.
+
+Pyramid Installation
+====================
+
+We now have a standard starting point for Python. Getting Pyramid
+installed is easy:
+
+.. code-block:: bash
+
+ $ easy_install pyramid
+
+Our virtual environment now has the Pyramid software available to its
+Python.
+
+.. seealso:: See Also: :ref:`installing_unix`
+
+Hello World
+===========
+
+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:
+
+This simple example is easy to run. Save this as ``app.py`` and run it:
+
+.. code-block:: bash
+
+ $ python ./app.py
+
+Next, open `http://localhost:6543/ <http://localhost:6543/>`_ in a
+browser and you will see the ``Hello World!`` message.
+
+New to Python web programming? If so, some lines in module merit
+explanation:
+
+#. *Line 10*. The ``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 particular URL :term:`route`.
+
+#. *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*.
+
+.. seealso:: See Also: :ref:`firstapp_chapter` and
+ :ref:`Single File Tasks tutorial <tutorials:single-file-tutorial>`
+
+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.
+
+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>`.
+
+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::
+
+ URL http://localhost:6543/?name=alice with name: alice
+
+Finally, we set the response's content type and return the Response.
+
+.. seealso:: See Also: :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.
+
+So far our examples place everything in one file:
+
+- the view function
+
+- its registration with the configurator
+
+- the route to map it to a 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 setup
+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 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 shows issuing 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.
+
+.. seealso:: See Also: :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.
+
+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
+
+- 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.
+
+What if we want part of the URL to be available as data in my view? This
+route declaration:
+
+.. literalinclude:: quick_tour/routing/app.py
+ :start-after: Start Route 1
+ :end-before: End Route 1
+
+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
+
+``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: :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.
+
+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, Pyramid bundles Chameleon and Mako,
+so in this step, let's use Chameleon as an example:
+
+.. literalinclude:: quick_tour/templating/views.py
+ :start-after: Start View 1
+ :end-before: End View 1
+
+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
+supplied to our template:
+
+.. 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}``.
+
+.. seealso:: See Also: :doc:`../narr/templates`,
+ :ref:`debugging_templates`, and
+ :ref:`mako_templates`
+
+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:
+
+.. code-block:: bash
+
+ $ easy_install pyramid_jinja2
+
+With the package installed, we can include the template bindings into
+our configuration:
+
+.. code-block:: python
+
+ config.include('pyramid_jinja2')
+
+The only change in our view...point the renderer at the ``.jinja2`` file:
+
+.. literalinclude:: quick_tour/jinja2/views.py
+ :start-after: Start View 1
+ :end-before: End View 1
+
+Our Jinja2 template is very similar to our previous template:
+
+.. literalinclude:: quick_tour/jinja2/hello_world.jinja2
+ :language: jinja
+
+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.
+
+.. seealso:: See Also: `Jinja2 homepage <http://jinja.pocoo.org/>`_,
+ and
+ :ref:`pyramid_jinja2 Overview <jinja2:overview>`
+
+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
+:term:`configurator`:
+
+.. literalinclude:: quick_tour/static_assets/app.py
+ :start-after: Start Static 1
+ :end-before: End Static 1
+
+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.
+
+Next, make a directory ``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:
+
+.. literalinclude:: quick_tour/static_assets/hello_world.pt
+ :language: html
+ :start-after: Start Link 1
+ :end-before: End Link 1
+
+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
+web developer changes the arrangement on disk? Pyramid gives a helper
+that provides flexibility on URL generation:
+
+.. literalinclude:: quick_tour/static_assets/hello_world.pt
+ :language: html
+ :start-after: Start Link 2
+ :end-before: End Link 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
+gain refactoring flexibility later.
+
+.. seealso:: See Also: :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:
+
+.. literalinclude:: quick_tour/json/views.py
+ :start-after: Start View 1
+ :end-before: End View 2
+
+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.
+
+.. seealso:: See Also: :ref:`views_which_use_a_renderer`,
+ :ref:`json_renderer`, and
+ :ref:`adding_and_overriding_renderers`
+
+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:
+
+- Group views
+
+- Centralize some repetitive defaults
+
+- 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:
+
+.. literalinclude:: quick_tour/view_classes/views.py
+ :start-after: Start View 1
+ :end-before: End View 1
+
+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
+ ``@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.
+
+- 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 }}``.
+
+.. seealso:: See Also: :ref:`class_as_view`
+
+Quick Project Startup with Scaffolds
+====================================
+
+So far we have done all of our *Quick Glance* 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:
+
+.. code-block:: bash
+
+ $ pcreate --list
+ Available scaffolds:
+ alchemy: Pyramid SQLAlchemy project using url dispatch
+ 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:
+
+.. code-block:: bash
+
+ $ pcreate --scaffold pyramid_jinja2_starter hello_world
+
+We next use the normal Python development to setup 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:
+
+.. code-block:: bash
+
+ $ pserve development.ini
+
+Let's look at ``pserve`` and configuration in more depth.
+
+.. seealso:: See Also: :ref:`project_narr` and
+ :doc:`../narr/scaffolding`
+
+Application Running with ``pserve``
+===================================
+
+Prior to scaffolds, our project mixed a number of operations details
+into our code. Why should my main code care with 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.
+
+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.
+
+.. seealso:: See Also: :ref:`what_is_this_pserve_thing`
+
+Configuration with ``.ini`` Files
+=================================
+
+Earlier in *Quick Glance* 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:
+
+- ``[app:hello_world]`` configures our WSGI app
+
+- ``[pipeline:main]`` sets up our WSGI "pipeline"
+
+- ``[server:main]`` holds our WSGI server settings
+
+- Various sections afterwards configure our Python logging system
+
+We have a few decisions made for us in this configuration:
+
+#. *Choice of web server*. The ``use = egg:pyramid#wsgiref`` tell
+ ``pserve`` to the ``wsgiref`` server that is wrapped in the Pyramid
+ package.
+
+#. *Port number*. ``port = 6543`` tells ``wsgiref`` 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.
+
+#. *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.
+
+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 traceback information.
+
+.. seealso:: See Also: :ref:`environment_chapter` and
+ :doc:`../narr/paste`
+
+
+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.
+
+``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:
+
+.. literalinclude:: quick_tour/package/setup.py
+ :start-after: Start Requires
+ :end-before: End Requires
+
+...and re-run your setup:
+
+.. 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:
+
+.. literalinclude:: quick_tour/package/hello_world/__init__.py
+ :start-after: Start Include
+ :end-before: End Include
+
+Now that we have a configuration file, we can use the
+``pyramid.includes`` facility and place this in our
+``development.ini`` instead:
+
+.. 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.
+
+.. seealso:: See Also: :ref:`pyramid_debugtoolbar <toolbar:overview>`
+
+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.
+
+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:
+
+.. code-block:: python
+
+ setup(name='hello_world',
+ # Some lines removed...
+ extras_require={
+ 'testing': ['nose', 'coverage'],
+ }
+ )
+
+We changed ``setup.py`` which means we need to re-run
+``python ./setup.py develop``. We can now run all our tests:
+
+.. code-block:: bash
+
+ $ nosetests hello_world/tests.py
+ .
+ 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%
+ ---------------------------------------------------
+ TOTAL 35 9 74%
+ ----------------------------------------------------------------------
+ Ran 1 test in 0.931s
+
+ OK
+
+Our unit test passed. What did our test look like?
+
+.. literalinclude:: quick_tour/package/hello_world/tests.py
+
+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:`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*.
+
+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.)
+
+Maybe you would like to log messages in your code? In your Python
+module, import and setup the logging:
+
+.. literalinclude:: quick_tour/package/hello_world/views.py
+ :start-after: Start Logging 1
+ :end-before: End Logging 1
+
+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
+
+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:
+
+.. literalinclude:: quick_tour/package/development.ini
+ :language: ini
+ :start-after: Start Sphinx Include
+ :end-before: End Sphinx Include
+
+Our application, a package named ``hello_world``, 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 [hello_world.views][MainThread] Some Message
+
+.. seealso:: See Also: :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`.
+
+Pyramid has basic built-in support for sessions, with add-ons such as
+*Beaker* (or your own custom sessioning engine) that provide richer
+session support. 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
+
+.. warning::
+
+ 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
+
+Pyramid's :term:`request` object now has a ``session`` attribute
+that we can use in our view code:
+
+.. literalinclude:: quick_tour/package/hello_world/views.py
+ :start-after: Start Sphinx Include 1
+ :end-before: End Sphinx Include 1
+
+With this, each reload will increase the counter displayed in our
+Jinja2 template:
+
+.. literalinclude:: quick_tour/package/hello_world/templates/mytemplate.jinja2
+ :language: jinja
+ :start-after: Start Sphinx Include 1
+ :end-before: End Sphinx Include 1
+
+.. seealso:: See Also:
+ :ref:`sessions_chapter`, :ref:`flash_messages`,
+ :ref:`session_module`, and
+ :ref:`Beaker sessioning middleware <beaker:overview>`
+
+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!
+
+.. code-block:: bash
+
+ $ pcreate --scaffold alchemy sqla_demo
+ $ 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:
+
+.. 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:
+
+.. literalinclude:: quick_tour/sqla_demo/sqla_demo/models.py
+ :start-after: Start Sphinx Include
+ :end-before: End Sphinx Include
+
+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
+
+.. seealso:: See Also: `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.
+
+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
+
+ class WikiPage(colander.MappingSchema):
+ title = colander.SchemaNode(colander.String())
+ body = colander.SchemaNode(
+ colander.String(),
+ widget=deform.widget.RichTextWidget()
+ )
+
+With this in place, we can render the HTML for a form,
+perhaps with form data from an existing page:
+
+.. code-block:: python
+
+ form = self.wiki_form.render()
+
+We'd like to handle form submission, validation, and saving:
+
+.. code-block:: python
+
+ # Get the form data that was posted
+ controls = self.request.POST.items()
+ try:
+ # Validate and either raise a validation error
+ # or return deserialized data from widgets
+ appstruct = wiki_form.validate(controls)
+ except deform.ValidationFailure as e:
+ # Bail out and render form with errors
+ return dict(title=title, page=page, form=e.render())
+
+ # Change the content and redirect to the view
+ 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.
+
+Also, the ``deform_bootstrap`` Pyramid add-on restyles the stock Deform
+widgets using attractive CSS from Bootstrap and more powerful widgets
+from Chosen.
+
+.. seealso:: See Also:
+ :ref:`Deform <deform:overview>`,
+ :ref:`Colander <colander:overview>`, and
+ `deform_bootstrap <https://pypi.python.org/pypi/deform_bootstrap>`_
+
+Conclusion
+==========
+
+This *Quick Tour* covered a little about a lot. We introduced a long list
+of concepts in Pyramid, many of which are expanded on more fully in the
+Pyramid developer docs. \ No newline at end of file
diff --git a/docs/quick_tour/awesome/CHANGES.txt b/docs/quick_tour/awesome/CHANGES.txt
new file mode 100644
index 000000000..ffa255da8
--- /dev/null
+++ b/docs/quick_tour/awesome/CHANGES.txt
@@ -0,0 +1,4 @@
+0.0
+---
+
+- Initial version
diff --git a/docs/quick_tour/awesome/MANIFEST.in b/docs/quick_tour/awesome/MANIFEST.in
new file mode 100644
index 000000000..e78395da8
--- /dev/null
+++ b/docs/quick_tour/awesome/MANIFEST.in
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 000000000..f695286d9
--- /dev/null
+++ b/docs/quick_tour/awesome/README.txt
@@ -0,0 +1,4 @@
+awesome README
+
+
+
diff --git a/docs/quick_tour/awesome/awesome/__init__.py b/docs/quick_tour/awesome/awesome/__init__.py
new file mode 100644
index 000000000..408033997
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/__init__.py
@@ -0,0 +1,23 @@
+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
new file mode 100644
index 000000000..9c9460cb2
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/locale/awesome.pot
@@ -0,0 +1,21 @@
+# 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
new file mode 100644
index 000000000..40bf0c271
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.mo
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
new file mode 100644
index 000000000..0df243dba
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/locale/de/LC_MESSAGES/awesome.po
@@ -0,0 +1,21 @@
+# 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
new file mode 100644
index 000000000..4fc438bfe
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.mo
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
new file mode 100644
index 000000000..dc0aae5d7
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/locale/fr/LC_MESSAGES/awesome.po
@@ -0,0 +1,21 @@
+# 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/models.py b/docs/quick_tour/awesome/awesome/models.py
new file mode 100644
index 000000000..edd361c9c
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/models.py
@@ -0,0 +1,8 @@
+class MyModel(object):
+ pass
+
+root = MyModel()
+
+
+def get_root(request):
+ return root
diff --git a/docs/quick_tour/awesome/awesome/static/favicon.ico b/docs/quick_tour/awesome/awesome/static/favicon.ico
new file mode 100644
index 000000000..71f837c9e
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/static/favicon.ico
Binary files differ
diff --git a/docs/quick_tour/awesome/awesome/static/logo.png b/docs/quick_tour/awesome/awesome/static/logo.png
new file mode 100644
index 000000000..88f5d9865
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/static/logo.png
Binary files differ
diff --git a/docs/quick_tour/awesome/awesome/static/pylons.css b/docs/quick_tour/awesome/awesome/static/pylons.css
new file mode 100644
index 000000000..42e2e320e
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/static/pylons.css
@@ -0,0 +1,73 @@
+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
new file mode 100644
index 000000000..8bf676041
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/templates/mytemplate.jinja2
@@ -0,0 +1,87 @@
+<!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
new file mode 100644
index 000000000..ac222e25b
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/tests.py
@@ -0,0 +1,21 @@
+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
new file mode 100644
index 000000000..67b282f87
--- /dev/null
+++ b/docs/quick_tour/awesome/awesome/views.py
@@ -0,0 +1,6 @@
+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
new file mode 100644
index 000000000..a473d32f1
--- /dev/null
+++ b/docs/quick_tour/awesome/development.ini
@@ -0,0 +1,49 @@
+[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
new file mode 100644
index 000000000..0c3d54bc1
--- /dev/null
+++ b/docs/quick_tour/awesome/message-extraction.ini
@@ -0,0 +1,3 @@
+[python: **.py]
+[jinja2: **.jinja2]
+encoding = utf-8
diff --git a/docs/quick_tour/awesome/setup.cfg b/docs/quick_tour/awesome/setup.cfg
new file mode 100644
index 000000000..b1cd90d2c
--- /dev/null
+++ b/docs/quick_tour/awesome/setup.cfg
@@ -0,0 +1,28 @@
+[nosetests]
+match = ^test
+nocapture = 1
+cover-package = awesome
+with-coverage = 1
+cover-erase = 1
+
+[compile_catalog]
+directory = awesome/locale
+domain = awesome
+statistics = true
+
+[extract_messages]
+add_comments = TRANSLATORS:
+output_file = awesome/locale/awesome.pot
+width = 80
+mapping_file = message-extraction.ini
+
+[init_catalog]
+domain = awesome
+input_file = awesome/locale/awesome.pot
+output_dir = awesome/locale
+
+[update_catalog]
+domain = awesome
+input_file = awesome/locale/awesome.pot
+output_dir = awesome/locale
+previous = true
diff --git a/docs/quick_tour/awesome/setup.py b/docs/quick_tour/awesome/setup.py
new file mode 100644
index 000000000..32d666317
--- /dev/null
+++ b/docs/quick_tour/awesome/setup.py
@@ -0,0 +1,36 @@
+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
new file mode 100644
index 000000000..df5a6cf18
--- /dev/null
+++ b/docs/quick_tour/hello_world/app.py
@@ -0,0 +1,16 @@
+from wsgiref.simple_server import make_server
+from pyramid.config import Configurator
+from pyramid.response import Response
+
+
+def hello_world(request):
+ return Response('<h1>Hello World!</h1>')
+
+
+if __name__ == '__main__':
+ config = Configurator()
+ config.add_route('hello', '/')
+ 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
diff --git a/docs/quick_tour/jinja2/app.py b/docs/quick_tour/jinja2/app.py
new file mode 100644
index 000000000..83af219db
--- /dev/null
+++ b/docs/quick_tour/jinja2/app.py
@@ -0,0 +1,11 @@
+from wsgiref.simple_server import make_server
+from pyramid.config import Configurator
+
+if __name__ == '__main__':
+ config = Configurator()
+ config.add_route('hello', '/howdy/{name}')
+ 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
diff --git a/docs/quick_tour/jinja2/hello_world.jinja2 b/docs/quick_tour/jinja2/hello_world.jinja2
new file mode 100644
index 000000000..e177744b5
--- /dev/null
+++ b/docs/quick_tour/jinja2/hello_world.jinja2
@@ -0,0 +1,8 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Hello World</title>
+</head>
+<body>
+<h1>Hello {{ name }}!</h1>
+</body>
+</html> \ No newline at end of file
diff --git a/docs/quick_tour/jinja2/views.py b/docs/quick_tour/jinja2/views.py
new file mode 100644
index 000000000..916cdc720
--- /dev/null
+++ b/docs/quick_tour/jinja2/views.py
@@ -0,0 +1,8 @@
+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
new file mode 100644
index 000000000..950cb478f
--- /dev/null
+++ b/docs/quick_tour/json/app.py
@@ -0,0 +1,15 @@
+from wsgiref.simple_server import make_server
+
+from pyramid.config import Configurator
+
+
+if __name__ == '__main__':
+ config = Configurator()
+ config.add_route('hello', '/howdy/{name}')
+ 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
diff --git a/docs/quick_tour/json/hello_world.jinja2 b/docs/quick_tour/json/hello_world.jinja2
new file mode 100644
index 000000000..f6862e618
--- /dev/null
+++ b/docs/quick_tour/json/hello_world.jinja2
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Quick Glance</title>
+ <link rel="stylesheet" href="/static/app.css"/>
+</head>
+<body>
+<h1>Hello {{ name }}!</h1>
+</body>
+</html> \ No newline at end of file
diff --git a/docs/quick_tour/json/hello_world.pt b/docs/quick_tour/json/hello_world.pt
new file mode 100644
index 000000000..711054aa9
--- /dev/null
+++ b/docs/quick_tour/json/hello_world.pt
@@ -0,0 +1,17 @@
+<!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
new file mode 100644
index 000000000..583e220c7
--- /dev/null
+++ b/docs/quick_tour/json/views.py
@@ -0,0 +1,13 @@
+from pyramid.view import view_config
+
+
+@view_config(route_name='hello', renderer='hello_world.pt')
+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/CHANGES.txt b/docs/quick_tour/package/CHANGES.txt
new file mode 100644
index 000000000..ffa255da8
--- /dev/null
+++ b/docs/quick_tour/package/CHANGES.txt
@@ -0,0 +1,4 @@
+0.0
+---
+
+- Initial version
diff --git a/docs/quick_tour/package/MANIFEST.in b/docs/quick_tour/package/MANIFEST.in
new file mode 100644
index 000000000..18fbd855c
--- /dev/null
+++ b/docs/quick_tour/package/MANIFEST.in
@@ -0,0 +1,2 @@
+include *.txt *.ini *.cfg *.rst
+recursive-include hello_world *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
diff --git a/docs/quick_tour/package/README.txt b/docs/quick_tour/package/README.txt
new file mode 100644
index 000000000..63aaf6fbd
--- /dev/null
+++ b/docs/quick_tour/package/README.txt
@@ -0,0 +1,4 @@
+hello_world README
+
+
+
diff --git a/docs/quick_tour/package/development.ini b/docs/quick_tour/package/development.ini
new file mode 100644
index 000000000..a3a73e885
--- /dev/null
+++ b/docs/quick_tour/package/development.ini
@@ -0,0 +1,54 @@
+# Start Includes
+[app:hello_world]
+pyramid.includes = pyramid_debugtoolbar
+# End Includes
+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
+
+[server:main]
+use = egg:pyramid#wsgiref
+host = 0.0.0.0
+port = 6543
+
+# Begin logging configuration
+
+# Start Sphinx Include
+[loggers]
+keys = root, hello_world
+
+[logger_hello_world]
+level = DEBUG
+handlers =
+qualname = hello_world
+# End Sphinx Include
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[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/package/hello_world/__init__.py b/docs/quick_tour/package/hello_world/__init__.py
new file mode 100644
index 000000000..6e66bf40a
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/__init__.py
@@ -0,0 +1,34 @@
+from pyramid.config import Configurator
+from pyramid_jinja2 import renderer_factory
+# Start Sphinx Include 1
+from pyramid.session import UnencryptedCookieSessionFactoryConfig
+# End Sphinx Include 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')
+
+ # Start Sphinx Include 2
+ my_session_factory = UnencryptedCookieSessionFactoryConfig('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")
+
+ 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
new file mode 100644
index 000000000..9d7ec43d8
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/init.py
@@ -0,0 +1,34 @@
+from pyramid.config import Configurator
+from pyramid_jinja2 import renderer_factory
+# Start Sphinx 1
+from pyramid.session import UnencryptedCookieSessionFactoryConfig
+# 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 = UnencryptedCookieSessionFactoryConfig('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/locale/de/LC_MESSAGES/hello_world.mo b/docs/quick_tour/package/hello_world/locale/de/LC_MESSAGES/hello_world.mo
new file mode 100644
index 000000000..40bf0c271
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/locale/de/LC_MESSAGES/hello_world.mo
Binary files differ
diff --git a/docs/quick_tour/package/hello_world/locale/de/LC_MESSAGES/hello_world.po b/docs/quick_tour/package/hello_world/locale/de/LC_MESSAGES/hello_world.po
new file mode 100644
index 000000000..0df243dba
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/locale/de/LC_MESSAGES/hello_world.po
@@ -0,0 +1,21 @@
+# 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/package/hello_world/locale/fr/LC_MESSAGES/hello_world.mo b/docs/quick_tour/package/hello_world/locale/fr/LC_MESSAGES/hello_world.mo
new file mode 100644
index 000000000..4fc438bfe
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/locale/fr/LC_MESSAGES/hello_world.mo
Binary files differ
diff --git a/docs/quick_tour/package/hello_world/locale/fr/LC_MESSAGES/hello_world.po b/docs/quick_tour/package/hello_world/locale/fr/LC_MESSAGES/hello_world.po
new file mode 100644
index 000000000..dc0aae5d7
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/locale/fr/LC_MESSAGES/hello_world.po
@@ -0,0 +1,21 @@
+# 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/package/hello_world/locale/hello_world.pot b/docs/quick_tour/package/hello_world/locale/hello_world.pot
new file mode 100644
index 000000000..9c9460cb2
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/locale/hello_world.pot
@@ -0,0 +1,21 @@
+# 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/package/hello_world/models.py b/docs/quick_tour/package/hello_world/models.py
new file mode 100644
index 000000000..edd361c9c
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/models.py
@@ -0,0 +1,8 @@
+class MyModel(object):
+ pass
+
+root = MyModel()
+
+
+def get_root(request):
+ return root
diff --git a/docs/quick_tour/package/hello_world/static/favicon.ico b/docs/quick_tour/package/hello_world/static/favicon.ico
new file mode 100644
index 000000000..71f837c9e
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/static/favicon.ico
Binary files differ
diff --git a/docs/quick_tour/package/hello_world/static/logo.png b/docs/quick_tour/package/hello_world/static/logo.png
new file mode 100644
index 000000000..88f5d9865
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/static/logo.png
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
new file mode 100644
index 000000000..42e2e320e
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/static/pylons.css
@@ -0,0 +1,73 @@
+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/templates/mytemplate.jinja2 b/docs/quick_tour/package/hello_world/templates/mytemplate.jinja2
new file mode 100644
index 000000000..25a28ed7a
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/templates/mytemplate.jinja2
@@ -0,0 +1,90 @@
+<!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>
+ </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/package/hello_world/tests.py b/docs/quick_tour/package/hello_world/tests.py
new file mode 100644
index 000000000..ccec14f70
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/tests.py
@@ -0,0 +1,20 @@
+import unittest
+from pyramid import testing
+from pyramid.i18n import TranslationStringFactory
+
+_ = TranslationStringFactory('hello_world')
+
+
+class ViewTests(unittest.TestCase):
+
+ def setUp(self):
+ testing.setUp()
+
+ def tearDown(self):
+ testing.tearDown()
+
+ def test_my_view(self):
+ from hello_world.views import my_view
+ request = testing.DummyRequest()
+ response = my_view(request)
+ self.assertEqual(response['project'], 'hello_world')
diff --git a/docs/quick_tour/package/hello_world/views.py b/docs/quick_tour/package/hello_world/views.py
new file mode 100644
index 000000000..109c260ad
--- /dev/null
+++ b/docs/quick_tour/package/hello_world/views.py
@@ -0,0 +1,22 @@
+# Start Logging 1
+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/message-extraction.ini b/docs/quick_tour/package/message-extraction.ini
new file mode 100644
index 000000000..0c3d54bc1
--- /dev/null
+++ b/docs/quick_tour/package/message-extraction.ini
@@ -0,0 +1,3 @@
+[python: **.py]
+[jinja2: **.jinja2]
+encoding = utf-8
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
new file mode 100644
index 000000000..f118ed5fb
--- /dev/null
+++ b/docs/quick_tour/package/setup.py
@@ -0,0 +1,41 @@
+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()
+
+# Start Requires
+requires = ['pyramid>=1.0.2', 'pyramid_jinja2', 'pyramid_debugtoolbar']
+# End Requires
+
+setup(name='hello_world',
+ version='0.0',
+ description='hello_world',
+ 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="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
new file mode 100644
index 000000000..7ac81eb50
--- /dev/null
+++ b/docs/quick_tour/requests/app.py
@@ -0,0 +1,24 @@
+from wsgiref.simple_server import make_server
+from pyramid.config import Configurator
+from pyramid.response import Response
+
+
+def hello_world(request):
+ # Some parameters from a request such as /?name=lisa
+ url = request.url
+ name = request.params.get('name', 'No Name Provided')
+
+ body = 'URL %s with name: %s' % (url, name)
+ return Response(
+ content_type="text/plain",
+ body=body
+ )
+
+
+if __name__ == '__main__':
+ config = Configurator()
+ config.add_route('hello', '/')
+ 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
diff --git a/docs/quick_tour/routing/app.py b/docs/quick_tour/routing/app.py
new file mode 100644
index 000000000..04a8a6344
--- /dev/null
+++ b/docs/quick_tour/routing/app.py
@@ -0,0 +1,12 @@
+from wsgiref.simple_server import make_server
+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)
+ server.serve_forever() \ No newline at end of file
diff --git a/docs/quick_tour/routing/views.py b/docs/quick_tour/routing/views.py
new file mode 100644
index 000000000..8cb8d3780
--- /dev/null
+++ b/docs/quick_tour/routing/views.py
@@ -0,0 +1,10 @@
+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/CHANGES.txt b/docs/quick_tour/sqla_demo/CHANGES.txt
new file mode 100644
index 000000000..35a34f332
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/CHANGES.txt
@@ -0,0 +1,4 @@
+0.0
+---
+
+- Initial version
diff --git a/docs/quick_tour/sqla_demo/MANIFEST.in b/docs/quick_tour/sqla_demo/MANIFEST.in
new file mode 100644
index 000000000..a432577e9
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/MANIFEST.in
@@ -0,0 +1,2 @@
+include *.txt *.ini *.cfg *.rst
+recursive-include sqla_demo *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
diff --git a/docs/quick_tour/sqla_demo/README.txt b/docs/quick_tour/sqla_demo/README.txt
new file mode 100644
index 000000000..f35d3aec5
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/README.txt
@@ -0,0 +1,14 @@
+sqla_demo README
+==================
+
+Getting Started
+---------------
+
+- cd <directory containing this file>
+
+- $venv/bin/python setup.py develop
+
+- $venv/bin/initialize_sqla_demo_db 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
new file mode 100644
index 000000000..174468abf
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/development.ini
@@ -0,0 +1,71 @@
+###
+# app configuration
+# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
+###
+
+[app:main]
+use = egg:sqla_demo
+
+pyramid.reload_templates = true
+pyramid.debug_authorization = false
+pyramid.debug_notfound = false
+pyramid.debug_routematch = false
+pyramid.default_locale_name = en
+pyramid.includes =
+ pyramid_debugtoolbar
+ pyramid_tm
+
+sqlalchemy.url = sqlite:///%(here)s/sqla_demo.sqlite
+
+# 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:waitress#main
+host = 0.0.0.0
+port = 6543
+
+###
+# logging configuration
+# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
+###
+
+[loggers]
+keys = root, sqla_demo, sqlalchemy
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[logger_sqla_demo]
+level = DEBUG
+handlers =
+qualname = sqla_demo
+
+[logger_sqlalchemy]
+level = INFO
+handlers =
+qualname = sqlalchemy.engine
+# "level = INFO" logs SQL queries.
+# "level = DEBUG" logs SQL queries and results.
+# "level = WARN" logs neither. (Recommended for production systems.)
+
+[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
diff --git a/docs/quick_tour/sqla_demo/production.ini b/docs/quick_tour/sqla_demo/production.ini
new file mode 100644
index 000000000..dc0ba304f
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/production.ini
@@ -0,0 +1,62 @@
+###
+# app configuration
+# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
+###
+
+[app:main]
+use = egg:sqla_demo
+
+pyramid.reload_templates = false
+pyramid.debug_authorization = false
+pyramid.debug_notfound = false
+pyramid.debug_routematch = false
+pyramid.default_locale_name = en
+pyramid.includes =
+ pyramid_tm
+
+sqlalchemy.url = sqlite:///%(here)s/sqla_demo.sqlite
+
+[server:main]
+use = egg:waitress#main
+host = 0.0.0.0
+port = 6543
+
+###
+# logging configuration
+# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
+###
+
+[loggers]
+keys = root, sqla_demo, sqlalchemy
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = WARN
+handlers = console
+
+[logger_sqla_demo]
+level = WARN
+handlers =
+qualname = sqla_demo
+
+[logger_sqlalchemy]
+level = WARN
+handlers =
+qualname = sqlalchemy.engine
+# "level = INFO" logs SQL queries.
+# "level = DEBUG" logs SQL queries and results.
+# "level = WARN" logs neither. (Recommended for production systems.)
+
+[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
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
new file mode 100644
index 000000000..ac2eed035
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/setup.py
@@ -0,0 +1,44 @@
+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',
+ 'SQLAlchemy',
+ 'transaction',
+ 'pyramid_tm',
+ 'pyramid_debugtoolbar',
+ 'zope.sqlalchemy',
+ 'waitress',
+ ]
+
+setup(name='sqla_demo',
+ version='0.0',
+ description='sqla_demo',
+ long_description=README + '\n\n' + CHANGES,
+ classifiers=[
+ "Programming Language :: Python",
+ "Framework :: Pyramid",
+ "Topic :: Internet :: WWW/HTTP",
+ "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
+ ],
+ author='',
+ author_email='',
+ url='',
+ keywords='web wsgi bfg pylons pyramid',
+ packages=find_packages(),
+ include_package_data=True,
+ zip_safe=False,
+ test_suite='sqla_demo',
+ install_requires=requires,
+ entry_points="""\
+ [paste.app_factory]
+ main = sqla_demo:main
+ [console_scripts]
+ initialize_sqla_demo_db = sqla_demo.scripts.initializedb:main
+ """,
+ )
diff --git a/docs/quick_tour/sqla_demo/sqla_demo.sqlite b/docs/quick_tour/sqla_demo/sqla_demo.sqlite
new file mode 100644
index 000000000..fa6adb104
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo.sqlite
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
new file mode 100644
index 000000000..aac7c5e69
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/__init__.py
@@ -0,0 +1,20 @@
+from pyramid.config import Configurator
+from sqlalchemy import engine_from_config
+
+from .models import (
+ DBSession,
+ Base,
+ )
+
+
+def main(global_config, **settings):
+ """ This function returns a Pyramid WSGI application.
+ """
+ engine = engine_from_config(settings, 'sqlalchemy.')
+ DBSession.configure(bind=engine)
+ Base.metadata.bind = engine
+ config = Configurator(settings=settings)
+ config.add_static_view('static', 'static', cache_max_age=3600)
+ config.add_route('home', '/')
+ config.scan()
+ return config.make_wsgi_app()
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/models.py b/docs/quick_tour/sqla_demo/sqla_demo/models.py
new file mode 100644
index 000000000..3dfb40e58
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/models.py
@@ -0,0 +1,29 @@
+from sqlalchemy import (
+ Column,
+ Integer,
+ Text,
+ )
+
+from sqlalchemy.ext.declarative import declarative_base
+
+from sqlalchemy.orm import (
+ scoped_session,
+ sessionmaker,
+ )
+
+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)
+ value = Column(Integer)
+
+ def __init__(self, name, value):
+ self.name = name
+ self.value = value
+ # End Sphinx Include
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/scripts/__init__.py b/docs/quick_tour/sqla_demo/sqla_demo/scripts/__init__.py
new file mode 100644
index 000000000..5bb534f79
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/scripts/__init__.py
@@ -0,0 +1 @@
+# package
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/scripts/initializedb.py b/docs/quick_tour/sqla_demo/sqla_demo/scripts/initializedb.py
new file mode 100644
index 000000000..66feb3008
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/scripts/initializedb.py
@@ -0,0 +1,37 @@
+import os
+import sys
+import transaction
+
+from sqlalchemy import engine_from_config
+
+from pyramid.paster import (
+ get_appsettings,
+ setup_logging,
+ )
+
+from ..models import (
+ DBSession,
+ MyModel,
+ Base,
+ )
+
+
+def usage(argv):
+ cmd = os.path.basename(argv[0])
+ print('usage: %s <config_uri>\n'
+ '(example: "%s development.ini")' % (cmd, cmd))
+ sys.exit(1)
+
+
+def main(argv=sys.argv):
+ if len(argv) != 2:
+ usage(argv)
+ config_uri = argv[1]
+ setup_logging(config_uri)
+ settings = get_appsettings(config_uri)
+ engine = engine_from_config(settings, 'sqlalchemy.')
+ DBSession.configure(bind=engine)
+ Base.metadata.create_all(engine)
+ with transaction.manager:
+ model = MyModel(name='one', value=1)
+ DBSession.add(model)
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/static/favicon.ico b/docs/quick_tour/sqla_demo/sqla_demo/static/favicon.ico
new file mode 100644
index 000000000..71f837c9e
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/favicon.ico
Binary files differ
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/static/footerbg.png b/docs/quick_tour/sqla_demo/sqla_demo/static/footerbg.png
new file mode 100644
index 000000000..1fbc873da
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/footerbg.png
Binary files differ
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/static/headerbg.png b/docs/quick_tour/sqla_demo/sqla_demo/static/headerbg.png
new file mode 100644
index 000000000..0596f2020
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/headerbg.png
Binary files differ
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/static/ie6.css b/docs/quick_tour/sqla_demo/sqla_demo/static/ie6.css
new file mode 100644
index 000000000..b7c8493d8
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/ie6.css
@@ -0,0 +1,8 @@
+* 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/quick_tour/sqla_demo/sqla_demo/static/middlebg.png b/docs/quick_tour/sqla_demo/sqla_demo/static/middlebg.png
new file mode 100644
index 000000000..2369cfb7d
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/middlebg.png
Binary files differ
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/static/pylons.css b/docs/quick_tour/sqla_demo/sqla_demo/static/pylons.css
new file mode 100644
index 000000000..4b1c017cd
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/pylons.css
@@ -0,0 +1,372 @@
+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/quick_tour/sqla_demo/sqla_demo/static/pyramid-small.png b/docs/quick_tour/sqla_demo/sqla_demo/static/pyramid-small.png
new file mode 100644
index 000000000..a5bc0ade7
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/pyramid-small.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
new file mode 100644
index 000000000..347e05549
--- /dev/null
+++ 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/transparent.gif b/docs/quick_tour/sqla_demo/sqla_demo/static/transparent.gif
new file mode 100644
index 000000000..0341802e5
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/static/transparent.gif
Binary files differ
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/templates/mytemplate.pt b/docs/quick_tour/sqla_demo/sqla_demo/templates/mytemplate.pt
new file mode 100644
index 000000000..321c0f5fb
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/templates/mytemplate.pt
@@ -0,0 +1,76 @@
+<!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>
+ </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>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="footer">
+ <div class="footer">&copy; Copyright 2008-2012, Agendaless Consulting.</div>
+ </div>
+</body>
+</html>
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/tests.py b/docs/quick_tour/sqla_demo/sqla_demo/tests.py
new file mode 100644
index 000000000..6fef6d695
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/tests.py
@@ -0,0 +1,33 @@
+import unittest
+import transaction
+
+from pyramid import testing
+
+from .models import DBSession
+
+
+class TestMyView(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)
+ Base.metadata.create_all(engine)
+ with transaction.manager:
+ model = MyModel(name='one', value=55)
+ DBSession.add(model)
+
+ def tearDown(self):
+ DBSession.remove()
+ testing.tearDown()
+
+ def test_it(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')
diff --git a/docs/quick_tour/sqla_demo/sqla_demo/views.py b/docs/quick_tour/sqla_demo/sqla_demo/views.py
new file mode 100644
index 000000000..768a7e42e
--- /dev/null
+++ b/docs/quick_tour/sqla_demo/sqla_demo/views.py
@@ -0,0 +1,37 @@
+from pyramid.response import Response
+from pyramid.view import view_config
+
+from sqlalchemy.exc import DBAPIError
+
+from .models import (
+ DBSession,
+ MyModel,
+ )
+
+
+@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
+ environment's "bin" directory for this script and try to run it.
+
+2. Your database server may not be running. Check that the
+ database server referred to by the "sqlalchemy.url" setting in
+ your "development.ini" file is running.
+
+After you fix the problem, please restart the Pyramid application to
+try it again.
+"""
+
diff --git a/docs/quick_tour/static_assets/app.py b/docs/quick_tour/static_assets/app.py
new file mode 100644
index 000000000..9c808972f
--- /dev/null
+++ b/docs/quick_tour/static_assets/app.py
@@ -0,0 +1,14 @@
+from wsgiref.simple_server import make_server
+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
diff --git a/docs/quick_tour/static_assets/hello_world.jinja2 b/docs/quick_tour/static_assets/hello_world.jinja2
new file mode 100644
index 000000000..f6862e618
--- /dev/null
+++ b/docs/quick_tour/static_assets/hello_world.jinja2
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Quick Glance</title>
+ <link rel="stylesheet" href="/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/hello_world.pt b/docs/quick_tour/static_assets/hello_world.pt
new file mode 100644
index 000000000..1797146eb
--- /dev/null
+++ b/docs/quick_tour/static_assets/hello_world.pt
@@ -0,0 +1,16 @@
+<!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/static/app.css b/docs/quick_tour/static_assets/static/app.css
new file mode 100644
index 000000000..f8acf3164
--- /dev/null
+++ b/docs/quick_tour/static_assets/static/app.css
@@ -0,0 +1,4 @@
+body {
+ margin: 2em;
+ font-family: sans-serif;
+} \ No newline at end of file
diff --git a/docs/quick_tour/static_assets/views.py b/docs/quick_tour/static_assets/views.py
new file mode 100644
index 000000000..90730ae32
--- /dev/null
+++ b/docs/quick_tour/static_assets/views.py
@@ -0,0 +1,6 @@
+from pyramid.view import view_config
+
+
+@view_config(route_name='hello', renderer='hello_world.pt')
+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
new file mode 100644
index 000000000..6d1a29f4e
--- /dev/null
+++ b/docs/quick_tour/templating/app.py
@@ -0,0 +1,10 @@
+from wsgiref.simple_server import make_server
+from pyramid.config import Configurator
+
+if __name__ == '__main__':
+ config = Configurator()
+ config.add_route('hello', '/howdy/{name}')
+ 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
diff --git a/docs/quick_tour/templating/hello_world.pt b/docs/quick_tour/templating/hello_world.pt
new file mode 100644
index 000000000..ae14f447d
--- /dev/null
+++ b/docs/quick_tour/templating/hello_world.pt
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Quick Glance</title>
+</head>
+<body>
+<h1>Hello ${name}</h1>
+</body>
+</html> \ No newline at end of file
diff --git a/docs/quick_tour/templating/views.py b/docs/quick_tour/templating/views.py
new file mode 100644
index 000000000..6c7846efa
--- /dev/null
+++ b/docs/quick_tour/templating/views.py
@@ -0,0 +1,8 @@
+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
new file mode 100644
index 000000000..468c8c29e
--- /dev/null
+++ b/docs/quick_tour/view_classes/app.py
@@ -0,0 +1,13 @@
+from wsgiref.simple_server import make_server
+from pyramid.config import Configurator
+
+if __name__ == '__main__':
+ config = Configurator()
+ # Start Routes 1
+ config.add_route('hello', '/howdy/{name}')
+ # End Routes 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
diff --git a/docs/quick_tour/view_classes/delete.jinja2 b/docs/quick_tour/view_classes/delete.jinja2
new file mode 100644
index 000000000..ba45b7d16
--- /dev/null
+++ b/docs/quick_tour/view_classes/delete.jinja2
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Delete World</title>
+</head>
+<body>
+<h1>Delete {{ view.name }}!</h1>
+</body>
+</html> \ No newline at end of file
diff --git a/docs/quick_tour/view_classes/edit.jinja2 b/docs/quick_tour/view_classes/edit.jinja2
new file mode 100644
index 000000000..ce0eb5bd1
--- /dev/null
+++ b/docs/quick_tour/view_classes/edit.jinja2
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Edit World</title>
+</head>
+<body>
+<h1>Edit {{ view.name }}!</h1>
+</body>
+</html> \ No newline at end of file
diff --git a/docs/quick_tour/view_classes/hello.jinja2 b/docs/quick_tour/view_classes/hello.jinja2
new file mode 100644
index 000000000..3446b96ce
--- /dev/null
+++ b/docs/quick_tour/view_classes/hello.jinja2
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Hello World</title>
+</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"/>
+</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
new file mode 100644
index 000000000..62556142e
--- /dev/null
+++ b/docs/quick_tour/view_classes/views.py
@@ -0,0 +1,32 @@
+from pyramid.view import (
+ view_config,
+ view_defaults
+ )
+
+
+# Start View 1
+# One route, at /howdy/amy, so don't repeat on each @view_config
+@view_defaults(route_name='hello')
+class HelloWorldViews:
+ def __init__(self, request):
+ self.request = request
+ # Our templates can now say {{ view.name }}
+ self.name = request.matchdict['name']
+
+ # Retrieving /howdy/amy the first time
+ @view_config(renderer='hello.jinja2')
+ def hello_view(self):
+ return dict()
+
+ # Posting to /howdy/amy via the "Edit" submit button
+ @view_config(request_param='form.edit', renderer='edit.jinja2')
+ def edit_view(self):
+ print('Edited')
+ return dict()
+
+ # Posting to /howdy/amy via the "Delete" submit button
+ @view_config(request_param='form.delete', renderer='delete.jinja2')
+ 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
new file mode 100644
index 000000000..54dc9ed4b
--- /dev/null
+++ b/docs/quick_tour/views/app.py
@@ -0,0 +1,13 @@
+from wsgiref.simple_server import make_server
+from pyramid.config import Configurator
+
+if __name__ == '__main__':
+ config = Configurator()
+ config.add_route('home', '/')
+ config.add_route('hello', '/howdy')
+ config.add_route('redirect', '/goto')
+ config.add_route('exception', '/problem')
+ 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
diff --git a/docs/quick_tour/views/views.py b/docs/quick_tour/views/views.py
new file mode 100644
index 000000000..9dc795f14
--- /dev/null
+++ b/docs/quick_tour/views/views.py
@@ -0,0 +1,29 @@
+from pyramid.httpexceptions import HTTPFound
+from pyramid.response import Response
+from pyramid.view import view_config
+
+
+# First view, available at http://localhost:6543/
+@view_config(route_name='home')
+def home_view(request):
+ return Response('<p>Visit <a href="/howdy?name=lisa">hello</a></p>')
+
+
+# /howdy?name=alice which links to the next view
+@view_config(route_name='hello')
+def hello_view(request):
+ name = request.params.get('name', 'No Name')
+ body = '<p>Hi %s, this <a href="/goto">redirects</a></p>'
+ return Response(body % name)
+
+
+# /goto which issues HTTP redirect to the last view
+@view_config(route_name='redirect')
+def redirect_view(request):
+ return HTTPFound(location="/problem")
+
+
+# /problem which causes an site error
+@view_config(route_name='exception')
+def exception_view(request):
+ raise Exception()
diff --git a/docs/tutorials/bfg/index.rst b/docs/tutorials/bfg/index.rst
index a50637279..1abb26466 100644
--- a/docs/tutorials/bfg/index.rst
+++ b/docs/tutorials/bfg/index.rst
@@ -60,7 +60,7 @@ Here's how to convert a :mod:`repoze.bfg` application to a
.. code-block:: bash
$ cd ~
- $ virtualenv --no-site-packages pyramidenv
+ $ virtualenv pyramidenv
$ cd pyramidenv
$ $VENV/bin/easy_install pyramid
diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst
index e0021f8db..ddd968927 100644
--- a/docs/tutorials/modwsgi/index.rst
+++ b/docs/tutorials/modwsgi/index.rst
@@ -46,7 +46,7 @@ specific path information for commands and files.
$ cd ~
$ mkdir modwsgi
$ cd modwsgi
- $ /usr/local/bin/virtualenv --no-site-packages env
+ $ /usr/local/bin/virtualenv env
#. Install :app:`Pyramid` into the newly created virtualenv:
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt
index e8672104d..13b41f823 100644
--- a/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
index e8672104d..13b41f823 100644
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt
index e8672104d..13b41f823 100644
--- a/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt
index e8672104d..13b41f823 100644
--- a/docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt
index 84824f605..50102aa20 100644
--- a/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst
index 17788cdde..e21bf7108 100644
--- a/docs/tutorials/wiki2/installation.rst
+++ b/docs/tutorials/wiki2/installation.rst
@@ -26,7 +26,7 @@ On UNIX
.. code-block:: text
$ export VENV=~/pyramidtut
- $ virtualenv --no-site-packages $VENV
+ $ virtualenv $VENV
New python executable in /home/foo/env/bin/python
Installing setuptools.............done.
@@ -46,13 +46,13 @@ Python 2.7:
.. code-block:: text
- c:\> c:\Python27\Scripts\virtualenv --no-site-packages %VENV%
+ c:\> c:\Python27\Scripts\virtualenv %VENV%
Python 3.2:
.. code-block:: text
- c:\> c:\Python32\Scripts\virtualenv --no-site-packages %VENV%
+ c:\> c:\Python32\Scripts\virtualenv %VENV%
Install Pyramid Into the Virtual Python Environment
---------------------------------------------------
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt
index 14b88d16a..cf3da2073 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt
index ee9fdb7fa..ca4e0af26 100644
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt
index ee9fdb7fa..ca4e0af26 100644
--- a/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt
index 9c077568d..6c1ca924a 100644
--- a/docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/tests/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt
index ee9fdb7fa..ca4e0af26 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt
@@ -1,7 +1,7 @@
<!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 Application Development Framework</title>
+ <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" />
@@ -24,7 +24,7 @@
<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 application development framework.
+ the Pyramid Web Framework.
</p>
</div>
</div>
diff --git a/docs/whatsnew-1.5.rst b/docs/whatsnew-1.5.rst
index b987fa77f..445eb84ae 100644
--- a/docs/whatsnew-1.5.rst
+++ b/docs/whatsnew-1.5.rst
@@ -123,8 +123,8 @@ The feature additions in Pyramid 1.5 follow.
:func:`pyramid.paster.get_appsettings`. This also allowed the generated
``initialize_db`` script from the ``alchemy`` scaffold to grow support for
options in the form ``a=1 b=2`` so you can fill in values in a parameterized
- ``.ini`` file, e.g. ``initialize_myapp_db etc/development.ini a=1 b=2``. See
- https://github.com/Pylons/pyramid/pull/911
+ ``.ini`` file, e.g. ``initialize_myapp_db etc/development.ini a=1 b=2``.
+ See https://github.com/Pylons/pyramid/pull/911
- The ``request.session.check_csrf_token()`` method and the ``check_csrf`` view
predicate now take into account the value of the HTTP header named
@@ -134,7 +134,10 @@ The feature additions in Pyramid 1.5 follow.
Backwards Incompatibilities
---------------------------
-This release has no known backwards incompatibilities with Pyramid 1.4.X.
+- Modified the ``current_route_url`` method in pyramid.Request. The method
+ previously returned the URL without the query string by default, it now does
+ attach the query string unless it is overriden.
+
Deprecations
------------