Skip to content

Commit

Permalink
Re-separated component and event setup. It would be nice to combine
Browse files Browse the repository at this point in the history
these, but if we do, we need to put them in an entirely new API,
deprecating the old apis.  Existing software may use the component
setup and then new it's own setup for objectEventNotify. If the
component setup sets up this handler, then it will be doubly setup,
causing tests to fail.
  • Loading branch information
Jim Fulton committed Apr 26, 2006
1 parent aed334a commit 56129fc
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions component.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ specified interface. So let's create some adapter registrations:
AdapterRegistration(<BaseGlobalComponents base>,
[IFoo], IResult, '', None, u''),
HandlerRegistration(<BaseGlobalComponents base>,
[IFoo], u'', 'stubFactory', u''),
HandlerRegistration(<BaseGlobalComponents base>,
[Interface], u'', append, u'')]
[IFoo], u'', 'stubFactory', u'')]

Note how the adapter requiring an `IRequest` at the end of the required
interfaces is neglected. This is because it is recognized as a view and views
Expand All @@ -67,9 +65,7 @@ are not returned by default. But you can simply turn this flag on:
AdapterRegistration(<BaseGlobalComponents base>,
[IFoo], IResult, '', None, u''),
HandlerRegistration(<BaseGlobalComponents base>,
[IFoo], u'', 'stubFactory', u''),
HandlerRegistration(<BaseGlobalComponents base>,
[Interface], u'', append, u'')]
[IFoo], u'', 'stubFactory', u'')]

The function will also pick up registrations that have required interfaces the
specified interface extends:
Expand All @@ -82,19 +78,15 @@ specified interface extends:
AdapterRegistration(<BaseGlobalComponents base>,
[IFoo], IResult, '', None, u''),
HandlerRegistration(<BaseGlobalComponents base>,
[IFoo], u'', 'stubFactory', u''),
HandlerRegistration(<BaseGlobalComponents base>,
[Interface], u'', append, u'')]
[IFoo], u'', 'stubFactory', u'')]

And all of the required interfaces are considered, of course:

>>> regs = list(component.getRequiredAdapters(IBar))
>>> regs.sort()
>>> regs
[AdapterRegistration(<BaseGlobalComponents base>,
[IFoo, IBar], ISpecialResult, '', None, u''),
HandlerRegistration(<BaseGlobalComponents base>,
[Interface], u'', append, u'')]
[IFoo, IBar], ISpecialResult, '', None, u'')]


`getProvidedAdapters(iface, withViews=False)`
Expand Down

0 comments on commit 56129fc

Please sign in to comment.