[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/rdb/ Stop the file scatter regarding ZCML files:

Philipp von Weitershausen philikon at philikon.de
Tue Apr 11 14:00:43 EDT 2006


Log message for revision 66862:
  Stop the file scatter regarding ZCML files:
  * Combine metadirectives and metaconfigure into zcml.py
  * Combine meta.zcml files
  

Changed:
  D   Zope3/branches/jim-adapter/src/zope/rdb/gadfly-meta.zcml
  D   Zope3/branches/jim-adapter/src/zope/rdb/gadflymeta.py
  A   Zope3/branches/jim-adapter/src/zope/rdb/gadflyzcml.py
  U   Zope3/branches/jim-adapter/src/zope/rdb/meta.zcml
  D   Zope3/branches/jim-adapter/src/zope/rdb/metaconfigure.py
  D   Zope3/branches/jim-adapter/src/zope/rdb/metadirectives.py
  U   Zope3/branches/jim-adapter/src/zope/rdb/tests/gadflyroot.zcml
  A   Zope3/branches/jim-adapter/src/zope/rdb/zcml.py

-=-
Deleted: Zope3/branches/jim-adapter/src/zope/rdb/gadfly-meta.zcml
===================================================================
--- Zope3/branches/jim-adapter/src/zope/rdb/gadfly-meta.zcml	2006-04-11 17:59:59 UTC (rev 66861)
+++ Zope3/branches/jim-adapter/src/zope/rdb/gadfly-meta.zcml	2006-04-11 18:00:42 UTC (rev 66862)
@@ -1,11 +0,0 @@
-<configure 
-    xmlns="http://namespaces.zope.org/zope"
-    xmlns:meta="http://namespaces.zope.org/meta">
-
-  <meta:directive 
-      namespace="http://namespaces.zope.org/rdb"
-      name="gadflyRoot" 
-      schema=".gadflymeta.IGadflyRoot"
-      handler=".gadflymeta.gadflyRootHandler" />
-
-</configure>

Deleted: Zope3/branches/jim-adapter/src/zope/rdb/gadflymeta.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/rdb/gadflymeta.py	2006-04-11 17:59:59 UTC (rev 66861)
+++ Zope3/branches/jim-adapter/src/zope/rdb/gadflymeta.py	2006-04-11 18:00:42 UTC (rev 66862)
@@ -1,37 +0,0 @@
-##############################################################################
-#
-# 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.1 (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.
-#
-##############################################################################
-"""'gadflyRoot' Directive Handler
-
-$Id: metaconfigure.py 25177 2004-06-02 13:17:31Z jim $
-"""
-from zope.configuration.fields import Path
-from zope.interface import Interface
-
-from zope.rdb.gadflyda import setGadflyRoot 
-
-class IGadflyRoot(Interface):
-    """This directive creates a globale connection to an RDBMS."""
-
-    path = Path(
-        title=u"Path of Gadfly Root",
-        description=u"Specifies the path of the gadfly root relative to the"
-                    u"packge.",
-        required=True)
-
-
-def gadflyRootHandler(_context, path):
-    _context.action(
-            discriminator = ('gadflyRoot',),
-            callable = setGadflyRoot,
-            args = (path,) )

Copied: Zope3/branches/jim-adapter/src/zope/rdb/gadflyzcml.py (from rev 66859, Zope3/branches/jim-adapter/src/zope/rdb/gadflymeta.py)

Modified: Zope3/branches/jim-adapter/src/zope/rdb/meta.zcml
===================================================================
--- Zope3/branches/jim-adapter/src/zope/rdb/meta.zcml	2006-04-11 17:59:59 UTC (rev 66861)
+++ Zope3/branches/jim-adapter/src/zope/rdb/meta.zcml	2006-04-11 18:00:42 UTC (rev 66862)
@@ -5,9 +5,15 @@
   <meta:directive 
       namespace="http://namespaces.zope.org/rdb"
       name="provideConnection" 
-      schema=".metadirectives.IProvideConnectionDirective"
-      handler=".metaconfigure.connectionhandler" />
+      schema=".zcml.IProvideConnectionDirective"
+      handler=".zcml.connectionhandler"
+      />
 
-  <include file="gadfly-meta.zcml" />
+  <meta:directive 
+      namespace="http://namespaces.zope.org/rdb"
+      name="gadflyRoot" 
+      schema=".gadflyzcml.IGadflyRoot"
+      handler=".gadflyzcml.gadflyRootHandler"
+      />
 
 </configure>

Deleted: Zope3/branches/jim-adapter/src/zope/rdb/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/rdb/metaconfigure.py	2006-04-11 17:59:59 UTC (rev 66861)
+++ Zope3/branches/jim-adapter/src/zope/rdb/metaconfigure.py	2006-04-11 18:00:42 UTC (rev 66862)
@@ -1,39 +0,0 @@
-##############################################################################
-#
-# 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.1 (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$
-"""
-import zope.component
-from zope.rdb.interfaces import IZopeDatabaseAdapter
-
-
-def connectionhandler(_context, name, component, dsn):
-    connection = component(dsn)
-    _context.action(
-            discriminator = ('provideConnection', name),
-            callable = provideConnection,
-            args = (name, connection) )
-    
-def provideConnection(name, connection):
-    """ Registers a database connection
-    
-    Uses the global site manager for registering the connection
-    """
-    gsm = zope.component.getGlobalSiteManager()
-    gsm.registerUtility(connection, IZopeDatabaseAdapter, name)
-
-
-    
-

Deleted: Zope3/branches/jim-adapter/src/zope/rdb/metadirectives.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/rdb/metadirectives.py	2006-04-11 17:59:59 UTC (rev 66861)
+++ Zope3/branches/jim-adapter/src/zope/rdb/metadirectives.py	2006-04-11 18:00:42 UTC (rev 66862)
@@ -1,42 +0,0 @@
-##############################################################################
-#
-# 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.1 (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$
-"""
-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)

