[Zope3-checkins] CVS: Zope3/src/zope/app/rdb - metadirectives.py:1.1 configure.zcml:1.7 meta.zcml:1.3 metaconfigure.py:1.2 service.zcml:1.2

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Aug 3 13:08:17 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/rdb
In directory cvs.zope.org:/tmp/cvs-serv28857

Modified Files:
	configure.zcml meta.zcml metaconfigure.py service.zcml 
Added Files:
	metadirectives.py 
Log Message:
Converted 'rdb' ZCML namespace.


=== Added File Zope3/src/zope/app/rdb/metadirectives.py ===
##############################################################################
#
# Copyright (c) 2001, 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.
#
##############################################################################
"""'rdb' ZCML Namespace Directives

$Id: metadirectives.py,v 1.1 2003/08/03 16:07:39 srichter Exp $
"""
from zope.configuration.fields import GlobalObject
from zope.interface import Interface
from zope.schema import TextLine

class IProvideConnectionDirective(Interface):
    """This directive creates a globale connection to an RDBMS."""

    name = TextLine(
        title=u"Name",
        description=u"This is the name the connection will be known as.",
        required=True)

    component = GlobalObject(
        title=u"Component",
        description=u"Specifies the component that provides the connection. "
                     "This component handles one particular RDBMS.",
        required=True)

    dsn = TextLine(
        title=u"DSN",
        description=u"The DSN contains all the connection information. The"\
                    u"syntax looks as follows: \n" \
                    u"dbi://username:password@host:port/dbname;param1=value...",
        default=u"dbi://localhost/testdb",
        required=True)


=== Zope3/src/zope/app/rdb/configure.zcml 1.6 => 1.7 ===
--- Zope3/src/zope/app/rdb/configure.zcml:1.6	Sat Jun 21 17:22:12 2003
+++ Zope3/src/zope/app/rdb/configure.zcml	Sun Aug  3 12:07:39 2003
@@ -1,31 +1,29 @@
-<zopeConfigure
-   xmlns='http://namespaces.zope.org/zope'
->
-
-<content class="zope.app.rdb.gadflyda.GadflyAdapter">
-  <factory
-      id="GadflyDA"
-      permission="zope.Public"
-      />
-  <require
-      permission="zope.Public"
-      interface="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
-      />
-  <implements
-      interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
-      />
-  <implements
-      interface=
-      "zope.app.interfaces.services.registration.IAttributeRegisterable"
-      />
-</content>
-
-<content class="zope.app.rdb.ResultSet">
-  <require
-      permission="zope.View"
-      attributes="__getitem__ __getslice__ __len__ __iter__ __contains__
-                  index count __str__ __add__ __radd__"
-      />
-</content>
+<configure xmlns="http://namespaces.zope.org/zope">
 
-</zopeConfigure>
+  <content class="zope.app.rdb.gadflyda.GadflyAdapter">
+
+    <factory
+        id="GadflyDA"
+        permission="zope.Public" />
+
+    <require
+        permission="zope.Public"
+        interface="zope.app.interfaces.rdb.IZopeDatabaseAdapter" />
+
+    <implements
+        interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
+
+    <implements
+        interface=
+        "zope.app.interfaces.services.registration.IAttributeRegisterable" />
+
+  </content>
+
+  <content class="zope.app.rdb.ResultSet">
+    <require
+        permission="zope.View"
+        attributes="__getitem__ __getslice__ __len__ __iter__ __contains__
+                    index count __str__ __add__ __radd__" />
+  </content>
+
+</configure>


=== Zope3/src/zope/app/rdb/meta.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/rdb/meta.zcml:1.2	Mon Jul  7 14:06:03 2003
+++ Zope3/src/zope/app/rdb/meta.zcml	Sun Aug  3 12:07:39 2003
@@ -1,11 +1,11 @@
-<zopeConfigure xmlns='http://namespaces.zope.org/zope'>
+<configure 
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:meta="http://namespaces.zope.org/meta">
 
-<directives namespace="http://namespaces.zope.org/rdb">
+  <meta:directive 
+      namespace="http://namespaces.zope.org/rdb"
+      name="provideConnection" 
+      schema=".metadirectives.IProvideConnectionDirective"
+      handler=".metaconfigure.connectionhandler" />
 
-  <directive name="provideConnection" attributes="name component dsn"
-             handler="zope.app.rdb.metaconfigure.connectionhandler" />
-
-</directives>
-
-
-</zopeConfigure>
+</configure>


=== Zope3/src/zope/app/rdb/metaconfigure.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/rdb/metaconfigure.py:1.1	Mon Jul  7 13:14:55 2003
+++ Zope3/src/zope/app/rdb/metaconfigure.py	Sun Aug  3 12:07:39 2003
@@ -1,20 +1,30 @@
+##############################################################################
+#
+# Copyright (c) 2001, 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.
+#
+##############################################################################
+"""'rdb' ZCML Namespace Directive Handler
+
+$Id$
+"""
 from zope.component import getService
 from zope.configuration.action import Action
 from zope.app.services.servicenames import SQLDatabaseConnections
 
 def connectionhandler(_context, name, component, dsn):
-
-    component = _context.resolve(component)
-
     connection = component(dsn)
-
-    return [
-        Action(
+    _context.action(
             discriminator = ('provideConnection', name),
             callable = provideConnection,
-            args = (name, connection),
-            )
-        ]
+            args = (name, connection) )
 
 def provideConnection(name, connection):
     getService(None, SQLDatabaseConnections).provideConnection(name, connection)


=== Zope3/src/zope/app/rdb/service.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/rdb/service.zcml:1.1	Mon Jul  7 14:06:03 2003
+++ Zope3/src/zope/app/rdb/service.zcml	Sun Aug  3 12:07:39 2003
@@ -1,9 +1,12 @@
-<zopeConfigure xmlns='http://namespaces.zope.org/zope'>
+<configure xmlns="http://namespaces.zope.org/zope">
 
-<serviceType id='SQLDatabaseConnections'
-             interface='zope.app.interfaces.rdb.IGlobalConnectionService' />
-<service serviceType='SQLDatabaseConnections'
-         permission='zope.ManageContent'
-         component='zope.app.rdb.connectionService' />
+  <serviceType 
+      id="SQLDatabaseConnections"
+      interface="zope.app.interfaces.rdb.IGlobalConnectionService" />
 
-</zopeConfigure>
\ No newline at end of file
+  <service 
+      serviceType="SQLDatabaseConnections"
+      permission="zope.ManageContent"
+      component="zope.app.rdb.connectionService" />
+
+</configure>
\ No newline at end of file




More information about the Zope3-Checkins mailing list