[Checkins] SVN: z3c.saconfig/trunk/src/z3c/saconfig/ Roll back changes to do with a session registry defined in

Martijn Faassen faassen at startifact.com
Tue Aug 11 16:48:33 EDT 2009


Log message for revision 102686:
  Roll back changes to do with a session registry defined in
  zope.sqlalchemy. This got moved to a branch and is unlikely to
  make it in any time soon, which breaks the z3c.saconfig code.
  Since z3c.saconfig actually sets up a universal Session this isn't
  as bad as it seems as long as it is used.
  

Changed:
  U   z3c.saconfig/trunk/src/z3c/saconfig/README.txt
  U   z3c.saconfig/trunk/src/z3c/saconfig/meta.zcml
  U   z3c.saconfig/trunk/src/z3c/saconfig/scopedsession.py
  U   z3c.saconfig/trunk/src/z3c/saconfig/zcml.py

-=-
Modified: z3c.saconfig/trunk/src/z3c/saconfig/README.txt
===================================================================
--- z3c.saconfig/trunk/src/z3c/saconfig/README.txt	2009-08-11 19:54:45 UTC (rev 102685)
+++ z3c.saconfig/trunk/src/z3c/saconfig/README.txt	2009-08-11 20:48:32 UTC (rev 102686)
@@ -20,18 +20,6 @@
 in a single site; if you want more than one database in your Zope 3
 instance, you will need to set up different sites.
 
-Integration into zope.sqlalchemy
-================================
-
-We can install z3c.salchemy into zope.sqlalchemy to tell zope.sqlalchemy to use
-our implementation of sessions:
-
-  >>> from z3c.saconfig import scopedsession
-  >>> scopedsession.install_sessions()
-
-This can also be done via the "installSessions" zcml directive. It is important
-that this be only done during application setup.
-
 GloballyScopedSession (one database per Zope 3 instance)
 ========================================================
 
@@ -384,34 +372,3 @@
   >>> Session = named_scoped_session('dummy')
   >>> Session().bind is factory()
   True
-
-We can setup the zope.sqlalchemy sessions using the installSessions directive
-(making sure we clean up before testing this):
- 
-  >>> from zope.sqlalchemy import Session, clear_sessions, named_session
-
-  >>> clear_sessions()
-  >>> session = Session()
-  Traceback (most recent call last):
-    ...
-  KeyError: ''
-
-  >>> xmlconfig.xmlconfig(StringIO("""
-  ... <configure xmlns="http://namespaces.zope.org/db">
-  ...   <session name="dummy2" engine="dummy2" />
-  ...   <installSessions/>
-  ... </configure>"""))
-
-  >>> session = Session()
-
-This fails:
-
-  >>> session = named_session('dummy2')
-
-Because until this is called the named scoped session is not in the dict
-
-  >>> session = named_scoped_session('dummy2')
-
-CleanUp:
-
-  >>> clear_sessions()

Modified: z3c.saconfig/trunk/src/z3c/saconfig/meta.zcml
===================================================================
--- z3c.saconfig/trunk/src/z3c/saconfig/meta.zcml	2009-08-11 19:54:45 UTC (rev 102685)
+++ z3c.saconfig/trunk/src/z3c/saconfig/meta.zcml	2009-08-11 20:48:32 UTC (rev 102686)
@@ -18,12 +18,6 @@
        handler=".zcml.session"
        />
 
-    <meta:directive
-       name="installSessions"
-       schema="zope.interface.Interface"
-       handler=".zcml.install_sessions"
-       />
-
   </meta:directives>
 
 </configure>

Modified: z3c.saconfig/trunk/src/z3c/saconfig/scopedsession.py
===================================================================
--- z3c.saconfig/trunk/src/z3c/saconfig/scopedsession.py	2009-08-11 19:54:45 UTC (rev 102685)
+++ z3c.saconfig/trunk/src/z3c/saconfig/scopedsession.py	2009-08-11 20:48:32 UTC (rev 102686)
@@ -32,15 +32,3 @@
         return _named_scoped_sessions.setdefault(name,
                             scoped_session(lambda:session_factory(name),
                                            lambda:scopefunc(name)))
-
-class _NamedScopedSessionDict:
-
-    def __getitem__(self, name):
-        return named_scoped_session(name)
-
-    def __setitem__(self, name, session):
-        _named_scoped_sessions[name] = session
-
-def install_sessions():
-    from zope.sqlalchemy import install_sessions
-    install_sessions(_NamedScopedSessionDict())

Modified: z3c.saconfig/trunk/src/z3c/saconfig/zcml.py
===================================================================
--- z3c.saconfig/trunk/src/z3c/saconfig/zcml.py	2009-08-11 19:54:45 UTC (rev 102685)
+++ z3c.saconfig/trunk/src/z3c/saconfig/zcml.py	2009-08-11 20:48:32 UTC (rev 102686)
@@ -5,7 +5,6 @@
 
 import utility
 import interfaces
-from z3c.saconfig import scopedsession
 
 class IEngineDirective(zope.interface.Interface):
     """Registers a database engine factory."""
@@ -103,7 +102,3 @@
         component=scoped_session,
         permission=zope.component.zcml.PublicPermission,
         name=name)
-
-def install_sessions(_context):
-    _context.action(discriminator=('installSessions'),
-                    callable=scopedsession.install_sessions)



More information about the Checkins mailing list