[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/app/sql Remove usage of zope.app.rdb and other zope.app stuff where appropriate

Philipp von Weitershausen philikon at philikon.de
Wed Apr 12 09:44:43 EDT 2006


Log message for revision 66889:
  Remove usage of zope.app.rdb and other zope.app stuff where appropriate
  (in favour of zope.* imports).
  

Changed:
  U   Zope3/branches/jim-adapter/src/zope/app/sqlexpr/sqlexpr.py
  U   Zope3/branches/jim-adapter/src/zope/app/sqlexpr/tests.py
  U   Zope3/branches/jim-adapter/src/zope/app/sqlscript/DEPENDENCIES.cfg
  U   Zope3/branches/jim-adapter/src/zope/app/sqlscript/browser/sqlscript.py
  U   Zope3/branches/jim-adapter/src/zope/app/sqlscript/interfaces.py
  U   Zope3/branches/jim-adapter/src/zope/app/sqlscript/sqlscript.py
  U   Zope3/branches/jim-adapter/src/zope/app/sqlscript/tests/test_sqlscript.py

-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/sqlexpr/sqlexpr.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/sqlexpr/sqlexpr.py	2006-04-12 13:43:19 UTC (rev 66888)
+++ Zope3/branches/jim-adapter/src/zope/app/sqlexpr/sqlexpr.py	2006-04-12 13:44:42 UTC (rev 66889)
@@ -15,16 +15,15 @@
 
 $Id$
 """
+from zope.component import queryUtility, createObject
 from zope.component.interfaces import ComponentLookupError
 from zope.interface import implements
 from zope.tales.interfaces import ITALESExpression
 from zope.tales.expressions import StringExpr
 from zope.exceptions.interfaces import UserError 
+from zope.rdb import queryForResults
+from zope.rdb.interfaces import IZopeDatabaseAdapter, IZopeConnection
 
-from zope.app import zapi
-from zope.app.rdb import queryForResults
-from zope.app.rdb.interfaces import IZopeDatabaseAdapter, IZopeConnection
-
 class ConnectionError(UserError):
     """This exception is raised when the user did not specify an RDB
     connection."""
@@ -37,7 +36,7 @@
             # TODO: It is hard-coded that the connection name variable is called
             # 'sql_conn'. We should find a better solution.
             conn_name = econtext.vars['sql_conn']
-            adapter = zapi.queryUtility(IZopeDatabaseAdapter, conn_name)
+            adapter = queryUtility(IZopeDatabaseAdapter, conn_name)
             if adapter is None:
                 raise ConnectionError("The RDB DA name, '%s' you specified is "
                                       "not valid." % conn_name)
@@ -45,7 +44,7 @@
             rdb = econtext.vars['rdb']
             dsn = econtext.vars['dsn']
             try:
-                adapter = zapi.createObject(rdb, dsn)
+                adapter = createObject(rdb, dsn)
             except ComponentLookupError:
                 raise ConnectionError("The factory id, '%s', you specified in "
                                       "the `rdb` attribute did not match any "

Modified: Zope3/branches/jim-adapter/src/zope/app/sqlexpr/tests.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/sqlexpr/tests.py	2006-04-12 13:43:19 UTC (rev 66888)
+++ Zope3/branches/jim-adapter/src/zope/app/sqlexpr/tests.py	2006-04-12 13:44:42 UTC (rev 66889)
@@ -17,19 +17,18 @@
 """
 import unittest
 
+import zope.component
 from zope.interface import implements
 from zope.component.factory import Factory
 from zope.component.interfaces import IFactory
 from zope.component.testing import PlacelessSetup
 from zope.tales.tests.test_expressions import Data
 from zope.tales.engine import Engine
+from zope.rdb.interfaces import IZopeDatabaseAdapter, IZopeConnection
+from zope.rdb.tests.stubs import ConnectionStub
 
-from zope.app.testing import ztapi
-from zope.app.rdb.interfaces import IZopeDatabaseAdapter, IZopeConnection
-from zope.app.rdb.tests.stubs import ConnectionStub
 from zope.app.sqlexpr.sqlexpr import SQLExpr, ConnectionError
 
-
 class AdapterStub(object):
     implements(IZopeDatabaseAdapter)
 
@@ -68,12 +67,9 @@
 
     def setUp(self):
         super(SQLExprTest, self).setUp()
-        ztapi.provideUtility(IFactory, Factory(AdapterStub),
-                             'zope.da.Stub')
-        ztapi.provideUtility(IFactory, Factory(lambda x: None),
-                             'zope.Fake')
-        ztapi.provideUtility(IZopeDatabaseAdapter, AdapterStub(''),
-                             'test')
+        zope.component.provideUtility(Factory(AdapterStub), name='zope.da.Stub')
+        zope.component.provideUtility(Factory(lambda x: None), name='zope.Fake')
+        zope.component.provideUtility(AdapterStub(''), name='test')
 
     def test_exprUsingRDBAndDSN(self):
         context = Data(vars = {'rdb': 'zope.da.Stub', 'dsn': 'dbi://test'})

Modified: Zope3/branches/jim-adapter/src/zope/app/sqlscript/DEPENDENCIES.cfg
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/sqlscript/DEPENDENCIES.cfg	2006-04-12 13:43:19 UTC (rev 66888)
+++ Zope3/branches/jim-adapter/src/zope/app/sqlscript/DEPENDENCIES.cfg	2006-04-12 13:44:42 UTC (rev 66889)
@@ -3,7 +3,7 @@
 zope.documenttemplate
 zope.interface
 zope.schema
+zope.rdb
 zope.app
 zope.app.cache
 zope.app.file
-zope.app.rdb

Modified: Zope3/branches/jim-adapter/src/zope/app/sqlscript/browser/sqlscript.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/sqlscript/browser/sqlscript.py	2006-04-12 13:43:19 UTC (rev 66888)
+++ Zope3/branches/jim-adapter/src/zope/app/sqlscript/browser/sqlscript.py	2006-04-12 13:44:42 UTC (rev 66889)
@@ -15,13 +15,11 @@
 
 $Id$
 """
+from zope.rdb.interfaces import DatabaseException
+from zope.traversing.browser import absoluteURL
 from zope.app.form.browser.submit import Update
-from zope.app.rdb.interfaces import DatabaseException
-from zope.app import zapi
-
 from zope.app.sqlscript.interfaces import ISQLScript
 
-
 class SQLScriptTest(object):
     """Test the SQL inside the SQL Script
     """
@@ -125,7 +123,7 @@
             name = self.context.contentName
             container = self.context.context
             obj = container[name]
-            url = zapi.absoluteURL(obj, self.request)
+            url = absoluteURL(obj, self.request)
             url = '%s/test.html' % url
             return url
         else:

Modified: Zope3/branches/jim-adapter/src/zope/app/sqlscript/interfaces.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/sqlscript/interfaces.py	2006-04-12 13:43:19 UTC (rev 66888)
+++ Zope3/branches/jim-adapter/src/zope/app/sqlscript/interfaces.py	2006-04-12 13:44:42 UTC (rev 66889)
@@ -16,9 +16,9 @@
 $Id$
 """
 import zope.schema
-from zope.app import zapi
-from zope.app.rdb.interfaces import ISQLCommand
-from zope.app.i18n import ZopeMessageFactory as _
+from zope.rdb.interfaces import ISQLCommand
+from zope.i18nmessageid import MessageFactory
+_ = MessageFactory('zope')
 
 class MissingInput(Exception):
     pass

Modified: Zope3/branches/jim-adapter/src/zope/app/sqlscript/sqlscript.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/sqlscript/sqlscript.py	2006-04-12 13:43:19 UTC (rev 66888)
+++ Zope3/branches/jim-adapter/src/zope/app/sqlscript/sqlscript.py	2006-04-12 13:44:42 UTC (rev 66889)
@@ -25,15 +25,15 @@
 from zope.interface import implements, classProvides
 from zope.interface.common.mapping import IEnumerableMapping
 from zope.schema.interfaces import IVocabularyFactory
+from zope.rdb import queryForResults
+from zope.rdb.interfaces import IZopeDatabaseAdapter
 
-from zope.app.rdb import queryForResults
 from zope.app.container.contained import Contained
 from zope.app.component.vocabulary import UtilityVocabulary
 from zope.app.cache.caching import getCacheForObject, getLocationForCache
-from zope.app.rdb.interfaces import IZopeDatabaseAdapter
 
-from interfaces import ISQLScript
-from dtml import SQLDTML
+from zope.app.sqlscript.interfaces import ISQLScript
+from zope.app.sqlscript.dtml import SQLDTML
 
 
 unparmre = re.compile(r'([\000- ]*([^\000- ="]+))')
@@ -109,7 +109,7 @@
         return connection()
 
     def __call__(self, **kw):
-        """See zope.app.rdb.interfaces"""
+        """See zope.rdb.interfaces"""
 
         # Try to resolve arguments
         arg_values = {}

Modified: Zope3/branches/jim-adapter/src/zope/app/sqlscript/tests/test_sqlscript.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/sqlscript/tests/test_sqlscript.py	2006-04-12 13:43:19 UTC (rev 66888)
+++ Zope3/branches/jim-adapter/src/zope/app/sqlscript/tests/test_sqlscript.py	2006-04-12 13:44:42 UTC (rev 66889)
@@ -20,11 +20,11 @@
 from zope.annotation.interfaces import IAnnotatable, IAnnotations
 from zope.annotation.interfaces import IAttributeAnnotatable
 from zope.annotation.attribute import AttributeAnnotations
+from zope.rdb.interfaces import IZopeDatabaseAdapter
+from zope.rdb.interfaces import IZopeConnection, IZopeCursor
 
 from zope.app.testing import ztapi
-from zope.app.rdb.interfaces import IZopeDatabaseAdapter
-from zope.app.rdb.interfaces import IZopeConnection, IZopeCursor
-from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.component.testing import PlacelessSetup
 from zope.app.cache.interfaces import ICacheable, ICache
 from zope.app.cache.annotationcacheable import AnnotationCacheable
 from zope.app.cache.caching import getCacheForObject



More information about the Zope3-Checkins mailing list