[Zope3-checkins] CVS: zopeproducts/db2da - TODO:1.1 __init__.py:1.1
adapter.py:1.1 configure.zcml:1.1
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Aug 19 04:11:30 EDT 2003
Update of /cvs-repository/zopeproducts/db2da
In directory cvs.zope.org:/tmp/cvs-serv17486/db2da
Added Files:
TODO __init__.py adapter.py configure.zcml
Log Message:
Updated all Database Adaptors.
=== Added File zopeproducts/db2da/TODO ===
- BLOB, CLOB, DBCLOB support
- Host connection strings
- Connection to a real database
=== Added File zopeproducts/db2da/__init__.py ===
# make this a python package
=== Added File zopeproducts/db2da/adapter.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""DB2 database adapter.
$Id: adapter.py,v 1.1 2003/08/19 07:11:23 srichter Exp $
"""
import DB2
from zope.app.rdb import ZopeDatabaseAdapter, parseDSN
class db2Adapter(ZopeDatabaseAdapter):
"""A DB2 adapter for Zope3"""
def _connection_factory(self):
"""Create a DB2 DBI connection based on the DSN"""
conn_info = parseDSN(self.dsn)
return DB2.connect(uid=conn_info['username'],
pwd=conn_info['password'],
dsn=conn_info['dbname'])
=== Added File zopeproducts/db2da/configure.zcml ===
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="db2da">
<content class=".adapter.db2Adapter">
<factory
id="zope.da.db2DA"
permission="zope.Public" />
<require
permission="zope.Public"
interface="zope.app.interfaces.rdb.IZopeDatabaseAdapter" />
</content>
<browser:addform
name="AddDB2DA"
schema="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
label="Add DB2 Database Adapter"
content_factory=".adapter.db2Adapter"
arguments="dsn"
fields="dsn"
permission="zope.ManageContent" />
<!-- Menu entry for "add component" menu -->
<browser:menuItem
menu="add_component"
for="zope.app.interfaces.container.IAdding"
title="DB2 DA"
description="A DB2 Database Adapter"
action="AddDB2DA" />
<!-- Menu entry for "add utility" menu -->
<browser:menuItem
menu="add_utility"
for="zope.app.interfaces.container.IAdding"
title="DB2 DA"
description="A DB2 Database Adapter"
action="AddDB2DA" />
<!-- Menu entry for "add connection" menu -->
<browser:menuItem
menu="add_connection"
for="zope.app.interfaces.container.IAdding"
title="DB2 DA"
description="A DB2 Database Adapter"
action="AddDB2DA" />
</configure>
More information about the Zope3-Checkins
mailing list