[Zope3-checkins] CVS: zopeproducts/sybaseda - TODO:1.1 __init__.py:1.1 adapter.py:1.1 browser.py:1.1 configure.zcml:1.1

runyaga runyaga at thisbox.com
Mon Aug 11 04:23:32 EDT 2003


Update of /cvs-repository/zopeproducts/sybaseda
In directory cvs.zope.org:/tmp/cvs-serv21039

Added Files:
	TODO __init__.py adapter.py browser.py configure.zcml 
Log Message:
created new module, sybaseda to be consistent with zope3 naming
removed browser module from sybaseDA and moved everything into
sybaseda module.  have simple test_adatper.py but will write
unit tests for dates when we start using them on our application.

can someone get rid of the old 'sybaseDA' module?



=== Added File zopeproducts/sybaseda/TODO ===
    -   write more tests!
    -   Typkompatibilitaet
    -   "named"-paramstyle will "SELECt .... @name" statt "SELECT ... :name". Passt das?
    -   Echte Datenbank


=== Added File zopeproducts/sybaseda/__init__.py ===
# make this a python package



=== Added File zopeproducts/sybaseda/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.
#
##############################################################################
"""Sybase database adapter.

$Id: adapter.py,v 1.1 2003/08/11 07:23:24 runyaga Exp $
"""

import Sybase 

from zope.app.rdb import ZopeDatabaseAdapter, parseDSN

class SybaseAdapter(ZopeDatabaseAdapter):
    """A Sybase adapter for Zope3"""

    # The module declares itself as threadsafe in level 2
    threadsafety = Sybase.threadsafety
    paramstyle = Sybase.paramstyle

    def _connection_factory(self):
        """Create a Sybase connection based on the DSN"""
        conn_info = parseDSN(self.dsn)
        # XXX we need to incorporate the port information 
        # in here too.
        return Sybase.connect(conn_info['host'],
                              conn_info['username'],
                              conn_info['password'],
                              database=conn_info['dbname'])



=== Added File zopeproducts/sybaseda/browser.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.
#
##############################################################################


from zope.app.browser.rdb.rdb import AdapterAdd


class SybaseDAAddView(AdapterAdd):
    """Provide a user interface for adding a Psycopg DA"""

    _adapter_factory_id = "SybaseDA"



=== Added File zopeproducts/sybaseda/configure.zcml ===
<zopeConfigure
   xmlns="http://namespaces.zope.org/zope"
   xmlns:browser="http://namespaces.zope.org/browser">

    <content class=".adapter.SybaseAdapter">

        <factory
            id="SybaseDA"
            permission="zope.Public"
            />

        <implements
            interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
            />
        <implements
            interface=
            "zope.app.interfaces.services.registration.IAttributeRegisterable"
            />

        <require permission="zope.Public"
            interface="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
            />

    </content>

     <!-- Browser-specific directives -->
    <browser:view
        name="zopeproducts.sybaseda"
        for="zope.app.interfaces.container.IAdding"
        class="zopeproducts.sybaseda.browser.SybaseDAAddView"
        permission="zope.Public">

        <browser:page name="+" attribute="add" />
        <browser:page name="action.html" attribute="action" />

    </browser:view>

    <!-- Menu entry for "add component" menu -->
    <browser:menuItem 
        menu="add_component"
        for="zope.app.interfaces.container.IAdding"
        title="Sybase DA" 
        action="zopeproducts.sybaseda"
        description="A Sybase Database Adapter" />

    <!-- Menu entry for "add connection" menu -->
    <browser:menuItem
        menu="add_connection"
        for="zope.app.interfaces.container.IAdding"
        title="Sybase DA"
        description="A Sybase Database Adapter using the Sybase driver"
        action="zopeproducts.sybaseda"
        />

</zopeConfigure>




More information about the Zope3-Checkins mailing list