[Zope3-checkins]
SVN: Zope3/branches/jim-adapter/src/zope/app/module/manager.py
Make setting name set recompile flag to allow subscribers and other
Jim Fulton
jim at zope.com
Sat Apr 22 11:02:31 EDT 2006
Log message for revision 67272:
Make setting name set recompile flag to allow subscribers and other
clients to avoid violating the api.
Register the subscribers for events only on the manager.
This also allows the subscribers to be simplified.
Changed:
U Zope3/branches/jim-adapter/src/zope/app/module/manager.py
-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/module/manager.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/module/manager.py 2006-04-22 15:02:26 UTC (rev 67271)
+++ Zope3/branches/jim-adapter/src/zope/app/module/manager.py 2006-04-22 15:02:30 UTC (rev 67272)
@@ -64,7 +64,13 @@
# See zope.app.module.interfaces.IModuleManager
source = property(_getSource, _setSource)
+ def _setName(self, name):
+ self.__dict__['name'] = name
+ self._recompile = True
+ name = property(lambda self: self.__dict__['name'], _setName)
+
+
class ModuleFactory(object):
"""Special factory for creating module managers in site managment
folders."""
@@ -82,18 +88,14 @@
m.execute()
return m
- at zope.component.adapter(zope.component.interfaces.IRegistered)
-def setNameOnActivation(event):
+ at zope.component.adapter(IModuleManager,
+ zope.component.interfaces.IRegistered)
+def setNameOnActivation(manager, event):
"""Set the module name upon registration activation."""
- module = event.object.component
- if isinstance(module, ModuleManager):
- module.name = event.object.name
- module._recompile = True
+ manager.name = event.object.name
- at zope.component.adapter(zope.component.interfaces.IUnregistered)
-def unsetNameOnDeactivation(event):
+ at zope.component.adapter(IModuleManager,
+ zope.component.interfaces.IUnregistered)
+def unsetNameOnDeactivation(manager, event):
"""Unset the permission id up registration deactivation."""
- module = event.object.component
- if isinstance(module, ModuleManager):
- module.name = None
- module._recompile = True
+ manager.name = None
More information about the Zope3-Checkins
mailing list