zope.component: unregisterAdapter uses '==' while the underlying adapter registry uses 'is'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 3 |
Won't Fix
|
Undecided
|
Unassigned | ||
zope.component |
Invalid
|
Undecided
|
Unassigned | ||
zope.interface |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Try this:
class MyTestClass(
def _handler(self, event):
print "Got event!"
def test(self):
sm = zope.component.
assert sm.unregisterHa
The assertion will demonstrate that the global site manager thinks it successfully unregistered the adapter, yet the subsequent notify() will invoke our handler.
Why? Because self._handler creates a new bound method instance every time you write that expression. sm.unregisterHa
zope.component should use the same kind of check as the underlying implementation, because it now lies to the programmer about unregistering an adapter that really remains registered.
Changed in zope3: | |
status: | New → Won't Fix |
Trying to reproduce it, I noticed that the code that does not do the proper unregistration is in zope.interface and not in zope.component