Modified: Zope3/branches/jim-adapter/src/zope/rdb/tests/gadflyroot.zcml
===================================================================
--- Zope3/branches/jim-adapter/src/zope/rdb/tests/gadflyroot.zcml	2006-04-11 17:59:59 UTC (rev 66861)
+++ Zope3/branches/jim-adapter/src/zope/rdb/tests/gadflyroot.zcml	2006-04-11 18:00:42 UTC (rev 66862)
@@ -1,7 +1,7 @@
 <configure xmlns="http://namespaces.zope.org/zope"
            xmlns:rdb="http://namespaces.zope.org/rdb">
 
-  <include package="zope.rdb" file="gadfly-meta.zcml"/>
+  <include package="zope.rdb" file="meta.zcml"/>
   <rdb:gadflyRoot path="./test/dir" />
  
 </configure>

Copied: Zope3/branches/jim-adapter/src/zope/rdb/zcml.py (from rev 66859, Zope3/branches/jim-adapter/src/zope/rdb/metadirectives.py)
===================================================================
--- Zope3/branches/jim-adapter/src/zope/rdb/metadirectives.py	2006-04-11 17:32:49 UTC (rev 66859)
+++ Zope3/branches/jim-adapter/src/zope/rdb/zcml.py	2006-04-11 18:00:42 UTC (rev 66862)
@@ -0,0 +1,59 @@
+##############################################################################
+#
+# 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.1 (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$
+"""
+import zope.component
+from zope.configuration.fields import GlobalObject
+from zope.interface import Interface
+from zope.schema import TextLine
+from zope.rdb.interfaces import IZopeDatabaseAdapter
+
+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)
+
+def connectionhandler(_context, name, component, dsn):
+    connection = component(dsn)
+    _context.action(
+            discriminator = ('provideConnection', name),
+            callable = provideConnection,
+            args = (name, connection) )
+    
+def provideConnection(name, connection):
+    """ Registers a database connection
+    
+    Uses the global site manager for registering the connection
+    """
+    gsm = zope.component.getGlobalSiteManager()
+    gsm.registerUtility(connection, IZopeDatabaseAdapter, name)



More information about the Zope3-Checkins mailing list