From fb6a5ce52a275f7798e82a34b5907ea118cbd2ff Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 18 Dec 2010 02:27:14 -0500 Subject: model -> resource; resource -> asset --- docs/narr/project.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/narr/project.rst') diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 2b03f7373..65ef3c526 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -258,8 +258,8 @@ The Interactive Shell Once you've installed your program for development using ``setup.py develop``, you can use an interactive Python shell to examine your -:app:`Pyramid` application :term:`model` and :term:`view` objects from -a Python prompt. To do so, use the ``paster`` shell command with the +:app:`Pyramid` application :term:`resource` and :term:`view` objects from a +Python prompt. To do so, use the ``paster`` shell command with the ``pshell`` argument: The first argument to ``pshell`` is the path to your application's ``.ini`` @@ -290,7 +290,7 @@ the name ``MyProject`` as a section name: Type "help" for more information. "root" is the Pyramid app root object, "registry" is the Pyramid registry object. >>> root - + >>> registry >>> registry.settings['debug_notfound'] @@ -868,7 +868,7 @@ named ``MyModel`` that provides the behavior. #. Line 6 is a "root factory" function that will be called by the :app:`Pyramid` *Router* for each request when it wants to find - the root of the object graph. Conventionally this is called + the root of the resource tree. Conventionally this is called ``get_root``. In a "real" application, the root object would not be such a simple -- cgit v1.2.3 From ef3bd570ad4f4060ddd6a8ec83d53fb8d42fed40 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 18 Dec 2010 02:50:22 -0500 Subject: model -> resource --- docs/narr/project.rst | 53 +++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) (limited to 'docs/narr/project.rst') diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 65ef3c526..27974d8df 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -468,7 +468,7 @@ structure: |-- development.ini |-- myproject | |-- __init__.py - | |-- models.py + | |-- resources.py | |-- static | | |-- favicon.ico | | |-- logo.png @@ -738,7 +738,7 @@ The ``myproject`` :term:`package` lives inside the ``MyProject`` application, include a ``main`` function which is used as a Paste entry point. -#. A ``models.py`` module, which contains :term:`model` code. +#. A ``resources.py`` module, which contains :term:`resource` code. #. A ``templates`` directory, which contains :term:`Chameleon` (or other types of) templates. @@ -771,8 +771,8 @@ also informs Python that the directory which contains it is a *package*. #. Line 1 imports the :term:`Configurator` class from :mod:`pyramid.config` that we use later. -#. Line 2 imports the ``get_root`` function from - :mod:`myproject.models` that we use later. +#. Line 2 imports the ``Root`` class from :mod:`myproject.resources` that we + use later. #. Lines 4-12 define a function that returns a :app:`Pyramid` WSGI application. This function is meant to be called @@ -784,7 +784,7 @@ also informs Python that the directory which contains it is a *package*. Lines 8-10 register a "default view" (a view that has no ``name`` attribute). It is registered so that it will be found when the :term:`context` of the request is an instance of the - :class:`myproject.models.MyModel` class. The first argument to + :class:`myproject.resources.Root` class. The first argument to ``add_view`` points at a Python function that does all the work for this view, also known as a :term:`view callable`, via a :term:`dotted Python name`. The view declaration also names a ``renderer``, which in this case @@ -817,7 +817,7 @@ code which accepts a :term:`request` and which returns a This bit of code was registered as the view callable within ``__init__.py`` (via ``add_view``). ``add_view`` said that the default URL for instances -that are of the class :class:`myproject.models.MyModel` should run this +that are of the class :class:`myproject.resources.Root` should run this :func:`myproject.views.my_view` function. This view callable function is handed a single piece of information: @@ -846,37 +846,32 @@ renderers, and templates relate and cooperate. the speed at which templates may be rendered. .. index:: - single: models.py + single: resources.py -.. _modelspy_project_section: +.. _resourcespy_project_section: -``models.py`` -~~~~~~~~~~~~~ +``resources.py`` +~~~~~~~~~~~~~~~~ -The ``models.py`` module provides the :term:`model` data and behavior -for our application. Models are objects which store application data -and provide APIs which mutate and return this data. We write a class -named ``MyModel`` that provides the behavior. +The ``resources.py`` module provides the :term:`resource` data and behavior +for our application. Resources are objects which exist to provide site +structure in applications which use :term:`traversal` to map URLs to code. +We write a class named ``Root`` that provides the behavior for the root +resource. -.. literalinclude:: MyProject/myproject/models.py +.. literalinclude:: MyProject/myproject/resources.py :language: python :linenos: -#. Lines 1-2 define the MyModel class. - -#. Line 4 defines an instance of MyModel as the root. - -#. Line 6 is a "root factory" function that will be called by the - :app:`Pyramid` *Router* for each request when it wants to find - the root of the resource tree. Conventionally this is called - ``get_root``. +#. Lines 1-3 define the Root class. The Root class is a "root resource + factory" function that will be called by the :app:`Pyramid` *Router* for + each request when it wants to find the root of the resource tree. -In a "real" application, the root object would not be such a simple -object. Instead, it would be an object that could access some -persistent data store, such as a database. :app:`Pyramid` doesn't -make any assumption about which sort of datastore you'll want to use, -so the sample application uses an instance of -:class:`myproject.models.MyModel` to represent the root. +In a "real" application, the Root object would not be such a simple object. +Instead, it might be an object that could access some persistent data store, +such as a database. :app:`Pyramid` doesn't make any assumption about which +sort of datastore you'll want to use, so the sample application uses an +instance of :class:`myproject.resources.Root` to represent the root. ``static`` ~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From a5ffd62175a09402fbe37ec8c2077873e0a35903 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 18 Dec 2010 15:12:46 -0500 Subject: model->resource; make docs render without warnings --- docs/narr/project.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/narr/project.rst') diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 27974d8df..ff03a57b8 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -790,13 +790,13 @@ also informs Python that the directory which contains it is a *package*. name`. The view declaration also names a ``renderer``, which in this case is a template that will be used to render the result of the view callable. This particular view declaration points at - ``myproject:templates/mytemplate.pt``, which is a :term:`resource + ``myproject:templates/mytemplate.pt``, which is a :term:`asset specification` that specifies the ``mytemplate.pt`` file within the ``templates`` directory of the ``myproject`` package. The template file it actually points to is a :term:`Chameleon` ZPT template file. Line 11 registers a static view, which will serve up the files from the - ``mypackage:static`` :term:`resource specification` (the ``static`` + ``mypackage:static`` :term:`asset specification` (the ``static`` directory of the ``mypackage`` package). Line 12 returns a :term:`WSGI` application to the caller of the function @@ -874,10 +874,10 @@ sort of datastore you'll want to use, so the sample application uses an instance of :class:`myproject.resources.Root` to represent the root. ``static`` -~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~ -This directory contains static resources which support the -``mytemplate.pt`` template. It includes CSS and images. +This directory contains static assets which support the ``mytemplate.pt`` +template. It includes CSS and images. .. index:: single: tests.py -- cgit v1.2.3