docs/glossary.rst | ●●●●● patch | view | raw | blame | history | |
docs/narr/assets.rst | ●●●●● patch | view | raw | blame | history | |
docs/narr/extending.rst | ●●●●● patch | view | raw | blame | history | |
docs/narr/install.rst | ●●●●● patch | view | raw | blame | history | |
docs/narr/project.rst | ●●●●● patch | view | raw | blame | history | |
docs/narr/urldispatch.rst | ●●●●● patch | view | raw | blame | history | |
docs/tutorials/bfg/index.rst | ●●●●● patch | view | raw | blame | history | |
docs/tutorials/modwsgi/index.rst | ●●●●● patch | view | raw | blame | history | |
docs/tutorials/wiki/basiclayout.rst | ●●●●● patch | view | raw | blame | history | |
docs/tutorials/wiki/installation.rst | ●●●●● patch | view | raw | blame | history | |
docs/tutorials/wiki2/basiclayout.rst | ●●●●● patch | view | raw | blame | history | |
docs/tutorials/wiki2/installation.rst | ●●●●● patch | view | raw | blame | history | |
docs/whatsnew-1.0.rst | ●●●●● patch | view | raw | blame | history |
docs/glossary.rst
@@ -868,12 +868,12 @@ pyramid_jinja2 :term:`Jinja2` templating system bindings for Pyramid, documented at http://docs.pylonsproject.org/projects/pyramid_jinja2/dev/ . This package also includes a paster template named package also includes a scaffold named ``pyramid_jinja2_starter``, which creates an application package based on the Jinja2 templating system. pyramid_sqla A package which provides a Pylons-esque paster template which sports A package which provides a Pylons-esque scaffold which sports support for :term:`view handler` application development, :term:`SQLAlchemy` support, and other Pylons-like features. See https://bytebucket.org/sluggo/pyramid_sqla/wiki/html/index.html for more docs/narr/assets.rst
@@ -28,7 +28,7 @@ The use of assets is quite common in most web development projects. For example, when you create a :app:`Pyramid` application using one of the available "paster" templates, as described in :ref:`creating_a_project`, the available scaffolds, as described in :ref:`creating_a_project`, the directory representing the application contains a Python :term:`package`. Within that Python package, there are directories full of files which are static assets. For example, there's a ``static`` directory which contains docs/narr/extending.rst
@@ -191,7 +191,7 @@ like this: - Create a new Python package. The easiest way to do this is to create a new :app:`Pyramid` application using the "paster" template mechanism. See :app:`Pyramid` application using the scaffold mechanism. See :ref:`creating_a_project` for more information. - In the new package, create Python files containing views and other docs/narr/install.rst
@@ -337,6 +337,6 @@ various Chameleon libraries, WebOb, Paste, PasteScript, and PasteDeploy libraries are installed. Additionally, as chronicled in :ref:`project_narr`, PasteScript (aka *paster*) templates will be registered that make it easy to start a new :app:`Pyramid` project. Additionally, as chronicled in :ref:`project_narr`, scaffolds will be registered, which make it easy to start a new :app:`Pyramid` project. docs/narr/project.rst
@@ -5,37 +5,36 @@ As we saw in :ref:`firstapp_chapter`, it's possible to create a :app:`Pyramid` application completely manually. However, it's usually more convenient to use a *template* to generate a basic :app:`Pyramid` convenient to use a *scaffold* to generate a basic :app:`Pyramid` :term:`project`. A project is a directory that contains at least one Python :term:`package`. You'll use a template to create a project, and you'll create your application You'll use a scaffold to create a project, and you'll create your application logic within a package that lives inside the project. Even if your application is extremely simple, it is useful to place code that drives the application within a package, because a package is more easily extended with new code. An application that lives inside a package can also be distributed more easily than one which does not live within a package. :app:`Pyramid` comes with a variety of templates that you can use to generate a project. Each template makes different configuration assumptions about :app:`Pyramid` comes with a variety of scaffolds that you can use to generate a project. Each scaffold makes different configuration assumptions about what type of application you're trying to construct. These templates are rendered using the :term:`PasteDeploy` ``paster`` script, and so therefore they are often referred to as "paster templates". These scaffolds are rendered using the :term:`PasteDeploy` ``paster`` script. .. index:: single: paster templates single: pyramid_starter paster template single: pyramid_zodb paster template single: pyramid_alchemy paster template single: pyramid_routesalchemy paster template single: scaffolds single: pyramid_starter scaffold single: pyramid_zodb scaffold single: pyramid_alchemy scaffold single: pyramid_routesalchemy scaffold .. _additional_paster_templates: .. _additional_paster_scaffolds: Paster Templates Included with :app:`Pyramid` Scaffolds Included with :app:`Pyramid` ------------------------------------------------ The convenience ``paster`` templates included with :app:`Pyramid` differ from The convenience scaffolds included with :app:`Pyramid` differ from each other on a number of axes: - the persistence mechanism they offer (no persistence mechanism, @@ -48,7 +47,7 @@ sessioning implementation (as opposed to no sessioning or default sessioning). The included templates are these: The included scaffolds are these: ``pyramid_starter`` URL mapping via :term:`traversal` and no persistence mechanism. @@ -64,21 +63,21 @@ URL mapping via :term:`traversal` and persistence via :term:`SQLAlchemy` .. note:: At this time, each of these templates uses the :term:`Chameleon` .. note:: At this time, each of these scaffolds uses the :term:`Chameleon` templating system, which is incompatible with both Jython and PyPy. To use paster templates to build applications which will run on Jython and PyPy, you can try the ``pyramid_jinja2_starter`` template which ships as part of the :term:`pyramid_jinja2` package or the ``pyramid_sqla`` paster template which ships with the :term:`pyramid_sqla` package (it uses Mako), both available from :term:`PyPI`. You can also just use the above paster templates to build a skeleton and replace the Chameleon template it includes with a :term:`Mako` analogue. use scaffolds to build applications which will run on Jython and PyPy, you can try the ``pyramid_jinja2_starter`` scaffold which ships as part of the :term:`pyramid_jinja2` package or the ``pyramid_sqla`` scaffold which ships with the :term:`pyramid_sqla` package (it uses Mako), both available from :term:`PyPI`. You can also just use the above scaffold and replace the Chameleon template it includes with a :term:`Mako` analogue. Rather than use any of the above templates, Pylons 1 users may feel more Rather than use any of the above scaffolds, Pylons 1 users may feel more comfortable installing the :term:`pyramid_sqla` add-on package, which provides a paster template named ``pyramid_sqla``. This paster template configures a Pyramid application in a "Pylons-esque" way, including the use of a :term:`view handler` to map URLs to code (it's much like a Pylons provides a scaffold named ``pyramid_sqla``. This scaffold configures a Pyramid application in a "Pylons-esque" way, including the use of a :term:`view handler` to map URLs to code (it's much like a Pylons "controller"). .. index:: @@ -97,15 +96,15 @@ following command assumes that our current working directory is that directory. We'll choose the ``pyramid_starter`` template for this purpose. We'll choose the ``pyramid_starter`` scaffold for this purpose. .. code-block:: text $ bin/paster create -t pyramid_starter The above command uses the ``paster`` command to create a project using the ``pyramid_starter`` template. The ``paster create`` command creates project from a template. To use a different template, such as ``pyramid_starter`` scaffold. The ``paster create`` command creates project from a scaffold. To use a different scaffold, such as ``pyramid_routesalchemy``, you'd just change the last argument. For example: .. code-block:: text @@ -120,7 +119,7 @@ .. code-block:: text $ bin/paster create -t pyramid_starter Selected and implied templates: Selected and implied scaffolds: pyramid#pyramid_starter pyramid starter project Enter project name: MyProject @@ -128,7 +127,7 @@ egg: MyProject package: myproject project: MyProject Creating template pyramid Creating scaffold pyramid Creating directory ./MyProject # ... more output ... Running /Users/chrism/projects/pyramid/bin/python setup.py egg_info @@ -245,7 +244,7 @@ The tests themselves are found in the ``tests.py`` module in your ``paster create`` -generated project. Within a project generated by the ``pyramid_starter`` template, a single sample test exists. ``pyramid_starter`` scaffold, a single sample test exists. .. index:: single: interactive shell @@ -377,7 +376,7 @@ Starting server in PID 16601. serving on 0.0.0.0:6543 view at http://127.0.0.1:6543 By default, :app:`Pyramid` applications generated from a ``paster`` template By default, :app:`Pyramid` applications generated from a scaffold will listen on TCP port 6543. You can shut down a server started this way by pressing ``Ctrl-C``. @@ -416,14 +415,14 @@ .. sidebar:: Using an Alternate WSGI Server The code generated by :app:`Pyramid` ``paster`` templates assumes that you The code generated by a :app:`Pyramid` scaffold assumes that you will be using the ``paster serve`` command to start your application while you do development. However, ``paster serve`` is by no means the only way to start up and serve a :app:`Pyramid` application. As we saw in :ref:`firstapp_chapter`, ``paster serve`` needn't be invoked at all to run a :app:`Pyramid` application. The use of ``paster serve`` to run a :app:`Pyramid` application is purely conventional based on the output of its ``paster`` templates. its scaffold. Any :term:`WSGI` server is capable of running a :app:`Pyramid` application. Some WSGI servers don't require the :term:`PasteDeploy` @@ -447,9 +446,9 @@ The Project Structure --------------------- The ``pyramid_starter`` template generated a :term:`project` (named The ``pyramid_starter`` scaffold generated a :term:`project` (named ``MyProject``), which contains a Python :term:`package`. The package is *also* named ``myproject``, but it's lowercased; the paster template *also* named ``myproject``, but it's lowercased; the scaffold generates a project which contains a package that shares its name except for case. @@ -614,7 +613,7 @@ .. note:: In general, :app:`Pyramid` applications generated from paster templates In general, :app:`Pyramid` applications generated from scaffolds should be threading-aware. It is not required that a :app:`Pyramid` application be nonblocking as all application code will run in its own thread, provided by the server you're using. @@ -720,7 +719,7 @@ ``myproject/templates/mytemplate.pt`` file would not be included in the generated tarball. Projects generated by Pyramid paster templates include a default Projects generated by Pyramid scaffolds include a default ``MANIFEST.in`` file. The ``MANIFEST.in`` file contains declarations which tell it to include files like ``*.pt``, ``*.css`` and ``*.js`` in the generated tarball. If you include files with extensions other than @@ -780,7 +779,7 @@ #. A ``views.py`` module, which contains view code for the application. These are purely conventions established by the ``paster`` template: These are purely conventions established by the scaffold: :app:`Pyramid` doesn't insist that you name things in any particular way. However, it's generally a good idea to follow Pyramid standards for naming, so that other Pyramid developers can get up to speed quickly on your code @@ -950,18 +949,18 @@ ---------------------------- It is best practice for your application's code layout to not stray too much from accepted Pyramid paster template defaults. If you refrain from changing from accepted Pyramid scaffold defaults. If you refrain from changing things very much, other Pyramid coders will be able to more quickly understand your application. However, the code layout choices made for you by a paster template are in no way magical or required. Despite the choices made for you by any paster template, you can decide to lay your code out any by a scaffold are in no way magical or required. Despite the choices made for you by any scaffold, you can decide to lay your code out any way you see fit. For example, the configuration method named :meth:`~pyramid.config.Configurator.add_view` requires you to pass a :term:`dotted Python name` or a direct object reference as the class or function to be used as a view. By default, the ``pyramid_starter`` paster template would have you add view functions to the ``views.py`` module in your function to be used as a view. By default, the ``pyramid_starter`` scaffold would have you add view functions to the ``views.py`` module in your package. However, you might be more comfortable creating a ``views`` *directory*, and adding a single file for each view. docs/narr/urldispatch.rst
@@ -946,7 +946,7 @@ .. note:: This is only an example. In particular, it is not necessary to cause ``DBSession.remove`` to be called in an application generated from any :app:`Pyramid` paster template, because these all use the any :app:`Pyramid` scaffold, because these all use the ``repoze.tm2`` middleware. The cleanup done by ``DBSession.remove`` is unnecessary when ``repoze.tm2`` middleware is in the WSGI pipeline. docs/tutorials/bfg/index.rst
@@ -117,7 +117,7 @@ (if you've been using the example paths, this will be ``/tmp/bfgapp/setup.py``) to depend on the ``pyramid`` distribution instead the of ``repoze.bfg`` distribution in its ``install_requires`` list. If you used a ``paster`` template to ``install_requires`` list. If you used a scaffold to create the :mod:`repoze.bfg` application, you can do so by changing the ``requires`` line near the top of the ``setup.py`` file. The original may look like this: docs/tutorials/modwsgi/index.rst
@@ -79,7 +79,7 @@ The first argument to ``get_app`` is the project Paste configuration file name. It's best to use the ``production.ini`` file provided by your Pyramid paster template, as it contains settings appropriate for scaffold, as it contains settings appropriate for production. The second is the name of the section within the .ini file that should be loaded by ``mod_wsgi``. The assignment to the name ``application`` is important: mod_wsgi requires finding such an docs/tutorials/wiki/basiclayout.rst
@@ -2,7 +2,7 @@ Basic Layout ============ The starter files generated by the ``pyramid_zodb`` template are basic, but The starter files generated by the ``pyramid_zodb`` scaffold are basic, but they provide a good orientation for the high-level patterns common to most :term:`traversal` -based :app:`Pyramid` (and :term:`ZODB` based) projects. @@ -79,7 +79,7 @@ tree represents the site structure, but it *also* represents the :term:`domain model` of the application, because each resource is a node stored persistently in a :term:`ZODB` database. The ``models.py`` file is where the ``pyramid_zodb`` Paster template put the classes that implement our where the ``pyramid_zodb`` scaffold put the classes that implement our resource objects, each of which happens also to be a domain model object. Here is the source for ``models.py``: @@ -110,7 +110,7 @@ Views With ``views.py`` ----------------------- Our paster template generated a default ``views.py`` on our behalf. It Our scaffold generated a default ``views.py`` on our behalf. It contains a single view, which is used to render the page shown when you visit the URL ``http://localhost:6543/``. @@ -153,7 +153,7 @@ #. *Lines 5-6*. We define a :term:`view callable` named ``my_view``, which we decorated in the step above. This view callable is a *function* we write generated by the ``pyramid_zodb`` template that is given a write generated by the ``pyramid_zodb`` scaffold that is given a ``request`` and which returns a dictionary. The ``mytemplate.pt`` :term:`renderer` named by the asset specification in the step above will convert this dictionary to a :term:`response` on our behalf. docs/tutorials/wiki/installation.rst
@@ -131,8 +131,8 @@ ================ Your next step is to create a project. :app:`Pyramid` supplies a variety of templates to generate sample projects. For this tutorial, we will use the :term:`ZODB` -oriented template named ``pyramid_zodb``. variety of scaffolds to generate sample projects. For this tutorial, we will use the :term:`ZODB` -oriented scaffold named ``pyramid_zodb``. The below instructions assume your current working directory is the "virtualenv" named "pyramidtut". @@ -149,7 +149,7 @@ c:\pyramidtut> Scripts\paster create -t pyramid_zodb tutorial .. note:: If you are using Windows, the ``pyramid_zodb`` Paster template .. note:: If you are using Windows, the ``pyramid_zodb`` Paster scaffold doesn't currently deal gracefully with installation into a location that contains spaces in the path. If you experience startup problems, try putting both the virtualenv and the project into @@ -237,7 +237,7 @@ c:\pyramidtut\tutorial> ..\Scripts\nosetests --cover-package=tutorial \ --cover-erase --with-coverage Looks like the code in the ``pyramid_zodb`` template for ZODB projects is Looks like the code in the ``pyramid_zodb`` scaffold for ZODB projects is missing some test coverage, particularly in the file named ``models.py``. @@ -247,10 +247,10 @@ In a browser, visit `http://localhost:6543/ <http://localhost:6543>`_. You will see the generated application's default page. Decisions the ``pyramid_zodb`` Template Has Made For You Decisions the ``pyramid_zodb`` Scaffold Has Made For You ======================================================== Creating a project using the ``pyramid_zodb`` template makes the following Creating a project using the ``pyramid_zodb`` scaffold makes the following assumptions: - you are willing to use :term:`ZODB` as persistent storage docs/tutorials/wiki2/basiclayout.rst
@@ -2,7 +2,7 @@ Basic Layout ============ The starter files generated by the ``pyramid_routesalchemy`` template are The starter files generated by the ``pyramid_routesalchemy`` scaffold are basic, but they provide a good orientation for the high-level patterns common to most :term:`url dispatch` -based :app:`Pyramid` projects. @@ -88,7 +88,7 @@ be called when the URL ``/`` is visted, e.g. ``http://localhost:6543/``. The argument named ``view`` with the value ``tutorial.views.my_view`` is the dotted name to a *function* we write (generated by the ``pyramid_routesalchemy`` template) that is given a ``request`` object and ``pyramid_routesalchemy`` scaffold) that is given a ``request`` object and which returns a response or a dictionary. You will use :meth:`pyramid.config.Configurator.add_route` statements in a @@ -117,8 +117,8 @@ In a SQLAlchemy-based application, a *model* object is an object composed by querying the SQL database which backs an application. SQLAlchemy is an "object relational mapper" (an ORM). The ``models.py`` file is where the ``pyramid_routesalchemy`` Paster template put the classes that implement our models. ``models.py`` file is where the ``pyramid_routesalchemy`` scaffold put the classes that implement our models. Let's take a look. First, we need some imports to support later code. docs/tutorials/wiki2/installation.rst
@@ -83,8 +83,8 @@ ================ Your next step is to create a project. :app:`Pyramid` supplies a variety of templates to generate sample projects. We will use the ``pyramid_routesalchemy`` template, which generates an application variety of scaffolds to generate sample projects. We will use the ``pyramid_routesalchemy`` scaffold, which generates an application that uses :term:`SQLAlchemy` and :term:`URL dispatch`. The below instructions assume your current working directory is the @@ -103,7 +103,7 @@ c:\pyramidtut> Scripts\paster create -t pyramid_routesalchemy tutorial .. note:: If you are using Windows, the ``pyramid_routesalchemy`` Paster template may not deal gracefully with installation into a scaffold may not deal gracefully with installation into a location that contains spaces in the path. If you experience startup problems, try putting both the virtualenv and the project into directories that do not contain spaces in their paths. @@ -217,10 +217,10 @@ In a browser, visit ``http://localhost:6543/``. You will see the generated application's default page. Decisions the ``pyramid_routesalchemy`` Template Has Made For You Decisions the ``pyramid_routesalchemy`` Scaffold Has Made For You ================================================================= Creating a project using the ``pyramid_routesalchemy`` template makes Creating a project using the ``pyramid_routesalchemy`` scaffold makes the following assumptions: - you are willing to use :term:`SQLAlchemy` as a database access tool docs/whatsnew-1.0.rst
@@ -16,7 +16,7 @@ - BFG conversion script - Paster template improvements - Scaffold improvements - Terminology changes @@ -94,24 +94,24 @@ of an existing :mod:`repoze.bfg` application to Pyramid. The process is described in :ref:`converting_a_bfg_app`. Paster Template Improvements Scaffold Improvements ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - The paster templates now have much nicer CSS and graphics. - The scaffolds now have much nicer CSS and graphics. - The ``development.ini`` generated by all paster templates is now configured - The ``development.ini``, generated by all scaffolds, is now configured to use the :term:`WebError` interactive exception debugger by default. - All paster templates have been normalized: each now uses the name ``main`` - All scaffolds have been normalized: each now uses the name ``main`` to represent the function that returns a WSGI application, and each now has roughly the same shape of development.ini style. - All preexisting paster templates now use "imperative" configuration - All preexisting scaffolds now use "imperative" configuration (``starter``, ``routesalchemy``, ``alchemy``, ``zodb``) instead of ZCML configuration. - The ``pyramid_zodb``, ``pyramid_routesalchemy`` and ``pyramid_alchemy`` paster templates now use a default "commit veto" hook when configuring the scaffolds now use a default "commit veto" hook when configuring the ``repoze.tm2`` transaction manager in ``development.ini``. This prevents a transaction from being committed when the response status code is within the 400 or 500 ranges. See also @@ -151,7 +151,7 @@ - All documentation which previously referred to "model" now refers to "resource". - The ``starter`` paster template now has a ``resources.py`` module instead - The ``starter`` scaffold now has a ``resources.py`` module instead of a ``models.py`` module. - Positional argument names of various APIs have been changed from @@ -177,6 +177,11 @@ - The setting previously known as ``BFG_RELOAD_RESOURCES`` (envvar) or ``reload_resources`` (config file) is now known, respectively, as ``PYRAMID_RELOAD_ASSETS`` and ``reload_assets``. - The term 'template' used to refer to both 'paster templates' and 'rendered templates'(templates created by a rendering engine. i.e. Mako, Chameleon, Jinja, etc.). 'Paster templates' will now be refered to as 'scaffolds,' whereas the name for 'rendered templates' will remain as 'templates.' Better Platform Compatibility and Support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -260,7 +265,7 @@ - Most references to ZCML in narrative chapters have been removed or redirected to ``pyramid_zcml`` locations. - The ``starter_zcml`` paster template has been moved to the ``pyramid_zcml`` - The ``starter_zcml`` paster scaffold has been moved to the ``pyramid_zcml`` package. Imperative Two-Phase Configuration @@ -279,7 +284,7 @@ more info. Surrounding application configuration with ``config.begin()`` and ``config.end()`` is no longer necessary. All paster templates have been ``config.end()`` is no longer necessary. All scaffolds have been changed to no longer call these functions. Better Support for Global Template Variables During Rendering @@ -508,8 +513,7 @@ (``request.registry.settings``). - The decorator previously known as ``pyramid.view.bfg_view`` is now known most formally as :class:`pyramid.view.view_config` in docs and paster templates. most formally as :class:`pyramid.view.view_config` in docs and scaffolds. - Obtaining the ``settings`` object via ``registry.{get|query}Utility(ISettings)`` is now deprecated. Instead,