[Checkins] SVN: z3c.componentdebug/trunk/src/z3c/componentdebug/ It makes no sense to key matching registrations on required interface,

Ross Patterson me at rpatterson.net
Thu May 31 00:26:58 EDT 2007


Log message for revision 76037:
  It makes no sense to key matching registrations on required interface,
  duplicate info
  

Changed:
  U   z3c.componentdebug/trunk/src/z3c/componentdebug/README.txt
  U   z3c.componentdebug/trunk/src/z3c/componentdebug/component.py
  U   z3c.componentdebug/trunk/src/z3c/componentdebug/tests/component.txt
  U   z3c.componentdebug/trunk/src/z3c/componentdebug/tests/site.txt

-=-
Modified: z3c.componentdebug/trunk/src/z3c/componentdebug/README.txt
===================================================================
--- z3c.componentdebug/trunk/src/z3c/componentdebug/README.txt	2007-05-31 04:18:27 UTC (rev 76036)
+++ z3c.componentdebug/trunk/src/z3c/componentdebug/README.txt	2007-05-31 04:26:57 UTC (rev 76037)
@@ -78,13 +78,11 @@
     IBaz, '', getBaz, u'')]
     >>> pprint([i for i in registrations.byObject()])
     [(<Foo object at ...>,
-      [(<InterfaceClass __builtin__.IFoo>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u'')])]),
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+      IBaz, '', getBaz, u'')]),
      (<Bar object at ...>,
-      [(<InterfaceClass __builtin__.IBar>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u'')])])]
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+      IBaz, '', getBaz, u'')])]
     >>> pprint([i for i in registrations.byRegistration()])
     [(AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
     IBaz, '', getBaz, u''),
@@ -105,14 +103,9 @@
     IBaz, '', getBaz, u'')]
     >>> pprint([i for i in registrations.byObject()])
     [(<Foo object at ...>,
-      [(<InterfaceClass __builtin__.IFoo>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u'')])]),
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+      IBaz, '', getBaz, u'')]),
      (<Bar object at ...>, [])]
-    >>> pprint([i for i in registrations.byRegistration()])
-    [(AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
-    IBaz, '', getBaz, u''),
-      [<Foo object at ...>, False])]
 
 --------------------
 ComponentLookupError
@@ -139,10 +132,8 @@
     [AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
     IBaz, '', getBaz, u'')]
     [(<Foo object at ...>,
-      [(<InterfaceClass __builtin__.IFoo>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u'')])]),
-     (<Bar object at ...>, [])]
+    [AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+    IBaz, '', getBaz, u'')]), (<Bar object at ...>, [])]
 
     >>> from z3c.componentdebug.lookup.patch import cleanup
     >>> cleanup()

Modified: z3c.componentdebug/trunk/src/z3c/componentdebug/component.py
===================================================================
--- z3c.componentdebug/trunk/src/z3c/componentdebug/component.py	2007-05-31 04:18:27 UTC (rev 76036)
+++ z3c.componentdebug/trunk/src/z3c/componentdebug/component.py	2007-05-31 04:26:57 UTC (rev 76037)
@@ -78,16 +78,12 @@
         idxs = xrange(self.order)
         for idx in idxs:
             object = self.objects[idx]
-            by_required = {}
-            ordered = []
+            results = []
             for reg in self:
                 required = reg.required[idx]
                 if required.providedBy(object):
-                    regs = by_required.setdefault(required, [])
-                    regs.append(reg)
-                    if required not in ordered:
-                        ordered.append(required)
-            yield object, [(req, by_required[req]) for req in ordered]
+                    results.append(reg)
+            yield object, results
 
     def byRegistration(self):
         assert hasattr(self, 'objects')

