[Checkins] SVN: cipher.session/trunk/ Now really get rid of ISessionDataContainer on bootstrap.
Adam Groszer
cvs-admin at zope.org
Sat Jul 21 09:24:28 UTC 2012
Log message for revision 127358:
Now really get rid of ISessionDataContainer on bootstrap.
Changed:
U cipher.session/trunk/CHANGES.txt
U cipher.session/trunk/src/cipher/session/bootstrap.py
-=-
Modified: cipher.session/trunk/CHANGES.txt
===================================================================
--- cipher.session/trunk/CHANGES.txt 2012-07-20 14:22:14 UTC (rev 127357)
+++ cipher.session/trunk/CHANGES.txt 2012-07-21 09:24:20 UTC (rev 127358)
@@ -5,7 +5,7 @@
1.0.4 (unreleased)
------------------
-- Nothing changed yet.
+- Now really get rid of ISessionDataContainer on bootstrap.
1.0.3 (2012-04-05)
Modified: cipher.session/trunk/src/cipher/session/bootstrap.py
===================================================================
--- cipher.session/trunk/src/cipher/session/bootstrap.py 2012-07-20 14:22:14 UTC (rev 127357)
+++ cipher.session/trunk/src/cipher/session/bootstrap.py 2012-07-21 09:24:20 UTC (rev 127358)
@@ -22,10 +22,12 @@
from zope.app.appsetup.bootstrap import getInformationFromEvent
from zope.app.appsetup.bootstrap import addConfigureUtility
from zope.processlifetime import IDatabaseOpenedWithRoot
+from zope.session.interfaces import ISessionDataContainer
from cipher.session import interfaces
from cipher.session.session import SessionDataManager
+
@zope.component.adapter(IDatabaseOpenedWithRoot)
def bootStrapSessionDataManager(event):
"""Subscriber to the IDatabaseOpenedWithRoot
@@ -37,9 +39,27 @@
"""
db, connection, root, root_folder = getInformationFromEvent(event)
+
try:
+ # now first get rid of any ISessionDataContainer
sm = root_folder.getSiteManager()
utils = [reg for reg in sm.registeredUtilities()
+ if reg.provided.isOrExtends(ISessionDataContainer)
+ and reg.name == '']
+ if utils:
+ # check our assumptions: there's only one, registered as a component
+ assert len(utils) == 1
+ assert utils[0].factory is None
+ utility = utils[0].component
+ sm.unregisterUtility(utility, ISessionDataContainer)
+
+ try:
+ del utility.__parent__[utility.__name__]
+ except:
+ pass
+ transaction.commit()
+
+ utils = [reg for reg in sm.registeredUtilities()
if reg.provided.isOrExtends(interfaces.ISessionDataManager)
and reg.name == '']
if utils:
@@ -51,6 +71,11 @@
return # nothing to do
sm.unregisterUtility(utility, interfaces.ISessionDataManager)
+ try:
+ del utility.__parent__[utility.__name__]
+ except:
+ pass
+
addConfigureUtility(
root_folder,
interfaces.ISessionDataManager, 'SessionDataManager',
More information about the checkins
mailing list