[Zope-CVS] CVS: Products/Ape - component.xml:1.5 datatypes.py:1.3
Shane Hathaway
shane at zope.com
Wed Mar 24 10:52:38 EST 2004
Update of /cvs-repository/Products/Ape
In directory cvs.zope.org:/tmp/cvs-serv26065
Modified Files:
component.xml datatypes.py
Log Message:
Brought the ZConfig schema for SQL databases up to date with the current code.
=== Products/Ape/component.xml 1.4 => 1.5 ===
--- Products/Ape/component.xml:1.4 Thu Feb 19 12:06:53 2004
+++ Products/Ape/component.xml Wed Mar 24 10:52:07 2004
@@ -19,6 +19,21 @@
</ape-db>
+Or for a PostgreSQL connection:
+
+
+<ape-db sql>
+ <ape-storage>
+ mapper-variation sql
+ <ape-dbapi-connection db>
+ connection-class apelib.sql.dbapi.PostgreSQLConnection
+ module-name psycopg
+ connect-expression connect('')
+ </ape-dbapi-connection>
+ </ape-storage>
+ mount-point /sql
+</ape-db>
+
-->
@@ -68,24 +83,27 @@
<sectiontype name="ape-dbapi-connection" implements="apelib.Connection"
datatype=".DBAPIConnection">
- <key name="module-name" required="yes">
+ <key name="connection-class" required="yes"
+ datatype="Zope.Startup.datatypes.importable_name">
<description>
- The base filesystem path for the storage.
+ A class that implements apelib.sql.interfaces.IRDBMSConnection.
</description>
</key>
- <key name="prefix" default="zodb">
+ <key name="module-name" required="yes">
<description>
- A prefix to use for all tables in the database.
+ The name of the DB-API module to use. (See PEP 249.)
</description>
</key>
- <multikey name="param" attribute="params">
+ <key name="connect-expression" required="yes">
<description>
- Positional parameters for opening the database.
+ The Python expression to use for connecting to the database.
+ The name 'connect' is in the namespace and is bound to the
+ 'connect' function from the DB-API module.
</description>
- </multikey>
- <key name="+" attribute="kwparams">
+ </key>
+ <key name="prefix" default="zodb_">
<description>
- Keyword parameters for opening the database.
+ A prefix to use for all tables in the database.
</description>
</key>
</sectiontype>
=== Products/Ape/datatypes.py 1.2 => 1.3 ===
--- Products/Ape/datatypes.py:1.2 Thu Feb 19 12:06:53 2004
+++ Products/Ape/datatypes.py Wed Mar 24 10:52:07 2004
@@ -18,7 +18,7 @@
from ZODB.config import BaseConfig
from Zope.Startup.datatypes import ZopeDatabase
-from apelib.zope2.mapper import loadConf
+from apelib.zope2.mapper import load_conf
from apelib.zodb3 import storage, db, resource
@@ -29,7 +29,7 @@
conns = {}
for c in config.connections:
conns[c.name] = c.open()
- conf = loadConf(config.mapper_variation, search_products=1)
+ conf = load_conf(config.mapper_variation, search_products=1)
r = resource.StaticResource(conf)
return storage.ApeStorage(
conf_resource=r, connections=conns, name=self.name)
@@ -40,7 +40,7 @@
def createDB(self):
config = self.config
if config.mapper_variation:
- conf = loadConf(config.mapper_variation, search_products=1)
+ conf = load_conf(config.mapper_variation, search_products=1)
r = resource.StaticResource(conf)
else:
r = None
@@ -69,13 +69,12 @@
return impl(**getParams(self.config))
-class DBAPIConnection:
+class DBAPIConnection(BaseConfig):
def open(self):
- from apelib.sql.dbapi import DBAPIConnector as impl
- config = self.config
- return impl(module_name=config.module_name,
- prefix=config.prefix,
- params=config.params,
- kwparams=config.kwparams)
-
+ c = self.config
+ return c.connection_class(
+ module_name=c.module_name,
+ connect_expression=c.connect_expression,
+ prefix=c.prefix,
+ )
More information about the Zope-CVS
mailing list