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 +++++++++++++++ pyramid/config/views.py | 9 ++++++++- pyramid/tests/test_config/test_views.py | 5 ++++- 3 files changed, 27 insertions(+), 2 deletions(-) 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 ---------------------------- diff --git a/pyramid/config/views.py b/pyramid/config/views.py index 0b6c6070f..a4333b3d6 100644 --- a/pyramid/config/views.py +++ b/pyramid/config/views.py @@ -1604,6 +1604,13 @@ class StaticURLInfo(object): # url, spec, route_name registrations.append((url, spec, route_name)) - config.action(None, callable=register) + intr = config.introspectable('static views', + name, + 'static view for %r' % name, + 'static view') + intr['name'] = name + intr['spec'] = spec + + config.action(None, callable=register, introspectables=(intr,)) diff --git a/pyramid/tests/test_config/test_views.py b/pyramid/tests/test_config/test_views.py index d80a6bb64..a7b0dd574 100644 --- a/pyramid/tests/test_config/test_views.py +++ b/pyramid/tests/test_config/test_views.py @@ -3561,9 +3561,12 @@ class DummyConfig: self.view_args = args self.view_kw = kw - def action(self, discriminator, callable): + def action(self, discriminator, callable, introspectables=()): callable() + def introspectable(self, *arg): + return {} + from zope.interface import implementer from pyramid.interfaces import IMultiView @implementer(IMultiView) -- cgit v1.2.3