diff options
| author | Chris McDonough <chrism@plope.com> | 2010-12-18 03:33:35 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2010-12-18 03:33:35 -0500 |
| commit | 92c3e502494714884b7a051721c9b322027369a1 (patch) | |
| tree | 3cd5a871ff5b13cf48be0fec45b9f13c8d451341 /docs | |
| parent | 515d0f977f21bf28602505b859f64f10dd2f5f59 (diff) | |
| download | pyramid-92c3e502494714884b7a051721c9b322027369a1.tar.gz pyramid-92c3e502494714884b7a051721c9b322027369a1.tar.bz2 pyramid-92c3e502494714884b7a051721c9b322027369a1.zip | |
resource -> asset
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api/config.rst | 2 | ||||
| -rw-r--r-- | docs/api/request.rst | 2 | ||||
| -rw-r--r-- | docs/api/traversal.rst | 6 | ||||
| -rw-r--r-- | docs/api/url.rst | 2 | ||||
| -rw-r--r-- | docs/narr/environment.rst | 88 | ||||
| -rw-r--r-- | docs/zcml/aclauthorizationpolicy.rst | 2 | ||||
| -rw-r--r-- | docs/zcml/asset.rst (renamed from docs/zcml/resource.rst) | 33 | ||||
| -rw-r--r-- | docs/zcml/handler.rst | 2 | ||||
| -rw-r--r-- | docs/zcml/route.rst | 2 | ||||
| -rw-r--r-- | docs/zcml/view.rst | 6 |
10 files changed, 75 insertions, 70 deletions
diff --git a/docs/api/config.rst b/docs/api/config.rst index 64dc4d0dd..4b23f3e8e 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -78,7 +78,7 @@ .. automethod:: testing_securitypolicy - .. automethod:: testing_models + .. automethod:: testing_resources .. automethod:: testing_add_subscriber diff --git a/docs/api/request.rst b/docs/api/request.rst index acd66ccf8..13b434a51 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -26,7 +26,7 @@ .. attribute:: root The :term:`root` object will be available as the ``root`` - attribute of the :term:`request` object. It will be the model + attribute of the :term:`request` object. It will be the resource object at which traversal started (the root). See :ref:`traversal_chapter` for information about root objects. diff --git a/docs/api/traversal.rst b/docs/api/traversal.rst index b89691847..cd4765e04 100644 --- a/docs/api/traversal.rst +++ b/docs/api/traversal.rst @@ -7,13 +7,13 @@ .. autofunction:: find_interface - .. autofunction:: find_model + .. autofunction:: find_resource .. autofunction:: find_root - .. autofunction:: model_path + .. autofunction:: resource_path - .. autofunction:: model_path_tuple + .. autofunction:: resource_path_tuple .. autofunction:: quote_path_segment diff --git a/docs/api/url.rst b/docs/api/url.rst index 8c702a3fb..1aa3082b7 100644 --- a/docs/api/url.rst +++ b/docs/api/url.rst @@ -5,7 +5,7 @@ .. automodule:: pyramid.url - .. autofunction:: pyramid.url.model_url(context, request, *elements, query=None, anchor=None) + .. autofunction:: pyramid.url.resource_url(context, request, *elements, query=None, anchor=None) .. autofunction:: route_url diff --git a/docs/narr/environment.rst b/docs/narr/environment.rst index 08fa7af44..8cad9a666 100644 --- a/docs/narr/environment.rst +++ b/docs/narr/environment.rst @@ -3,7 +3,7 @@ single: settings single: reload single: debug_authorization - single: reload_resources + single: reload_assets single: debug_notfound single: debug_all single: reload_all @@ -52,21 +52,25 @@ template rendering extensions. | | | +---------------------------------+-----------------------------+ -Reloading Resources -------------------- +Reloading Assets +---------------- -Don't cache any resource file data when this value is true. See -also :ref:`overriding_resources_section`. +Don't cache any asset file data when this value is true. See +also :ref:`overriding_assets_section`. +---------------------------------+-----------------------------+ | Environment Variable Name | Config File Setting Name | +=================================+=============================+ -| ``BFG_RELOAD_RESOURCES`` | ``reload_resources`` | +| ``BFG_RELOAD_ASSETS` ` | ``reload_assets`` | | | | | | | | | | +---------------------------------+-----------------------------+ +.. note:: For backwards compatibility purposes, the following aliases can be + used for configurating asset reloading: ``BFG_RELOAD_RESOURCES`` (envvar) + and ``reload_resources`` (config file). + Debugging Authorization ----------------------- @@ -174,7 +178,7 @@ Mako Directories ++++++++++++++++ The value(s) supplied here are passed in as the template directories. They -should be in :term:`resource specification` format, for example: +should be in :term:`asset specification` format, for example: ``my.package:templates``. +-----------------------------+ @@ -333,40 +337,38 @@ affect settings that do not start with ``reload_*`` such as .. index:: single: reload_templates - single: reload_resources - -Understanding the Distinction Between ``reload_templates`` and ``reload_resources`` ------------------------------------------------------------------------------------ - -The difference between ``reload_resources`` and ``reload_templates`` -is a bit subtle. Templates are themselves also treated by -:app:`Pyramid` as :term:`pkg_resources` resource files (along with -static files and other resources), so the distinction can be -confusing. It's helpful to read :ref:`overriding_resources_section` -for some context about resources in general. - -When ``reload_templates`` is true, :app:`Pyramid` takes advantage -of the underlying templating systems' ability to check for file -modifications to an individual template file. When -``reload_templates`` is true but ``reload_resources`` is *not* true, -the template filename returned by pkg_resources is cached by -:app:`Pyramid` on the first request. Subsequent requests for the -same template file will return a cached template filename. The -underlying templating system checks for modifications to this -particular file for every request. Setting ``reload_templates`` to -``True`` doesn't affect performance dramatically (although it should -still not be used in production because it has some effect). - -However, when ``reload_resources`` is true, :app:`Pyramid` will not -cache the template filename, meaning you can see the effect of -changing the content of an overridden resource directory for templates -without restarting the server after every change. Subsequent requests -for the same template file may return different filenames based on the -current state of overridden resource directories. Setting -``reload_resources`` to ``True`` affects performance *dramatically*, -slowing things down by an order of magnitude for each template -rendering. However, it's convenient to enable when moving files -around in overridden resource directories. ``reload_resources`` makes -the system *very slow* when templates are in use. Never set -``reload_resources`` to ``True`` on a production system. + single: reload_assets + +Understanding the Distinction Between ``reload_templates`` and ``reload_assets`` +-------------------------------------------------------------------------------- + +The difference between ``reload_assets`` and ``reload_templates`` is a bit +subtle. Templates are themselves also treated by :app:`Pyramid` as asset +files (along with other static files), so the distinction can be confusing. +It's helpful to read :ref:`overriding_assets_section` for some context +about assets in general. + +When ``reload_templates`` is true, :app:`Pyramid` takes advantage of the +underlying templating systems' ability to check for file modifications to an +individual template file. When ``reload_templates`` is true but +``reload_assets`` is *not* true, the template filename returned by the +``pkg_resources`` package (used under the hood by asset resolution) is cached +by :app:`Pyramid` on the first request. Subsequent requests for the same +template file will return a cached template filename. The underlying +templating system checks for modifications to this particular file for every +request. Setting ``reload_templates`` to ``True`` doesn't affect performance +dramatically (although it should still not be used in production because it +has some effect). + +However, when ``reload_assets`` is true, :app:`Pyramid` will not cache the +template filename, meaning you can see the effect of changing the content of +an overridden asset directory for templates without restarting the server +after every change. Subsequent requests for the same template file may +return different filenames based on the current state of overridden asset +directories. Setting ``reload_assets`` to ``True`` affects performance +*dramatically*, slowing things down by an order of magnitude for each +template rendering. However, it's convenient to enable when moving files +around in overridden asset directories. ``reload_assets`` makes the system +*very slow* when templates are in use. Never set ``reload_assets`` to +``True`` on a production system. diff --git a/docs/zcml/aclauthorizationpolicy.rst b/docs/zcml/aclauthorizationpolicy.rst index 2c66da0c8..f09531415 100644 --- a/docs/zcml/aclauthorizationpolicy.rst +++ b/docs/zcml/aclauthorizationpolicy.rst @@ -4,7 +4,7 @@ -------------------------- When this directive is used, authorization information is obtained -from :term:`ACL` objects attached to model instances. +from :term:`ACL` objects attached to :term:`resource` objects. Attributes ~~~~~~~~~~ diff --git a/docs/zcml/resource.rst b/docs/zcml/asset.rst index 3f7c58faa..af7a6db94 100644 --- a/docs/zcml/resource.rst +++ b/docs/zcml/asset.rst @@ -1,51 +1,51 @@ -.. _resource_directive: +.. _asset_directive: -``resource`` ------------- +``asset`` +--------- -The ``resource`` directive adds a resource override for a single -resource. +The ``asset`` directive adds an asset override for a single +static file/directory asset. Attributes ~~~~~~~~~~ ``to_override`` - A :term:`resource specification` specifying the resource to be + A :term:`asset specification` specifying the asset to be overridden. ``override_with`` - A :term:`resource specification` specifying the resource which + A :term:`asset specification` specifying the asset which is used as the override. Examples ~~~~~~~~ -.. topic:: Overriding a Single Resource File +.. topic:: Overriding a Single Asset File .. code-block:: xml :linenos: - <resource + <asset to_override="some.package:templates/mytemplate.pt" override_with="another.package:othertemplates/anothertemplate.pt" /> -.. topic:: Overriding all Resources in a Package +.. topic:: Overriding all Assets in a Package .. code-block:: xml :linenos: - <resource + <asset to_override="some.package" override_with="another.package" /> -.. topic:: Overriding all Resources in a Subdirectory of a Package +.. topic:: Overriding all Assets in a Subdirectory of a Package .. code-block:: xml :linenos: - <resource + <asset to_override="some.package:templates/" override_with="another.package:othertemplates/" /> @@ -53,10 +53,13 @@ Examples Alternatives ~~~~~~~~~~~~ -The :meth:`pyramid.config.Configurator.override_resource` +The :meth:`pyramid.config.Configurator.override_asset` method can be used instead of the ``resource`` ZCML directive. +This directive can also be invoked as the ``resource`` ZCML directive for +backwards compatibility purposes. + See Also ~~~~~~~~ -See also :ref:`resource_zcml_directive`. +See also :ref:`asset_zcml_directive`. diff --git a/docs/zcml/handler.rst b/docs/zcml/handler.rst index 301bf7895..01d442ab6 100644 --- a/docs/zcml/handler.rst +++ b/docs/zcml/handler.rst @@ -28,7 +28,7 @@ Attributes ``factory`` The :term:`dotted Python name` to a function that will generate a :app:`Pyramid` context object when the associated route matches. - e.g. ``mypackage.models.MyFactoryClass``. If this argument is not + e.g. ``mypackage.resources.MyResource``. If this argument is not specified, a default root factory will be used. ``xhr`` diff --git a/docs/zcml/route.rst b/docs/zcml/route.rst index 4f7cdb955..ac9261e27 100644 --- a/docs/zcml/route.rst +++ b/docs/zcml/route.rst @@ -25,7 +25,7 @@ Attributes ``factory`` The :term:`dotted Python name` to a function that will generate a :app:`Pyramid` context object when this route matches. - e.g. ``mypackage.models.MyFactoryClass``. If this argument is not + e.g. ``mypackage.resources.MyResource``. If this argument is not specified, a default root factory will be used. ``view`` diff --git a/docs/zcml/view.rst b/docs/zcml/view.rst index 74d497cb3..6887f88fb 100644 --- a/docs/zcml/view.rst +++ b/docs/zcml/view.rst @@ -157,7 +157,7 @@ Predicate Attributes representing the class that a graph traversal parent object of the :term:`context` must be an instance of (or :term:`interface` that a parent object must provide) in order for this view to be found and - called. Your models must be "location-aware" to use this feature. + called. Your resources must be "location-aware" to use this feature. See :ref:`location_aware` for more information about location-awareness. @@ -222,7 +222,7 @@ Examples :linenos: <view - context=".models.MyModel" + context=".resources.MyResource" view=".views.hello_world" /> @@ -232,7 +232,7 @@ Examples :linenos: <view - context=".models.MyModel" + context=".resources.MyResource" view=".views.hello_world_post" request_method="POST" /> |
