summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-11-29 09:52:23 -0500
committerChris McDonough <chrism@plope.com>2011-11-29 09:52:23 -0500
commit87f8d21d487a67068347e5f8c18343cd7c12b121 (patch)
treee774fa381231da2ddffa9e7cc279d2970605f3be
parent9f341ea78cfae3a33ef250acee49fa9709a7d7fe (diff)
downloadpyramid-87f8d21d487a67068347e5f8c18343cd7c12b121.tar.gz
pyramid-87f8d21d487a67068347e5f8c18343cd7c12b121.tar.bz2
pyramid-87f8d21d487a67068347e5f8c18343cd7c12b121.zip
docs and add more introspection info
-rw-r--r--TODO.txt6
-rw-r--r--pyramid/config/routes.py12
-rw-r--r--pyramid/config/tweens.py11
-rw-r--r--pyramid/config/views.py6
-rw-r--r--pyramid/interfaces.py4
5 files changed, 29 insertions, 10 deletions
diff --git a/TODO.txt b/TODO.txt
index d13b504ef..bf1c7773b 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -4,10 +4,6 @@ Pyramid TODOs
Must-Have
---------
-- Fix SQLA tutorial to match ZODB tutorial.
-
-- Fix SQLA tutorial to match alchemy scaffold.
-
- Introspection:
* More specific filename/lineno info instead of opaque string (or a way to
@@ -24,6 +20,8 @@ Must-Have
* make it possible to disuse introspection?
+- Give discriminators a nicer repr for conflict reporting?
+
Nice-to-Have
------------
diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py
index ab62d4c75..35ad0f8c4 100644
--- a/pyramid/config/routes.py
+++ b/pyramid/config/routes.py
@@ -370,11 +370,19 @@ class RoutesConfiguratorMixin(object):
mapper = self.get_routes_mapper()
intr = self.introspectable('routes', name,
- '%s (%s)' % (name, pattern), 'route')
+ '%s (pattern: %r)' % (name, pattern),
+ 'route')
intr['name'] = name
intr['pattern'] = pattern
intr['factory'] = factory
- intr['predicates'] = predicates
+ intr['xhr'] = xhr
+ intr['request_method'] = request_method
+ intr['path_info'] = path_info
+ intr['request_param'] = request_param
+ intr['header'] = header
+ intr['accept'] = accept
+ intr['traverse'] = traverse
+ intr['custom_predicates'] = custom_predicates
intr['pregenerator'] = pregenerator
intr['static'] = static
intr['use_global_views'] = use_global_views
diff --git a/pyramid/config/tweens.py b/pyramid/config/tweens.py
index 76efe4af5..399e2f68a 100644
--- a/pyramid/config/tweens.py
+++ b/pyramid/config/tweens.py
@@ -151,7 +151,16 @@ class TweensConfiguratorMixin(object):
else:
tweens.add_implicit(name, tween_factory, under=under, over=over)
- self.action(('tween', name, explicit), register)
+ discriminator = ('tween', name, explicit)
+ tween_type = explicit and 'explicit' or 'implicit'
+
+ intr = self.introspectable('tweens', discriminator,
+ 'name', 'tween')
+ intr['factory'] = tween_factory
+ intr['type'] = tween_type
+ intr['under'] = under
+ intr['over'] = over
+ self.action(discriminator, register, introspectables=(intr,))
class CyclicDependencyError(Exception):
def __init__(self, cycles):
diff --git a/pyramid/config/views.py b/pyramid/config/views.py
index 16c0a8253..5c4470834 100644
--- a/pyramid/config/views.py
+++ b/pyramid/config/views.py
@@ -1360,7 +1360,11 @@ class ViewsConfiguratorMixin(object):
self.registry.registerUtility(mapper, IViewMapperFactory)
# IViewMapperFactory is looked up as the result of view config
# in phase 3
- self.action(IViewMapperFactory, register, order=PHASE1_CONFIG)
+ intr = self.introspectable('view mapper', IViewMapperFactory,
+ self.object_description(mapper),
+ 'view mapper')
+ self.action(IViewMapperFactory, register, order=PHASE1_CONFIG,
+ introspectables=(intr,))
@action_method
def add_static_view(self, name, path, **kw):
diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py
index 2ff74e40b..d46a46af0 100644
--- a/pyramid/interfaces.py
+++ b/pyramid/interfaces.py
@@ -951,9 +951,9 @@ class IIntrospectable(Interface):
discriminator = Attribute('introspectable discriminator (within category) '
'(must be hashable)')
discriminator_hash = Attribute('an integer hash of the discriminator')
- action_info = Attribute('A string representing the caller that invoked '
+ action_info = Attribute('An object representing the caller that invoked '
'the creation of this introspectable (usually '
- 'managed by IIntrospector during registration)')
+ 'a sentinel until updated during self.register)')
def relate(category_name, discriminator):
""" Indicate an intent to relate this IIntrospectable with another