| | |
| | | |
| | | #. *Lines 1-3*. Perform some dependency imports. |
| | | |
| | | #. *Lines 5-7* Define a root factory for our Pyramid application. |
| | | #. *Lines 6-8* Define a root factory for our Pyramid application. |
| | | |
| | | #. *Line 12*. We construct a :term:`Configurator` with a :term:`root |
| | | #. *Line 14*. We construct a :term:`Configurator` with a :term:`root |
| | | factory` and the settings keywords parsed by :term:`PasteDeploy`. The root |
| | | factory is named ``root_factory``. |
| | | |
| | | #. *Line 13*. Register a 'static view' which answers requests which start |
| | | #. *Line 15*. Register a 'static view' which answers requests which start |
| | | with with URL path ``/static`` using the |
| | | :meth:`pyramid.config.Configurator.add_static_view method`. This |
| | | statement registers a view that will serve up static assets, such as CSS |
| | |
| | | package. The scaffold could have alternately used an *absolute* asset |
| | | specification as the path (``tutorial:static``) but it does not. |
| | | |
| | | #. *Line 14*. Perform a :term:`scan`. A scan will find :term:`configuration |
| | | #. *Line 16*. Perform a :term:`scan`. A scan will find :term:`configuration |
| | | decoration`, such as view configuration decorators (e.g. ``@view_config``) |
| | | in the source code of the ``tutorial`` package and will take actions based |
| | | on these decorators. We don't pass any arguments to |
| | |
| | | The scaffold could have equivalently said ``config.scan('tutorial')`` but |
| | | it chose to omit the package name argument. |
| | | |
| | | #. *Line 15*. Use the |
| | | #. *Line 17*. Use the |
| | | :meth:`pyramid.config.Configurator.make_wsgi_app` method |
| | | to return a :term:`WSGI` application. |
| | | |
| | |
| | | :linenos: |
| | | :language: py |
| | | |
| | | #. *Lines 3-4*. The ``MyModel`` :term:`resource` class is implemented here. |
| | | #. *Lines 4-5*. The ``MyModel`` :term:`resource` class is implemented here. |
| | | Instances of this class will be capable of being persisted in :term:`ZODB` |
| | | because the class inherits from the |
| | | :class:`persistent.mapping.PersistentMapping` class. The ``__parent__`` |
| | |
| | | By default, have these as ``None`` indicating that this is the |
| | | :term:`root` object. |
| | | |
| | | #. *Lines 6-12*. ``appmaker`` is used to return the *application |
| | | #. *Lines 8-14*. ``appmaker`` is used to return the *application |
| | | root* object. It is called on *every request* to the |
| | | :app:`Pyramid` application. It also performs bootstrapping by |
| | | *creating* an application root (inside the ZODB root object) if one |
| | |
| | | |
| | | #. *Lines 1-2*. Perform some dependency imports. |
| | | |
| | | #. *Line 4*. Use the :func:`pyramid.view.view_config` :term:`configuration |
| | | #. *Line 5*. Use the :func:`pyramid.view.view_config` :term:`configuration |
| | | decoration` to perform a :term:`view configuration` registration. This |
| | | view configuration registration will be activated when the application is |
| | | started. It will be activated by virtue of it being found as the result |
| | |
| | | ``my_view`` function which it decorates represents the "default" view |
| | | callable used when the context is of the type ``MyModel``. |
| | | |
| | | #. *Lines 5-6*. We define a :term:`view callable` named ``my_view``, which |
| | | #. *Lines 6-7*. 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 ``zodb`` scaffold that is given a |
| | | ``request`` and which returns a dictionary. The ``mytemplate.pt`` |