From afa1cb6352fd39d8b0788c7708768aaca2974385 Mon Sep 17 00:00:00 2001 From: Casey Duncan Date: Mon, 20 Dec 2010 23:33:08 -0700 Subject: promote parenthetical to an actual sentence, minor reword --- docs/narr/resources.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/narr/resources.rst') diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst index fe1f760bb..4c2897ac8 100644 --- a/docs/narr/resources.rst +++ b/docs/narr/resources.rst @@ -3,8 +3,8 @@ Resources A :term:`resource` is an object that represents a "place" in a tree related to your application. Every :app:`Pyramid` application has at least one -resource object: the :term:`root` resource (even if you don't define one -manually, a default root resource is created for you). The root resource is +resource object: the :term:`root` resource. Even if you don't define a +root resource manually, a default one is created for you. The root resource is the root of a :term:`resource tree`. A resource tree is a set of nested dictionary-like objects which you can use to represent your website's structure. -- cgit v1.2.3 From 14575f52880028537594eb06b35f2b39dd9818c9 Mon Sep 17 00:00:00 2001 From: Casey Duncan Date: Mon, 20 Dec 2010 23:37:39 -0700 Subject: reword, reorder paragraph for clarity --- docs/narr/resources.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'docs/narr/resources.rst') diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst index 4c2897ac8..7b31a8260 100644 --- a/docs/narr/resources.rst +++ b/docs/narr/resources.rst @@ -1,21 +1,21 @@ Resources ========= -A :term:`resource` is an object that represents a "place" in a tree related -to your application. Every :app:`Pyramid` application has at least one -resource object: the :term:`root` resource. Even if you don't define a -root resource manually, a default one is created for you. The root resource is -the root of a :term:`resource tree`. A resource tree is a set of nested -dictionary-like objects which you can use to represent your website's -structure. +A :term:`resource` is an object that represents a "place" in a tree +related to your application. Every :app:`Pyramid` application has at +least one resource object: the :term:`root` resource. Even if you don't +define a root resource manually, a default one is created for you. The +root resource is the root of a :term:`resource tree`. A resource tree +is a set of nested dictionary-like objects which you can use to +represent your website's structure. In an application which uses :term:`traversal` to map URLs to code, the -resource tree structure is used heavily to map a URL to a :term:`view -callable`. :app:`Pyramid` will walk "up" the resource tree by traversing -through the nested dictionary structure of the tree when :term:`traversal` is -used in order to find a :term:`context` resource. Once a context resource is -found, the context resource and data in the request will be used to find a -:term:`view callable`. +resource tree structure is used heavily to map each URL to a :term:`view +callable`. When :term:`traversal` is used, :app:`Pyramid` will walk +through the resource tree by traversing through its nested dictionary +structure in order to find a :term:`context` resource. Once a context +resource is found, the context resource and data in the request will be +used to find a :term:`view callable`. In an application which uses :term:`URL dispatch`, the resource tree is only used indirectly, and is often "invisible" to the developer. In URL dispatch -- cgit v1.2.3 From 5f0a81a0fd40afcabd4e8f3185136f829193d4bc Mon Sep 17 00:00:00 2001 From: Casey Duncan Date: Mon, 20 Dec 2010 23:46:30 -0700 Subject: make it clear that leaf resource's __getitem__ must always raise KeyError --- docs/narr/resources.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/narr/resources.rst') diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst index 7b31a8260..6350f01ec 100644 --- a/docs/narr/resources.rst +++ b/docs/narr/resources.rst @@ -26,7 +26,7 @@ much less important in applications that use URL dispatch than applications that use traversal. In "Zope-like" :app:`Pyramid` applications, resource objects also often store -data persistently and offer methods related to mutating that persistent data. +data persistently, and offer methods related to mutating that persistent data. In these kinds of applications, resources not only represent the site structure of your website, but they become the :term:`domain model` of the application. @@ -72,8 +72,8 @@ tree: the container's ``__getitem__`` should return the sub-resource. - Leaf resources, which do not contain other resources, must not implement a - ``__getitem__``, or if they do, their ``__getitem__`` method must raise a - :exc:`KeyError`. + ``__getitem__``, or if they do, their ``__getitem__`` method must always + raise a :exc:`KeyError`. See :ref:`traversal_chapter` for more information about how traversal works against resource instances. -- cgit v1.2.3 From c661f30d1ad82baedb2847d5ba65b8f85311e9e5 Mon Sep 17 00:00:00 2001 From: Casey Duncan Date: Tue, 21 Dec 2010 00:01:07 -0700 Subject: remove word typically to improve flow --- docs/narr/resources.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/narr/resources.rst') diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst index 6350f01ec..2485689a4 100644 --- a/docs/narr/resources.rst +++ b/docs/narr/resources.rst @@ -239,7 +239,7 @@ A slash is appended to all resource URLs when :func:`~pyramid.url.resource_url` is used to generate them in this simple manner, because resources are "places" in the hierarchy, and URLs are meant to be clicked on to be visited. Relative URLs that you include on HTML pages -rendered as the result of the default view of a resource are typically more +rendered as the result of the default view of a resource are more apt to be relative to these resources than relative to their parent. You can also pass extra elements to :func:`~pyramid.url.resource_url`: -- cgit v1.2.3 From 4a10119ecd49316b38c556ef720b515a0c5f7a22 Mon Sep 17 00:00:00 2001 From: Casey Duncan Date: Tue, 21 Dec 2010 00:07:36 -0700 Subject: add missing space --- docs/narr/resources.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/narr/resources.rst') diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst index 2485689a4..69dbc0af6 100644 --- a/docs/narr/resources.rst +++ b/docs/narr/resources.rst @@ -399,7 +399,7 @@ Obtaining the Lineage of a Resource ----------------------------------- :func:`pyramid.location.lineage` returns a generator representing the -:term:`lineage` of the :term:`location` aware:term:`resource` object. +:term:`lineage` of the :term:`location` aware :term:`resource` object. The :func:`~pyramid.location.lineage` function returns the resource it is passed, then each parent of the resource, in order. For example, if the -- cgit v1.2.3