diff options
| author | Chris McDonough <chrism@plope.com> | 2011-12-09 04:33:28 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-12-09 04:33:28 -0500 |
| commit | 773948a42423cc7185f36b8473576b4fcae1bcee (patch) | |
| tree | f78cc06e1ba631293586908e3ee1754d0e79141b | |
| parent | d7e11644f9898393351da13171ae005f0d54115d (diff) | |
| download | pyramid-773948a42423cc7185f36b8473576b4fcae1bcee.tar.gz pyramid-773948a42423cc7185f36b8473576b4fcae1bcee.tar.bz2 pyramid-773948a42423cc7185f36b8473576b4fcae1bcee.zip | |
add static views introspection category
| -rw-r--r-- | docs/narr/introspector.rst | 15 | ||||
| -rw-r--r-- | pyramid/config/views.py | 9 | ||||
| -rw-r--r-- | 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) |