Modified: z3c.componentdebug/trunk/src/z3c/componentdebug/tests/component.txt
===================================================================
--- z3c.componentdebug/trunk/src/z3c/componentdebug/tests/component.txt	2007-05-31 04:18:27 UTC (rev 76036)
+++ z3c.componentdebug/trunk/src/z3c/componentdebug/tests/component.txt	2007-05-31 04:26:57 UTC (rev 76037)
@@ -33,13 +33,11 @@
     IBaz, '', getBaz, u'')]
     >>> pprint([i for i in registrations.byObject()])
     [(<Foo object at ...>,
-      [(<InterfaceClass __builtin__.IFoo>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u'')])]),
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+      IBaz, '', getBaz, u'')]),
      (<Bar object at ...>,
-      [(<InterfaceClass __builtin__.IBar>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u'')])])]
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+      IBaz, '', getBaz, u'')])]
     >>> pprint([i for i in registrations.byRegistration()])
     [(AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
     IBaz, '', getBaz, u''),
@@ -65,18 +63,15 @@
      IBaz, '', getBaz, u'')]
     >>> pprint([i for i in registrations.byObject()])
     [(<Foo object at ...>,
-      [(<InterfaceClass __builtin__.IFoo2>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo2,
-        IBar], IBaz, '', getBaz2, u'')]),
-       (<InterfaceClass __builtin__.IFoo>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u'')])]),
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo2, IBar],
+      IBaz, '', getBaz2, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+       IBaz, '', getBaz, u'')]),
      (<Bar object at ...>,
-      [(<InterfaceClass __builtin__.IBar>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo2,
-        IBar], IBaz, '', getBaz2, u''),
-         AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-         IBar], IBaz, '', getBaz, u'')])])]
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo2, IBar],
+      IBaz, '', getBaz2, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+       IBaz, '', getBaz, u'')])]
     >>> pprint([i for i in registrations.byRegistration()])
     [(AdapterRegistration(<BaseGlobalComponents base>, [IFoo2, IBar],
     IBaz, '', getBaz2, u''),
@@ -98,23 +93,19 @@
      Interface], IBaz, '', getBaz3, u'')]
     >>> pprint([i for i in registrations.byObject()])
     [(<Foo object at ...>,
-      [(<InterfaceClass __builtin__.IFoo2>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo2,
-        IBar], IBaz, '', getBaz2, u'')]),
-       (<InterfaceClass __builtin__.IFoo>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u''),
-         AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-         Interface], IBaz, '', getBaz3, u'')])]),
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo2, IBar],
+      IBaz, '', getBaz2, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+       IBaz, '', getBaz, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
+       Interface], IBaz, '', getBaz3, u'')]),
      (<Bar object at ...>,
-      [(<InterfaceClass __builtin__.IBar>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo2,
-        IBar], IBaz, '', getBaz2, u''),
-         AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-         IBar], IBaz, '', getBaz, u'')]),
-       (<InterfaceClass zope.interface.Interface>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        Interface], IBaz, '', getBaz3, u'')])])]
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo2, IBar],
+      IBaz, '', getBaz2, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+       IBaz, '', getBaz, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
+       Interface], IBaz, '', getBaz3, u'')])]
     >>> pprint([i for i in registrations.byRegistration()])
     [(AdapterRegistration(<BaseGlobalComponents base>, [IFoo2, IBar],
     IBaz, '', getBaz2, u''),
@@ -140,20 +131,17 @@
      IBaz, '', getBaz2, u'')]
     >>> pprint([i for i in registrations.byObject()])
     [(<Foo object at ...>,
-      [(<InterfaceClass __builtin__.IFoo>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u''),
-         AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-         Interface], IBaz, '', getBaz3, u'')])]),
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+      IBaz, '', getBaz, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
+       Interface], IBaz, '', getBaz3, u'')]),
      (<Bar object at ...>,
-      [(<InterfaceClass __builtin__.IBar>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        IBar], IBaz, '', getBaz, u''),
-         AdapterRegistration(<BaseGlobalComponents base>, [IFoo2,
-         IBar], IBaz, '', getBaz2, u'')]),
-       (<InterfaceClass zope.interface.Interface>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        Interface], IBaz, '', getBaz3, u'')])])]
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+      IBaz, '', getBaz, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
+       Interface], IBaz, '', getBaz3, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo2, IBar],
+       IBaz, '', getBaz2, u'')])]
     >>> pprint([i for i in registrations.byRegistration()])
     [(AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
     IBaz, '', getBaz, u''),
@@ -176,15 +164,13 @@
      IBaz, '', getBaz2, u'')]
     >>> pprint([i for i in registrations.byObject()])
     [(<Foo object at ...>,
-      [(<InterfaceClass __builtin__.IFoo>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        Interface], IBaz, '', getBaz3, u''),
-         AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-         IBar], IBaz, '', getBaz, u'')])]),
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
+      Interface], IBaz, '', getBaz3, u''),
+       AdapterRegistration(<BaseGlobalComponents base>, [IFoo, IBar],
+       IBaz, '', getBaz, u'')]),
      (<Bar object at ...>,
-      [(<InterfaceClass zope.interface.Interface>,
-        [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
-        Interface], IBaz, '', getBaz3, u'')])])]
+      [AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
+      Interface], IBaz, '', getBaz3, u'')])]
     >>> pprint([i for i in registrations.byRegistration()])
     [(AdapterRegistration(<BaseGlobalComponents base>, [IFoo,
     Interface], IBaz, '', getBaz3, u''),

Modified: z3c.componentdebug/trunk/src/z3c/componentdebug/tests/site.txt
===================================================================
--- z3c.componentdebug/trunk/src/z3c/componentdebug/tests/site.txt	2007-05-31 04:18:27 UTC (rev 76036)
+++ z3c.componentdebug/trunk/src/z3c/componentdebug/tests/site.txt	2007-05-31 04:26:57 UTC (rev 76037)
@@ -46,11 +46,10 @@
     Interface, u'', <lambda>, u''),
     AdapterRegistration(<BaseGlobalComponents base>, [Interface],
     Interface, u'', <lambda>, u'')]
-    [(None, [(<InterfaceClass zope.interface.Interface>,
-    [AdapterRegistration(<PersistentComponents >, [Interface],
+    [(None, [AdapterRegistration(<PersistentComponents >, [Interface],
     Interface, u'', <lambda>, u''),
     AdapterRegistration(<BaseGlobalComponents base>, [Interface],
-    Interface, u'', <lambda>, u'')])])]
+    Interface, u'', <lambda>, u'')])]
 
     >>> from z3c.componentdebug.lookup.patch import cleanup
     >>> cleanup()



More information about the Checkins mailing list