Skip to content

Commit

Permalink
Fix unregistring of components with a physical path.
Browse files Browse the repository at this point in the history
  • Loading branch information
thefunny42 committed Oct 19, 2009
1 parent b3c7813 commit b518115
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 7 additions & 1 deletion 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
----------------

Expand All @@ -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]
Expand Down
10 changes: 6 additions & 4 deletions src/five/localsitemanager/registry.py
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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)
))

0 comments on commit b518115

Please sign in to comment.