From b518115b2ddc15161bf9e585252a42348658fa0c Mon Sep 17 00:00:00 2001 From: Sylvain Viollon Date: Mon, 19 Oct 2009 15:02:34 +0000 Subject: [PATCH] Fix unregistring of components with a physical path. --- CHANGES.txt | 8 +++++++- src/five/localsitemanager/registry.py | 10 ++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b35eab7..604bfcc 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,12 @@ Changelog ========= +1.2 - unreleased +---------------- + +* Fix unregistring of components which have a physical path. + [thefunny42] + 1.1 - 2009-06-19 ---------------- @@ -22,7 +28,7 @@ Changelog look-up is stored in the adapter look-up cache, subsequent utility look-ups return the utlitiy with the RequestContainer of the first look-up. - + Solution: For utilities registered with an absolute path the RequestContainer is now also removed at look-up. [icemac] diff --git a/src/five/localsitemanager/registry.py b/src/five/localsitemanager/registry.py index 11b0b80..650093e 100644 --- a/src/five/localsitemanager/registry.py +++ b/src/five/localsitemanager/registry.py @@ -165,14 +165,17 @@ def _rewrap(obj): class ComponentPathWrapper(persistent.Persistent): - + def __init__(self, component, path): self.component = component self.path = path def __eq__(self, other): return self.component == other - + + def __ne__(self, other): + return self.component != other + class PersistentComponents \ (PersistentComponents, @@ -222,7 +225,7 @@ def registerUtility(self, component, provided=None, name=u'', info=u'', if not hasattr(component, 'getPhysicalPath'): raise AttributeError( 'Component %r does not implement getPhysicalPath, ' - 'so register it unwrapped or implement this method.' % + 'so register it unwrapped or implement this method.' % component) path = component.getPhysicalPath() # If the path is relative we can't store it because we @@ -242,4 +245,3 @@ def registerUtility(self, component, provided=None, name=u'', info=u'', zope.event.notify(zope.component.interfaces.Registered( UtilityRegistration(self, provided, name, component, info) )) -