[Zope3-checkins] SVN: Zope3/trunk/ Made zope.app.session an optional package.

Jim Fulton jim at zope.com
Tue Jun 1 17:28:08 EDT 2004


Log message for revision 25164:
Made zope.app.session an optional package.

This required moving it's bootstrap code 
to zope.app.session.




-=-
Added: Zope3/trunk/package-includes/zope.app.session-configure.zcml
===================================================================
--- Zope3/trunk/package-includes/zope.app.session-configure.zcml	2004-06-01 20:51:45 UTC (rev 25163)
+++ Zope3/trunk/package-includes/zope.app.session-configure.zcml	2004-06-01 21:28:07 UTC (rev 25164)
@@ -0,0 +1 @@
+<include package="zope.app.session" />


Property changes on: Zope3/trunk/package-includes/zope.app.session-configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/PACKAGE.cfg
===================================================================
--- Zope3/trunk/src/zope/app/PACKAGE.cfg	2004-06-01 20:51:45 UTC (rev 25163)
+++ Zope3/trunk/src/zope/app/PACKAGE.cfg	2004-06-01 21:28:07 UTC (rev 25164)
@@ -79,7 +79,6 @@
 schema
 security
 servicenames.py
-session
 site
 size
 tests

Modified: Zope3/trunk/src/zope/app/appsetup/bootstrap.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2004-06-01 20:51:45 UTC (rev 25163)
+++ Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2004-06-01 21:28:07 UTC (rev 25164)
@@ -38,15 +38,11 @@
 
 # XXX It should be possible to remove each of these from the basic
 # bootstrap, at which point we can remove the
-# zope.app.principalannotation, and zope.app.session packages from
+# zope.app.principalannotation packages from
 # zope.app.
 
 from zope.app.principalannotation import PrincipalAnnotationService
 
-from zope.app.session.interfaces import \
-     IBrowserIdManager, ISessionDataContainer
-from zope.app.session import \
-     CookieBrowserIdManager, PersistentSessionDataContainer
 
 class BootstrapSubscriberBase:
     """A startup event subscriber base class.
@@ -166,16 +162,6 @@
 
         self.ensureService(Utilities, LocalUtilityService)
 
-        # Utilities
-        self.ensureUtility(
-                IBrowserIdManager, 'CookieBrowserIdManager',
-                CookieBrowserIdManager,
-                )
-        self.ensureUtility(
-                ISessionDataContainer, 'PersistentSessionData',
-                PersistentSessionDataContainer, ''
-                )
-
 bootstrapInstance = BootstrapInstance()
 
 

Modified: Zope3/trunk/src/zope/app/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/configure.zcml	2004-06-01 20:51:45 UTC (rev 25163)
+++ Zope3/trunk/src/zope/app/configure.zcml	2004-06-01 21:28:07 UTC (rev 25164)
@@ -56,7 +56,6 @@
   <include package="zope.app.principalannotation" />  
 
   <!-- Utilities -->
-  <include package="zope.app.session" />
   <include package="zope.app.schema" />
 
   <!-- Misc. Service Manager objects -->

Added: Zope3/trunk/src/zope/app/session/PACKAGE.cfg
===================================================================
--- Zope3/trunk/src/zope/app/session/PACKAGE.cfg	2004-06-01 20:51:45 UTC (rev 25163)
+++ Zope3/trunk/src/zope/app/session/PACKAGE.cfg	2004-06-01 21:28:07 UTC (rev 25164)
@@ -0,0 +1,3 @@
+<data-files zopeskel/etc/package-includes>
+  *-configure.zcml
+</data-files>


Property changes on: Zope3/trunk/src/zope/app/session/PACKAGE.cfg
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: Zope3/trunk/src/zope/app/session/bootstrap.py (from rev 25157, Zope3/trunk/src/zope/app/appsetup/bootstrap.py)
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2004-06-01 19:17:55 UTC (rev 25157)
+++ Zope3/trunk/src/zope/app/session/bootstrap.py	2004-06-01 21:28:07 UTC (rev 25164)
@@ -0,0 +1,43 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap code.
+
+This module contains code to bootstrap a Zope3 instance.  For example
+it makes sure a root folder exists and creates and configures some
+essential services.
+
+$Id$
+"""
+
+from zope.app.appsetup.bootstrap import BootstrapSubscriberBase
+
+
+from zope.app.session.interfaces import \
+     IBrowserIdManager, ISessionDataContainer
+from zope.app.session import \
+     CookieBrowserIdManager, PersistentSessionDataContainer
+
+class BootstrapInstance(BootstrapSubscriberBase):
+
+    def doSetup(self):
+        self.ensureUtility(
+                IBrowserIdManager, 'CookieBrowserIdManager',
+                CookieBrowserIdManager,
+                )
+        self.ensureUtility(
+                ISessionDataContainer, 'PersistentSessionData',
+                PersistentSessionDataContainer,
+                )
+
+bootstrapInstance = BootstrapInstance()


Property changes on: Zope3/trunk/src/zope/app/session/bootstrap.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.30
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/session/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/session/configure.zcml	2004-06-01 20:51:45 UTC (rev 25163)
+++ Zope3/trunk/src/zope/app/session/configure.zcml	2004-06-01 21:28:07 UTC (rev 25164)
@@ -55,6 +55,11 @@
     <allow interface=".interfaces.ISession" />
   </content>
 
+  <subscriber
+      for="zope.app.appsetup.IDatabaseOpenedEvent"
+      factory=".bootstrap.bootstrapInstance"
+      />
+
   <include file="browser.zcml" />
 
 </configure>

Modified: Zope3/trunk/src/zope/app/session/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/session/tests.py	2004-06-01 20:51:45 UTC (rev 25163)
+++ Zope3/trunk/src/zope/app/session/tests.py	2004-06-01 21:28:07 UTC (rev 25164)
@@ -319,10 +319,34 @@
     >>> tearDown()
     """
 
+from zope.app.appsetup.tests import TestBootstrapSubscriberBase, EventStub
+class TestBootstrapInstance(TestBootstrapSubscriberBase):
 
+    def test_bootstrapInstance(self):
+        from zope.app.appsetup.bootstrap import bootstrapInstance
+        bootstrapInstance(EventStub(self.db))
+        from zope.app.session.bootstrap import bootstrapInstance
+        bootstrapInstance(EventStub(self.db))
+        from zope.app.publication.zopepublication import ZopePublication
+        from zope.app.component.hooks import setSite
+        from zope.app import zapi
+        
+        cx = self.db.open()
+        root = cx.root()
+        root_folder = root[ZopePublication.root_name]
+        setSite(root_folder)
+
+        zapi.getUtility(IBrowserIdManager)
+        zapi.getUtility(ISessionDataContainer)
+        
+        
+        cx.close()
+
+
 def test_suite():
     return unittest.TestSuite((
         doctest.DocTestSuite(),
+        unittest.makeSuite(TestBootstrapInstance),
         ))
 
 if __name__ == '__main__':

Added: Zope3/trunk/src/zope/app/session/zope.app.session-configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/session/zope.app.session-configure.zcml	2004-06-01 20:51:45 UTC (rev 25163)
+++ Zope3/trunk/src/zope/app/session/zope.app.session-configure.zcml	2004-06-01 21:28:07 UTC (rev 25164)
@@ -0,0 +1 @@
+<include package="zope.app.session" />


Property changes on: Zope3/trunk/src/zope/app/session/zope.app.session-configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the Zope3-Checkins mailing list