[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ConnectionService - ConnectionService.py:1.6.2.2 IConnectionAdding.py:NONE IConnectionManager.py:NONE
Marius Gedminas
mgedmin@codeworks.lt
Wed, 11 Dec 2002 07:20:38 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ConnectionService
In directory cvs.zope.org:/tmp/cvs-serv28934/lib/python/Zope/App/OFS/Services/ConnectionService
Modified Files:
Tag: named-component-configuration-branch
ConnectionService.py
Removed Files:
Tag: named-component-configuration-branch
IConnectionAdding.py IConnectionManager.py
Log Message:
ConnectionService refactoring and bugfixes
Removed a bunch of decoys from Zope.App.OFS.Services subtree
=== Zope3/lib/python/Zope/App/OFS/Services/ConnectionService/ConnectionService.py 1.6.2.1 => 1.6.2.2 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ConnectionService/ConnectionService.py:1.6.2.1 Tue Dec 10 14:16:00 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ConnectionService/ConnectionService.py Wed Dec 11 07:20:07 2002
@@ -17,19 +17,21 @@
from Persistence import Persistent
from Zope.ContextWrapper import ContextMethod
-from Zope.Proxy.ContextWrapper import ContextWrapper
from Zope.App.ComponentArchitecture.NextService import queryNextService
-from Zope.App.OFS.Services.ConfigurationInterfaces import IConfigurable
-from Zope.App.OFS.Services.Configuration import ConfigurationRegistry
+from Zope.App.OFS.Services.ConfigurationInterfaces import INameConfigurable
from Zope.App.OFS.Services.Configuration import NameConfigurable
-from IConnectionManager import IConnectionManager
+from Zope.App.RDB.IConnectionService import IConnectionService
+
+
+class ILocalConnectionService(IConnectionService, INameConfigurable):
+ """A local (placeful) connection service"""
class ConnectionService(Persistent, NameConfigurable):
- __doc__ = IConnectionManager.__doc__
+ __doc__ = ILocalConnectionService.__doc__
- __implements__ = IConnectionManager
+ __implements__ = ILocalConnectionService
def __init__(self):
super(ConnectionService, self).__init__()
@@ -44,6 +46,9 @@
if configuration is not None:
adapter = configuration.getComponent()
return adapter()
+ service = queryNextService(self, "SQLDatabaseConnections")
+ if service is not None:
+ return service.getConnection(name)
raise KeyError, name
getConnection = ContextMethod(getConnection)
@@ -59,11 +64,16 @@
def getAvailableConnections(self):
'See Zope.App.RDB.IConnectionService.IConnectionService'
- connections = list(self.listConfigurationNames())
+ connections = {}
+ for name in self.listConfigurationNames():
+ registry = self.queryConfigurations(name)
+ if registry.active() is not None:
+ connections[name] = 0
service = queryNextService(self, "SQLDatabaseConnections")
if service is not None:
- connections.append(service.getAvailableConnections())
- return connections
+ for name in service.getAvailableConnections():
+ connections[name] = 0
+ return connections.keys()
getAvailableConnections = ContextMethod(getAvailableConnections)
=== Removed File Zope3/lib/python/Zope/App/OFS/Services/ConnectionService/IConnectionAdding.py ===
=== Removed File Zope3/lib/python/Zope/App/OFS/Services/ConnectionService/IConnectionManager.py ===