From 9d97b654057e621c4928fe597053d54aa5f63a8c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 3 Dec 2011 03:00:15 -0500 Subject: add skeleton for using introspection chapter --- docs/narr/introspector.rst | 89 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 docs/narr/introspector.rst (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst new file mode 100644 index 000000000..3cbafa010 --- /dev/null +++ b/docs/narr/introspector.rst @@ -0,0 +1,89 @@ +.. index:: + single: introspection + single: introspector + +.. _using_introspection: + +Pyramid Configuration Introspection +=================================== + +When Pyramid starts up, each call to a :term:`configuration directive` causes +one or more :term:`introspectable` objects to be registered with an +:term:`introspector`. This introspector can be queried by application code +to obtain information about the configuration of the running application. +This feature is useful for debug toolbars, command-line scripts which show +some aspect of configuration, and for runtime reporting of startup-time +configuration settings. + +Using the Introspector +---------------------- + +Here's an example of using Pyramid's introspector: + +.. code-block:: python + :linenos: + + from pyramid.view import view_config + from pyramid.response import Response + + @view_config(route_name='foo') + @view_config(route_name='bar') + def route_accepts(request): + introspector = request.registry.introspector + route_name = request.matched_route.name + route_intr = introspector.get('routes', route_name) + return Response(str(route_intr['accept'])) + +This view will return a response that contains the "accept" argument provided +to the ``add_route`` method of the route which matched when the view was +called. It used the :meth:`pyramid.interfaces.IIntrospector.get` method to +return an introspectable in the category ``routes`` with a +:term:`discriminator` equal to the matched route name. It then used the +returned introspectable to obtain an "accept" value. + +The introspector has a number of other query-related methods: see +:class:`pyramid.interfaces.IIntrospector` for more information. The +introspectable returned by the query methods of the introspector has methods +and attributes described by :class:`pyramid.interfaces.IIntrospectable`. + +Concrete Introspection Categories +--------------------------------- + +This is a list of concrete introspection categories provided by Pyramid. + +``subscribers`` + +``response adapters`` + +``asset overrides`` + +``root factories`` + +``session factory`` + +``request factory`` + +``locale negotiator`` + +``translation directories`` + +``renderer factories`` + +``routes`` + +``authentication policy`` + +``authorization policy`` + +``default permission`` + +``tweens (implicit)`` + +``views`` + +``templates`` + +``permissions`` + +``view mapper`` + -- cgit v1.2.3 From 5224059f71d0ad592a611c196a3af7cbd1dc828f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 3 Dec 2011 16:24:34 -0500 Subject: add more content to the introspectables narr chapter; adjust introspection registrations while doing so --- docs/narr/introspector.rst | 425 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 401 insertions(+), 24 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 3cbafa010..8adfde7d1 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -9,16 +9,17 @@ Pyramid Configuration Introspection When Pyramid starts up, each call to a :term:`configuration directive` causes one or more :term:`introspectable` objects to be registered with an -:term:`introspector`. This introspector can be queried by application code -to obtain information about the configuration of the running application. -This feature is useful for debug toolbars, command-line scripts which show -some aspect of configuration, and for runtime reporting of startup-time +:term:`introspector`. The introspector can be queried by application code to +obtain information about the configuration of the running application. This +feature is useful for debug toolbars, command-line scripts which show some +aspect of configuration, and for runtime reporting of startup-time configuration settings. Using the Introspector ---------------------- -Here's an example of using Pyramid's introspector: +Here's an example of using Pyramid's introspector from within a view +callable: .. code-block:: python :linenos: @@ -26,64 +27,440 @@ Here's an example of using Pyramid's introspector: from pyramid.view import view_config from pyramid.response import Response - @view_config(route_name='foo') @view_config(route_name='bar') def route_accepts(request): introspector = request.registry.introspector route_name = request.matched_route.name route_intr = introspector.get('routes', route_name) - return Response(str(route_intr['accept'])) + return Response(str(route_intr['pattern'])) -This view will return a response that contains the "accept" argument provided -to the ``add_route`` method of the route which matched when the view was -called. It used the :meth:`pyramid.interfaces.IIntrospector.get` method to -return an introspectable in the category ``routes`` with a -:term:`discriminator` equal to the matched route name. It then used the -returned introspectable to obtain an "accept" value. +This view will return a response that contains the "pattern" argument +provided to the ``add_route`` method of the route which matched when the view +was called. It uses the :meth:`pyramid.interfaces.IIntrospector.get` method +to return an introspectable in the category ``routes`` with a +:term:`discriminator` equal to the matched route name. It then uses the +returned introspectable to obtain an "pattern" value. -The introspector has a number of other query-related methods: see -:class:`pyramid.interfaces.IIntrospector` for more information. The -introspectable returned by the query methods of the introspector has methods -and attributes described by :class:`pyramid.interfaces.IIntrospectable`. +The introspectable returned by the query methods of the introspector has +methods and attributes described by +:class:`pyramid.interfaces.IIntrospectable`. In particular, the +:meth:`~pyramid.interfaces.IIntrospector.get`, +:meth:`~pyramid.interfaces.IIntrospector.get_category`, +:meth:`~pyramid.interfaces.IIntrospector.categories`, +:meth:`~pyramid.interfaces.IIntrospector.categorized`, and +:meth:`~pyramid.interfaces.IIntrospector.related` methods of an introspector +can be used to query for introspectables. -Concrete Introspection Categories ---------------------------------- +Introspectable Objects +---------------------- + +Introspectable objects are returned from query methods of an introspector. +Each introspectable object implements the attributes and methods the +documented at :class:`pyramid.interfaces.IIntrospectable`. + +The important attributes shared by all introspectables are the following: + +``title`` + + A human-readable text title describing the introspectable + +``category_name`` + + A text category name describing the introspection category to which this + introspectable belongs. It is often a plural if there are expected to be + more than one introspectable registered within the category. + +``discriminator`` + + A hashable object representing the unique value of this introspectable + within its category. + +``discriminator_hash`` -This is a list of concrete introspection categories provided by Pyramid. + The integer hash of the discriminator (useful for using in HTML links). + +``type_name`` + + The text name of a subtype within this introspectable's category. If there + is only one type name in this introspectable's category, this value will + often be a singular version of the category name but it can be an arbitrary + value. + +Besides having the attributes described above, an introspectable is a +dictionary-like object. An introspectable can be queried for data values via +its ``__getitem__``, ``get``, ``keys``, ``values``, or ``items`` methods. +For example: + +.. code-block:: python + :linenos: + + route_intr = introspector.get('routes', 'edit_user') + pattern = route_intr['pattern'] + +Pyramid Introspection Categories +-------------------------------- + +The list of concrete introspection categories provided by built-in Pyramid +configuration directives follows. Add-on packages may supply other +introspectables in categories not described here. ``subscribers`` + Each introspectable in the ``subscribers`` category represents a call to + :meth:`pryamid.config.Configurator.add_subscriber` (or the decorator + equivalent); each will have the following data. + + ``subscriber`` + + The subscriber callable object (the resolution of the ``subscriber`` + argument passed to ``add_susbcriber``). + + ``interfaces`` + + A sequence of interfaces (or classes) that are subscribed to (the + resolution of the ``ifaces`` argument passed to ``add_subscriber``). + ``response adapters`` -``asset overrides`` + Each introspectable in the ``response adapters`` category represents a call + to :meth:`pyramid.config.Configurator.add_response_adapter` (or a decorator + equivalent); each will have the following data. + + ``adapter`` + + The adapter object (the resolved ``adapter`` argument to + ``add_response_adapter``). + + ``type`` + + The resolved ``type_or_iface`` argument passed to + ``add_response_adapter``. ``root factories`` + XXX ``default root factory`` category? + + Each introspectable in the ``root factories`` category represents a call to + :meth:`pyramid.config.Configurator.set_root_factory` (or the Configurator + constructor equivalent) *or* a ``factory`` argument passed to + :meth:`pyramid.config.Configurator.add_route`; each will have the following + data. + + ``factory`` + + The factory object (the resolved ``factory`` argument to + ``set_root_factory``). + + ``route_name`` + + The name of the route which will use this factory. If this is the + *default* root factory (if it's registered during a call to + ``set_root_factory``), this value will be ``None``. + ``session factory`` + Only one introspectable will exist in the ``session factory`` category. It + represents a call to :meth:`pyramid.config.Configurator.set_session_factory` + (or the Configurator constructor equivalent); it will have the following + data. + + ``factory`` + + The factory object (the resolved ``factory`` argument to + ``set_session_factory``). + ``request factory`` + Only one introspectable will exist in the ``request factory`` category. It + represents a call to :meth:`pyramid.config.Configurator.set_request_factory` + (or the Configurator constructor equivalent); it will have the following + data. + + ``factory`` + + The factory object (the resolved ``factory`` argument to + ``set_request_factory``). + ``locale negotiator`` -``translation directories`` + Only one introspectable will exist in the ``locale negotiator`` category. + It represents a call to + :meth:`pyramid.config.Configurator.set_locale_negotiator` (or the + Configurator constructor equivalent); it will have the following data. + + ``negotiator`` + + The factory object (the resolved ``negotiator`` argument to + ``set_locale_negotiator``). ``renderer factories`` + Each introspectable in the ``renderer factories`` category represents a + call to :meth:`pyramid.config.Configurator.add_renderer` (or the + Configurator constructor equivalent); each will have the following data. + + ``name`` + + The name of the renderer (the value of the ``name`` argument to + ``add_renderer``). + + ``factory`` + + The factory object (the resolved ``factory`` argument to + ``add_renderer``). + +``renderer globals factory`` + + There will be one and only one introspectable in the ``renderer globals + factory`` category. It represents a call to + :meth:`pyramid.config.Configurator.set_renderer_globals_factory`; it will + have the following data. + + ``factory`` + + The factory object (the resolved ``factory`` argument to + ``set_renderer_globals_factory``). + ``routes`` + Each introspectable in the ``routes`` category represents a call to + :meth:`pyramid.config.Configurator.add_route`; each will have the following + data. + + ``name`` + + The ``name`` argument passed to ``add_route``. + + ``pattern`` + + The ``pattern`` argument passed to ``add_route``. + + ``factory`` + + The (resolved) ``factory`` argument passed to ``add_route``. + + ``xhr`` + + The ``xhr`` argument passed to ``add_route``. + + ``request_method`` + + The ``request_method`` argument passed to ``add_route``. + + ``request_methods`` + + A sequence of request method names implied by the ``request_method`` + argument passed to ``add_route``. + + ``path_info`` + + The ``path_info`` argument passed to ``add_route``. + + ``request_param`` + + The ``request_param`` argument passed to ``add_route``. + + ``header`` + + The ``header`` argument passed to ``add_route``. + + ``accept`` + + The ``accept`` argument passed to ``add_route``. + + ``traverse`` + + The ``traverse`` argument passed to ``add_route``. + + ``custom_predicates`` + + The ``custom_predicates`` argument passed to ``add_route``. + + ``pregenerator`` + + The ``pregenerator`` argument passed to ``add_route``. + + ``pregenerator`` + + The ``static`` argument passed to ``add_route``. + + ``pregenerator`` + + The ``use_global_views`` argument passed to ``add_route``. + + ``object`` + + The :class:`pyramid.interfaces.IRoute` object that is used to perform + matching and generation for this route. + ``authentication policy`` + There will be one and only one introspectable in the ``authentication + policy`` category. It represents a call to the + :meth:`pyramid.config.Configurator.set_authentication_policy` method (or + its Configurator constructor equivalent); it will have the following data. + + ``policy`` + + The policy object (the resolved ``policy`` argument to + ``set_authentication_policy``). + ``authorization policy`` + There will be one and only one introspectable in the ``authorization + policy`` category. It represents a call to the + :meth:`pyramid.config.Configurator.set_authorization_policy` method (or its + Configurator constructor equivalent); it will have the following data. + + ``policy`` + + The policy object (the resolved ``policy`` argument to + ``set_authorization_policy``). + ``default permission`` -``tweens (implicit)`` + There will be one and only one introspectable in the ``default permission`` + category. It represents a call to the + :meth:`pyramid.config.Configurator.set_default_permission` method (or its + Configurator constructor equivalent); it will have the following data. + + ``value`` + + The permission name passed to ``set_default_permission``. ``views`` -``templates`` + Each introspectable in the ``views`` category represents a call to + :meth:`pyramid.config.Configurator.add_view`; each will have the following + data. + + ``name`` + + The ``name`` argument passed to ``add_view``. + + ``context`` + + The (resolved) ``context`` argument passed to ``add_view``. + + ``containment`` + + The (resolved) ``containment`` argument passed to ``add_view``. + + ``request_param`` + + The ``request_param`` argument passed to ``add_view``. + + ``request_methods`` + + A sequence of request method names implied by the ``request_method`` + argument passed to ``add_view``. + + ``route_name`` + + The ``route_name`` argument passed to ``add_view``. + + ``attr`` + + The ``attr`` argument passed to ``add_view``. + + ``xhr`` + + The ``xhr`` argument passed to ``add_view``. + + ``accept`` + + The ``accept`` argument passed to ``add_view``. + + ``header`` + + The ``header`` argument passed to ``add_view``. + + ``path_info`` + + The ``path_info`` argument passed to ``add_view``. + + ``match_param`` + + The ``match_param`` argument passed to ``add_view``. + + ``callable`` + + The (resolved) ``view`` argument passed to ``add_view``. Represents the + "raw" view callable. + + ``derived_callable`` + + The view callable derived from the ``view`` argument passed to + ``add_view``. Represents the view callable which Pyramid itself calls + (wrapped in security and other wrappers). + + ``mapper`` + + The (resolved) ``mapper`` argument passed to ``add_view``. + + ``decorator`` + + The (resolved) ``decorator`` argument passed to ``add_view``. ``permissions`` + Each introspectable in the ``permissions`` category represents a call to + :meth:`pyramid.config.Configurator.add_view` that has an explicit + ``permission`` argument to *or* a call to + :meth:`pyramid.config.Configurator.set_default_permission`; each will have + the following data. + + ``value`` + + The permission name passed to ``add_view`` or ``set_default_permission``. + +``templates`` + + Each introspectable in the ``templates`` category represents a call to + :meth:`pyramid.config.Configurator.add_view` that has a ``renderer`` + argument which points to a template; each will have the following data. + + ``name`` + + The renderer's name (a string). + + ``type`` + + The renderer's type (a string). + + ``renderer`` + + The :class:`pyramid.interfaces.IRendererInfo` object which represents + this template's renderer. + ``view mapper`` + XXX default view mapper category? + + Each introspectable in the ``permissions`` category represents a call to + :meth:`pyramid.config.Configurator.add_view` that has an explicit + ``mapper`` argument to *or* a call to + :meth:`pyramid.config.Configurator.set_view_mapper`; each will have + the following data. + + ``mapper`` + + The (resolved) ``mapper`` argument passed to ``add_view`` or + ``set_view_mapper``. + +``asset overrides`` + + XXX + +``translation directories`` + + XXX + +``tweens (implicit)`` + + XXX + +``tweens (explicit)`` + + XXX + -- cgit v1.2.3 From 58c01ff8863971f81db59d437d49fd9e97b59e5c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 3 Dec 2011 19:37:38 -0500 Subject: flesh out categories more --- docs/narr/introspector.rst | 80 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 11 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 8adfde7d1..ac0859164 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -15,6 +15,10 @@ feature is useful for debug toolbars, command-line scripts which show some aspect of configuration, and for runtime reporting of startup-time configuration settings. +.. warning:: + + Introspection is new in Pyramid 1.3. + Using the Introspector ---------------------- @@ -86,6 +90,12 @@ The important attributes shared by all introspectables are the following: often be a singular version of the category name but it can be an arbitrary value. +``action_info`` + + An object describing the directive call site which caused this + introspectable to be registered; contains attributes described in + :class:`pyramid.interfaces.IActionInfo`. + Besides having the attributes described above, an introspectable is a dictionary-like object. An introspectable can be queried for data values via its ``__getitem__``, ``get``, ``keys``, ``values``, or ``items`` methods. @@ -107,7 +117,7 @@ introspectables in categories not described here. ``subscribers`` Each introspectable in the ``subscribers`` category represents a call to - :meth:`pryamid.config.Configurator.add_subscriber` (or the decorator + :meth:`pyramid.config.Configurator.add_subscriber` (or the decorator equivalent); each will have the following data. ``subscriber`` @@ -138,8 +148,6 @@ introspectables in categories not described here. ``root factories`` - XXX ``default root factory`` category? - Each introspectable in the ``root factories`` category represents a call to :meth:`pyramid.config.Configurator.set_root_factory` (or the Configurator constructor equivalent) *or* a ``factory`` argument passed to @@ -435,8 +443,6 @@ introspectables in categories not described here. ``view mapper`` - XXX default view mapper category? - Each introspectable in the ``permissions`` category represents a call to :meth:`pyramid.config.Configurator.add_view` that has an explicit ``mapper`` argument to *or* a call to @@ -450,17 +456,69 @@ introspectables in categories not described here. ``asset overrides`` - XXX + Each introspectable in the ``asset overrides`` category represents a call + to :meth:`pyramid.config.Configurator.override_asset`; each will have the + following data. + + ``to_override`` + + The ``to_override`` argument (an asset spec) passed to + ``override_asset``. + + ``override_with`` + + The ``override_with`` argument (an asset spec) passed to + ``override_asset``. ``translation directories`` - XXX + Each introspectable in the ``asset overrides`` category represents an + individual element in a ``specs`` argument passed to to + :meth:`pyramid.config.Configurator.add_translation_dirs`; each will have + the following data. + + ``directory`` + + The absolute path of the translation directory. + + ``spec`` + + The asset specification passed to ``add_translation_dirs``. + +``tweens`` + + Each introspectable in the ``tweens`` category represents a call to + :meth:`pyramid.config.Configurator.add_tween`; each will have the following + data. + + ``name`` + + The dotted name to the tween factory as a string (passed as + the ``tween_factory`` argument to ``add_tween``). + + ``factory`` + + The (resolved) tween factory object. + + ``type`` + + ``implict`` or ``explicit`` as a string. + + ``under`` + + The ``under`` argument passed to ``add_tween`` (a string). + + ``over`` + + The ``over`` argument passed to ``add_tween`` (a string). -``tweens (implicit)`` +Toolbar Introspection +--------------------- - XXX +The Pyramid debug toolbar (part of the ``pyramid_debugtoolbar`` package) +provides a canned view of all registered introspectables and their +relationships. It looks something like this: -``tweens (explicit)`` +.. image:: tb_introspector.png - XXX -- cgit v1.2.3 From b40fb8b26fe37102b076cd2310ea7a3fe8b79311 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 3 Dec 2011 21:04:24 -0500 Subject: add a noop introspector (allow introspection to be turned off) --- docs/narr/introspector.rst | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index ac0859164..71b41773c 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -512,8 +512,8 @@ introspectables in categories not described here. The ``over`` argument passed to ``add_tween`` (a string). -Toolbar Introspection ---------------------- +Introspection in the Toolbar +---------------------------- The Pyramid debug toolbar (part of the ``pyramid_debugtoolbar`` package) provides a canned view of all registered introspectables and their @@ -521,4 +521,20 @@ relationships. It looks something like this: .. image:: tb_introspector.png +Disabling Introspection +----------------------- +You can disable Pyramid introspection by passing the object +:attr:`pyramid.registry.noop_introspector` to the :term:`Configurator` +constructor in your application setup: + +.. code-block:: python + + from pyramid.config import Configurator + from pyramid.registry import noop_introspector + config = Configurator(..., introspector=noop_introspector) + +When the noop introspector is active, all introspectables generated by the +framework are thrown away. A noop introspector behaves just like a "real" +introspector, but the methods of a noop introspector do nothing and return +null values. -- cgit v1.2.3 From d8e504cb1d486b9cd1caea7437ff212f92ed4fdb Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 3 Dec 2011 21:25:43 -0500 Subject: make add_route generate the right request methods introspection value --- docs/narr/introspector.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 71b41773c..1285a4cf1 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -258,7 +258,8 @@ introspectables in categories not described here. ``request_methods`` A sequence of request method names implied by the ``request_method`` - argument passed to ``add_route``. + argument passed to ``add_route`` or the value ``None`` if a + ``request_method`` argument was not supplied. ``path_info`` @@ -361,7 +362,8 @@ introspectables in categories not described here. ``request_methods`` A sequence of request method names implied by the ``request_method`` - argument passed to ``add_view``. + argument passed to ``add_view`` or the value ``None`` if a + ``request_method`` argument was not supplied. ``route_name`` -- cgit v1.2.3 From fc3e425e64420fc05dc4fa1ebf83951934a2f005 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 3 Dec 2011 21:29:25 -0500 Subject: wording --- docs/narr/introspector.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 1285a4cf1..cfc6144dd 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -536,7 +536,7 @@ constructor in your application setup: from pyramid.registry import noop_introspector config = Configurator(..., introspector=noop_introspector) -When the noop introspector is active, all introspectables generated by the -framework are thrown away. A noop introspector behaves just like a "real" -introspector, but the methods of a noop introspector do nothing and return -null values. +When the noop introspector is active, all introspectables generated by +configuration directives are thrown away. A noop introspector behaves just +like a "real" introspector, but the methods of a noop introspector do nothing +and return null values. -- cgit v1.2.3 From 9197920a850cf80600fdf51a7235a364e253f621 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 5 Dec 2011 01:04:23 -0800 Subject: grammar correction --- docs/narr/introspector.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index cfc6144dd..83f05bc2f 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -43,7 +43,7 @@ provided to the ``add_route`` method of the route which matched when the view was called. It uses the :meth:`pyramid.interfaces.IIntrospector.get` method to return an introspectable in the category ``routes`` with a :term:`discriminator` equal to the matched route name. It then uses the -returned introspectable to obtain an "pattern" value. +returned introspectable to obtain a "pattern" value. The introspectable returned by the query methods of the introspector has methods and attributes described by -- cgit v1.2.3 From 51e3ae1d6023f1acc0788b44d6f87b8c2ac03f48 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 5 Dec 2011 01:59:18 -0800 Subject: grammar --- docs/narr/introspector.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 83f05bc2f..3e42c42f6 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -59,7 +59,7 @@ Introspectable Objects ---------------------- Introspectable objects are returned from query methods of an introspector. -Each introspectable object implements the attributes and methods the +Each introspectable object implements the attributes and methods documented at :class:`pyramid.interfaces.IIntrospectable`. The important attributes shared by all introspectables are the following: -- cgit v1.2.3 From 4a88195676733fb32e01893eb9de0f5e3fd2b7ff Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 5 Dec 2011 02:35:07 -0800 Subject: too many pregenerator? --- docs/narr/introspector.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 3e42c42f6..6bdca645c 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -289,11 +289,11 @@ introspectables in categories not described here. The ``pregenerator`` argument passed to ``add_route``. - ``pregenerator`` + ``static`` The ``static`` argument passed to ``add_route``. - ``pregenerator`` + ``use_global_views`` The ``use_global_views`` argument passed to ``add_route``. -- cgit v1.2.3 From 773948a42423cc7185f36b8473576b4fcae1bcee Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 9 Dec 2011 04:33:28 -0500 Subject: add static views introspection category --- docs/narr/introspector.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 6bdca645c..11d779854 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -514,6 +514,21 @@ introspectables in categories not described here. The ``over`` argument passed to ``add_tween`` (a string). +``static views`` + + Each introspectable in the ``static views`` category represents a call to + :meth:`pyramid.config.Configurator.add_static_view`; each will have the + following data. + + ``name`` + + The ``name`` argument provided to ``add_static_view``. + + ``spec`` + + A normalized version of the ``spec`` argument provided to + ``add_static_view``. + Introspection in the Toolbar ---------------------------- -- cgit v1.2.3 From 748aad47f90136b151be13f477ed6af1caed0493 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 15 Feb 2012 19:09:08 -0500 Subject: - Add ``pyramid.config.Configurator.set_traverser`` API method. See the Hooks narrative documentation section entitled "Changing the Traverser" for more information. This is not a new feature, it just provides an API for adding a traverser without needing to use the ZCA API. --- docs/narr/introspector.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 11d779854..08cc430f6 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -529,6 +529,21 @@ introspectables in categories not described here. A normalized version of the ``spec`` argument provided to ``add_static_view``. +``traversers`` + + Each introspectable in the ``traversers`` category represents a call to + :meth:`pyramid.config.Configurator.add_traverser`; each will have the + following data. + + ``iface`` + + The (resolved) interface or class object that represents the return value + of a root factory that this traverser will be used for. + + ``factory`` + + The (resolved) traverser class. + Introspection in the Toolbar ---------------------------- -- cgit v1.2.3 From e0551cd9e73a20f2180fecb1134e07d5ebb90c68 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 18 Feb 2012 08:39:33 -0500 Subject: move add_traverser and add_resource_url_adapter to adapters --- docs/narr/introspector.rst | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 08cc430f6..d465c47d9 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -540,10 +540,30 @@ introspectables in categories not described here. The (resolved) interface or class object that represents the return value of a root factory that this traverser will be used for. - ``factory`` + ``adapter`` The (resolved) traverser class. +``resource url adapters`` + + Each introspectable in the ``resource url adapters`` category represents a + call to :meth:`pyramid.config.Configurator.add_resource_url_adapter`; each + will have the following data. + + ``adapter`` + + The (resolved) resource URL adapter class. + + ``resource_iface`` + + The (resolved) interface or class object that represents the resource + interface that this url adapter is registered for. + + ``request_iface`` + + The (resolved) interface or class object that represents the request + interface that this url adapter is registered for. + Introspection in the Toolbar ---------------------------- -- cgit v1.2.3 From 844ed90133f051d013330cb0ed4c95dbb29eecc1 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 20 Feb 2012 12:41:47 -0500 Subject: Features -------- - Add an ``introspection`` boolean to the Configurator constructor. If this is ``True``, actions registered using the Configurator will be registered with the introspector. If it is ``False``, they won't. The default is ``True``. Setting it to ``False`` during action processing will prevent introspection for any following registration statements, and setting it to ``True`` will start them up again. This addition is to service a requirement that the debug toolbar's own views and methods not show up in the introspector. Backwards Incompatibilities --------------------------- - Remove ``pyramid.config.Configurator.with_context`` class method. It was never an API, it is only used by ``pyramid_zcml`` and its functionality has been moved to that package's latest release. This means that you'll need to use the latest release of ``pyramid_zcml`` with this release of Pyramid. - The ``introspector`` argument to the ``pyramid.config.Configurator`` constructor API has been removed. It has been replaced by the boolean ``introspection`` flag. - The ``pyramid.registry.noop_introspector`` API object has been removed. --- docs/narr/introspector.rst | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index d465c47d9..74595cac8 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -576,17 +576,14 @@ relationships. It looks something like this: Disabling Introspection ----------------------- -You can disable Pyramid introspection by passing the object -:attr:`pyramid.registry.noop_introspector` to the :term:`Configurator` -constructor in your application setup: +You can disable Pyramid introspection by passing the flag +``introspection=False`` to the :term:`Configurator` constructor in your +application setup: .. code-block:: python from pyramid.config import Configurator - from pyramid.registry import noop_introspector - config = Configurator(..., introspector=noop_introspector) + config = Configurator(..., introspection=False) -When the noop introspector is active, all introspectables generated by -configuration directives are thrown away. A noop introspector behaves just -like a "real" introspector, but the methods of a noop introspector do nothing -and return null values. +When ``introspection`` is ``False``, all introspectables generated by +configuration directives are thrown away. -- cgit v1.2.3 From 5d0989efeb3eecd4cc55fd9c1dcaf1134ced56b2 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 4 May 2012 19:56:00 -0400 Subject: add introspection to whats unique --- docs/narr/introspector.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 74595cac8..6bfaf11c0 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -32,7 +32,7 @@ callable: from pyramid.response import Response @view_config(route_name='bar') - def route_accepts(request): + def show_current_route_pattern(request): introspector = request.registry.introspector route_name = request.matched_route.name route_intr = introspector.get('routes', route_name) -- cgit v1.2.3 From 643a83473a6faabd0ff08547a0cbca09e9cdda1c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 19 Sep 2012 04:46:01 -0400 Subject: A ``check_csrf`` view predicate was added. For example, you can now do ``config.add_view(someview, check_csrf=True)``. When the predicate is checked, if the ``csrf_token`` value in ``request.params`` matches the csrf token in the request's session, the view will be permitted to execute. Otherwise, it will not be permitted to execute. --- docs/narr/introspector.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 6bfaf11c0..b88f3f0c8 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -393,6 +393,10 @@ introspectables in categories not described here. The ``match_param`` argument passed to ``add_view``. + ``csrf_token`` + + The ``csrf_token`` argument passed to ``add_view``. + ``callable`` The (resolved) ``view`` argument passed to ``add_view``. Represents the -- cgit v1.2.3 From 4df5975a690d1f0921efb84f48f544211b4f869d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 21 Nov 2012 22:56:25 -0500 Subject: document new introspectable attrs --- docs/narr/introspector.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index b88f3f0c8..bd81fb56a 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -130,6 +130,23 @@ introspectables in categories not described here. A sequence of interfaces (or classes) that are subscribed to (the resolution of the ``ifaces`` argument passed to ``add_subscriber``). + ``derived_subscriber`` + + A wrapper around the subscriber used internally by the system so it can + call it with more than one argument if your original subscriber accepts + only one. + + ``predicates`` + + The predicate objects created as the result of passing predicate arguments + to ``add_susbcriber`` + + ``derived_predicates`` + + Wrappers around the predicate objects created as the result of passing + predicate arguments to ``add_susbcriber`` (to be used when predicates take + only one value but must be passed more than one). + ``response adapters`` Each introspectable in the ``response adapters`` category represents a call -- cgit v1.2.3 From 043ccddb909327106264d10ed5d413760a51770d Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 2 Jan 2013 02:22:52 +0200 Subject: eliminate other repeated words --- docs/narr/introspector.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index bd81fb56a..7784e8960 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -496,7 +496,7 @@ introspectables in categories not described here. ``translation directories`` Each introspectable in the ``asset overrides`` category represents an - individual element in a ``specs`` argument passed to to + individual element in a ``specs`` argument passed to :meth:`pyramid.config.Configurator.add_translation_dirs`; each will have the following data. -- cgit v1.2.3 From 07bd8622f4c5ec3340630e977e202991b67d59d8 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 12 Mar 2013 01:24:18 +0200 Subject: a warning is overkill --- docs/narr/introspector.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 7784e8960..dec22c5b1 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -7,6 +7,8 @@ Pyramid Configuration Introspection =================================== +.. versionadded:: 1.3 + When Pyramid starts up, each call to a :term:`configuration directive` causes one or more :term:`introspectable` objects to be registered with an :term:`introspector`. The introspector can be queried by application code to @@ -15,10 +17,6 @@ feature is useful for debug toolbars, command-line scripts which show some aspect of configuration, and for runtime reporting of startup-time configuration settings. -.. warning:: - - Introspection is new in Pyramid 1.3. - Using the Introspector ---------------------- -- cgit v1.2.3 From c6601f77f91dc933ca429d1448f4c6b27857b608 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 8 Sep 2013 22:52:54 -0400 Subject: - The ``renderer_globals_factory`` argument to the ``pyramid.config.Configurator` constructor and its ``setup_registry`` method has been removed. The ``set_renderer_globals_factory`` method of ``pyramid.config.Configurator`` has also been removed. The (internal) ``pyramid.interfaces.IRendererGlobals`` interface was also removed. These arguments, methods and interfaces had been deprecated since 1.1. Use a ``BeforeRender`` event subscriber as documented in the "Hooks" chapter of the Pyramid narrative documentation instead of providing renderer globals values to the configurator. --- docs/narr/introspector.rst | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index dec22c5b1..3c0a6744f 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -232,18 +232,6 @@ introspectables in categories not described here. The factory object (the resolved ``factory`` argument to ``add_renderer``). -``renderer globals factory`` - - There will be one and only one introspectable in the ``renderer globals - factory`` category. It represents a call to - :meth:`pyramid.config.Configurator.set_renderer_globals_factory`; it will - have the following data. - - ``factory`` - - The factory object (the resolved ``factory`` argument to - ``set_renderer_globals_factory``). - ``routes`` Each introspectable in the ``routes`` category represents a call to -- cgit v1.2.3 From 392a6c7df93b67d6889680133fda0f744970d61f Mon Sep 17 00:00:00 2001 From: Antti Haapala Date: Sun, 17 Nov 2013 00:11:37 +0200 Subject: Removed extra indentation from some examples (:linenos: should be indented with the same indentation as the rest of the code block) --- docs/narr/introspector.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 3c0a6744f..a7bde4cf7 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -24,7 +24,7 @@ Here's an example of using Pyramid's introspector from within a view callable: .. code-block:: python - :linenos: + :linenos: from pyramid.view import view_config from pyramid.response import Response @@ -100,7 +100,7 @@ its ``__getitem__``, ``get``, ``keys``, ``values``, or ``items`` methods. For example: .. code-block:: python - :linenos: + :linenos: route_intr = introspector.get('routes', 'edit_user') pattern = route_intr['pattern'] -- cgit v1.2.3 From b6ad615549fb52c40f55760027bffbdd1a919aa1 Mon Sep 17 00:00:00 2001 From: Pavlo Kapyshin Date: Wed, 7 Jan 2015 14:44:27 +0200 Subject: Fix "add_subscriber" spelling --- docs/narr/introspector.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index a7bde4cf7..0ff1615d1 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -121,7 +121,7 @@ introspectables in categories not described here. ``subscriber`` The subscriber callable object (the resolution of the ``subscriber`` - argument passed to ``add_susbcriber``). + argument passed to ``add_subscriber``). ``interfaces`` @@ -137,12 +137,12 @@ introspectables in categories not described here. ``predicates`` The predicate objects created as the result of passing predicate arguments - to ``add_susbcriber`` + to ``add_subscriber`` ``derived_predicates`` Wrappers around the predicate objects created as the result of passing - predicate arguments to ``add_susbcriber`` (to be used when predicates take + predicate arguments to ``add_subscriber`` (to be used when predicates take only one value but must be passed more than one). ``response adapters`` -- cgit v1.2.3 From 77db3c2c000d7209d1c486585d7227181e2a4286 Mon Sep 17 00:00:00 2001 From: Pavlo Kapyshin Date: Wed, 7 Jan 2015 15:00:06 +0200 Subject: Fix typos in configuration introspection documentation --- docs/narr/introspector.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 0ff1615d1..8caba522c 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -450,9 +450,9 @@ introspectables in categories not described here. The :class:`pyramid.interfaces.IRendererInfo` object which represents this template's renderer. -``view mapper`` +``view mappers`` - Each introspectable in the ``permissions`` category represents a call to + Each introspectable in the ``view mappers`` category represents a call to :meth:`pyramid.config.Configurator.add_view` that has an explicit ``mapper`` argument to *or* a call to :meth:`pyramid.config.Configurator.set_view_mapper`; each will have @@ -481,8 +481,8 @@ introspectables in categories not described here. ``translation directories`` - Each introspectable in the ``asset overrides`` category represents an - individual element in a ``specs`` argument passed to + Each introspectable in the ``translation directories`` category represents + an individual element in a ``specs`` argument passed to :meth:`pyramid.config.Configurator.add_translation_dirs`; each will have the following data. @@ -511,7 +511,7 @@ introspectables in categories not described here. ``type`` - ``implict`` or ``explicit`` as a string. + ``implicit`` or ``explicit`` as a string. ``under`` -- cgit v1.2.3 From 59a125a312db3cba9c488f53fef08272b387129e Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 4 Nov 2015 04:40:29 -0800 Subject: update tb_introspector.png, minor grammar, fix .rst markup, rewrap to 79 columns --- docs/narr/introspector.rst | 121 ++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 62 deletions(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 8caba522c..9400b6cf3 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -20,8 +20,7 @@ configuration settings. Using the Introspector ---------------------- -Here's an example of using Pyramid's introspector from within a view -callable: +Here's an example of using Pyramid's introspector from within a view callable: .. code-block:: python :linenos: @@ -36,10 +35,10 @@ callable: route_intr = introspector.get('routes', route_name) return Response(str(route_intr['pattern'])) -This view will return a response that contains the "pattern" argument -provided to the ``add_route`` method of the route which matched when the view -was called. It uses the :meth:`pyramid.interfaces.IIntrospector.get` method -to return an introspectable in the category ``routes`` with a +This view will return a response that contains the "pattern" argument provided +to the ``add_route`` method of the route which matched when the view was +called. It uses the :meth:`pyramid.interfaces.IIntrospector.get` method to +return an introspectable in the category ``routes`` with a :term:`discriminator` equal to the matched route name. It then uses the returned introspectable to obtain a "pattern" value. @@ -56,9 +55,9 @@ can be used to query for introspectables. Introspectable Objects ---------------------- -Introspectable objects are returned from query methods of an introspector. -Each introspectable object implements the attributes and methods -documented at :class:`pyramid.interfaces.IIntrospectable`. +Introspectable objects are returned from query methods of an introspector. Each +introspectable object implements the attributes and methods documented at +:class:`pyramid.interfaces.IIntrospectable`. The important attributes shared by all introspectables are the following: @@ -74,12 +73,12 @@ The important attributes shared by all introspectables are the following: ``discriminator`` - A hashable object representing the unique value of this introspectable - within its category. + A hashable object representing the unique value of this introspectable within + its category. ``discriminator_hash`` - The integer hash of the discriminator (useful for using in HTML links). + The integer hash of the discriminator (useful in HTML links). ``type_name`` @@ -90,8 +89,8 @@ The important attributes shared by all introspectables are the following: ``action_info`` - An object describing the directive call site which caused this - introspectable to be registered; contains attributes described in + An object describing the directive call site which caused this introspectable + to be registered. It contains attributes described in :class:`pyramid.interfaces.IActionInfo`. Besides having the attributes described above, an introspectable is a @@ -116,7 +115,7 @@ introspectables in categories not described here. Each introspectable in the ``subscribers`` category represents a call to :meth:`pyramid.config.Configurator.add_subscriber` (or the decorator - equivalent); each will have the following data. + equivalent). Each will have the following data. ``subscriber`` @@ -149,7 +148,7 @@ introspectables in categories not described here. Each introspectable in the ``response adapters`` category represents a call to :meth:`pyramid.config.Configurator.add_response_adapter` (or a decorator - equivalent); each will have the following data. + equivalent). Each will have the following data. ``adapter`` @@ -158,15 +157,14 @@ introspectables in categories not described here. ``type`` - The resolved ``type_or_iface`` argument passed to - ``add_response_adapter``. + The resolved ``type_or_iface`` argument passed to ``add_response_adapter``. ``root factories`` Each introspectable in the ``root factories`` category represents a call to :meth:`pyramid.config.Configurator.set_root_factory` (or the Configurator constructor equivalent) *or* a ``factory`` argument passed to - :meth:`pyramid.config.Configurator.add_route`; each will have the following + :meth:`pyramid.config.Configurator.add_route`. Each will have the following data. ``factory`` @@ -184,7 +182,7 @@ introspectables in categories not described here. Only one introspectable will exist in the ``session factory`` category. It represents a call to :meth:`pyramid.config.Configurator.set_session_factory` - (or the Configurator constructor equivalent); it will have the following + (or the Configurator constructor equivalent). It will have the following data. ``factory`` @@ -196,7 +194,7 @@ introspectables in categories not described here. Only one introspectable will exist in the ``request factory`` category. It represents a call to :meth:`pyramid.config.Configurator.set_request_factory` - (or the Configurator constructor equivalent); it will have the following + (or the Configurator constructor equivalent). It will have the following data. ``factory`` @@ -206,10 +204,10 @@ introspectables in categories not described here. ``locale negotiator`` - Only one introspectable will exist in the ``locale negotiator`` category. - It represents a call to + Only one introspectable will exist in the ``locale negotiator`` category. It + represents a call to :meth:`pyramid.config.Configurator.set_locale_negotiator` (or the - Configurator constructor equivalent); it will have the following data. + Configurator constructor equivalent). It will have the following data. ``negotiator`` @@ -218,9 +216,9 @@ introspectables in categories not described here. ``renderer factories`` - Each introspectable in the ``renderer factories`` category represents a - call to :meth:`pyramid.config.Configurator.add_renderer` (or the - Configurator constructor equivalent); each will have the following data. + Each introspectable in the ``renderer factories`` category represents a call + to :meth:`pyramid.config.Configurator.add_renderer` (or the Configurator + constructor equivalent). Each will have the following data. ``name`` @@ -229,13 +227,12 @@ introspectables in categories not described here. ``factory`` - The factory object (the resolved ``factory`` argument to - ``add_renderer``). + The factory object (the resolved ``factory`` argument to ``add_renderer``). ``routes`` Each introspectable in the ``routes`` category represents a call to - :meth:`pyramid.config.Configurator.add_route`; each will have the following + :meth:`pyramid.config.Configurator.add_route`. Each will have the following data. ``name`` @@ -310,7 +307,7 @@ introspectables in categories not described here. There will be one and only one introspectable in the ``authentication policy`` category. It represents a call to the :meth:`pyramid.config.Configurator.set_authentication_policy` method (or - its Configurator constructor equivalent); it will have the following data. + its Configurator constructor equivalent). It will have the following data. ``policy`` @@ -319,10 +316,10 @@ introspectables in categories not described here. ``authorization policy`` - There will be one and only one introspectable in the ``authorization - policy`` category. It represents a call to the + There will be one and only one introspectable in the ``authorization policy`` + category. It represents a call to the :meth:`pyramid.config.Configurator.set_authorization_policy` method (or its - Configurator constructor equivalent); it will have the following data. + Configurator constructor equivalent). It will have the following data. ``policy`` @@ -334,7 +331,7 @@ introspectables in categories not described here. There will be one and only one introspectable in the ``default permission`` category. It represents a call to the :meth:`pyramid.config.Configurator.set_default_permission` method (or its - Configurator constructor equivalent); it will have the following data. + Configurator constructor equivalent). It will have the following data. ``value`` @@ -343,7 +340,7 @@ introspectables in categories not described here. ``views`` Each introspectable in the ``views`` category represents a call to - :meth:`pyramid.config.Configurator.add_view`; each will have the following + :meth:`pyramid.config.Configurator.add_view`. Each will have the following data. ``name`` @@ -423,8 +420,8 @@ introspectables in categories not described here. Each introspectable in the ``permissions`` category represents a call to :meth:`pyramid.config.Configurator.add_view` that has an explicit - ``permission`` argument to *or* a call to - :meth:`pyramid.config.Configurator.set_default_permission`; each will have + ``permission`` argument *or* a call to + :meth:`pyramid.config.Configurator.set_default_permission`. Each will have the following data. ``value`` @@ -435,7 +432,7 @@ introspectables in categories not described here. Each introspectable in the ``templates`` category represents a call to :meth:`pyramid.config.Configurator.add_view` that has a ``renderer`` - argument which points to a template; each will have the following data. + argument which points to a template. Each will have the following data. ``name`` @@ -447,15 +444,15 @@ introspectables in categories not described here. ``renderer`` - The :class:`pyramid.interfaces.IRendererInfo` object which represents - this template's renderer. + The :class:`pyramid.interfaces.IRendererInfo` object which represents this + template's renderer. ``view mappers`` Each introspectable in the ``view mappers`` category represents a call to - :meth:`pyramid.config.Configurator.add_view` that has an explicit - ``mapper`` argument to *or* a call to - :meth:`pyramid.config.Configurator.set_view_mapper`; each will have + :meth:`pyramid.config.Configurator.add_view` that has an explicit ``mapper`` + argument *or* a call to + :meth:`pyramid.config.Configurator.set_view_mapper`. Each will have the following data. ``mapper`` @@ -465,14 +462,13 @@ introspectables in categories not described here. ``asset overrides`` - Each introspectable in the ``asset overrides`` category represents a call - to :meth:`pyramid.config.Configurator.override_asset`; each will have the + Each introspectable in the ``asset overrides`` category represents a call to + :meth:`pyramid.config.Configurator.override_asset`. Each will have the following data. ``to_override`` - The ``to_override`` argument (an asset spec) passed to - ``override_asset``. + The ``to_override`` argument (an asset spec) passed to ``override_asset``. ``override_with`` @@ -481,10 +477,10 @@ introspectables in categories not described here. ``translation directories`` - Each introspectable in the ``translation directories`` category represents - an individual element in a ``specs`` argument passed to - :meth:`pyramid.config.Configurator.add_translation_dirs`; each will have - the following data. + Each introspectable in the ``translation directories`` category represents an + individual element in a ``specs`` argument passed to + :meth:`pyramid.config.Configurator.add_translation_dirs`. Each will have the + following data. ``directory`` @@ -497,13 +493,13 @@ introspectables in categories not described here. ``tweens`` Each introspectable in the ``tweens`` category represents a call to - :meth:`pyramid.config.Configurator.add_tween`; each will have the following + :meth:`pyramid.config.Configurator.add_tween`. Each will have the following data. ``name`` - The dotted name to the tween factory as a string (passed as - the ``tween_factory`` argument to ``add_tween``). + The dotted name to the tween factory as a string (passed as the + ``tween_factory`` argument to ``add_tween``). ``factory`` @@ -524,7 +520,7 @@ introspectables in categories not described here. ``static views`` Each introspectable in the ``static views`` category represents a call to - :meth:`pyramid.config.Configurator.add_static_view`; each will have the + :meth:`pyramid.config.Configurator.add_static_view`. Each will have the following data. ``name`` @@ -539,13 +535,13 @@ introspectables in categories not described here. ``traversers`` Each introspectable in the ``traversers`` category represents a call to - :meth:`pyramid.config.Configurator.add_traverser`; each will have the + :meth:`pyramid.config.Configurator.add_traverser`. Each will have the following data. ``iface`` The (resolved) interface or class object that represents the return value - of a root factory that this traverser will be used for. + of a root factory for which this traverser will be used. ``adapter`` @@ -554,7 +550,7 @@ introspectables in categories not described here. ``resource url adapters`` Each introspectable in the ``resource url adapters`` category represents a - call to :meth:`pyramid.config.Configurator.add_resource_url_adapter`; each + call to :meth:`pyramid.config.Configurator.add_resource_url_adapter`. Each will have the following data. ``adapter`` @@ -564,19 +560,20 @@ introspectables in categories not described here. ``resource_iface`` The (resolved) interface or class object that represents the resource - interface that this url adapter is registered for. + interface for which this URL adapter is registered. ``request_iface`` The (resolved) interface or class object that represents the request - interface that this url adapter is registered for. + interface for which this URL adapter is registered. Introspection in the Toolbar ---------------------------- The Pyramid debug toolbar (part of the ``pyramid_debugtoolbar`` package) provides a canned view of all registered introspectables and their -relationships. It looks something like this: +relationships. It is currently under the "Global" tab in the main navigation, +and it looks something like this: .. image:: tb_introspector.png -- cgit v1.2.3 From edb8bcae06029543530a43ad99f1be91dedaf88b Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 4 Nov 2015 05:02:02 -0800 Subject: add missing period (cherry picked from commit c7b1bff) --- docs/narr/introspector.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/narr/introspector.rst') diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 9400b6cf3..98315ac9f 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -136,7 +136,7 @@ introspectables in categories not described here. ``predicates`` The predicate objects created as the result of passing predicate arguments - to ``add_subscriber`` + to ``add_subscriber``. ``derived_predicates`` -- cgit v1.2.3