[Zope3-checkins] CVS: Zope3/src/zope/app/browser/content - configure.zcml:1.26 sql.py:1.9 sqltest.pt:1.3

Stephan Richter srichter@cosmos.phy.tufts.edu
Wed, 11 Jun 2003 09:48:28 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/content
In directory cvs.zope.org:/tmp/cvs-serv23479/browser/content

Modified Files:
	configure.zcml sql.py sqltest.pt 
Log Message:
Fixed SQLScript:

- Removed doubled 'Cache' menu entry.

- I had to context-wrap connectionName (using ContextProperty), since
  ContextMethod(setConnectionName) did not work anymore.

- Caching also did not work correctly; in the __call__() method of SQLScript
  it used a lit '[]' as the marker for the default return object; for some
  reason this did not work. When I replaced the list with object(),
  everything worked just fine.

- Removed many bare excepts and therefore XXX comments

- Cleaned up the ISQLScript interface to remove old cruft from the time I did
  not feel comfortable with properties

- Fixed bug where it would not allow you to edit an SQL script unless a 'SQL
  Connections Service' was registered. 

- In the 'rdb' package, if we experience an exception during connect, we want
  to convert this exception to a DatabaseException, so that the higher-level
  machinery can catch it. Note that I had to leave the exception blank, since
  DBI implementations have their own Exception hierarchy.


=== Zope3/src/zope/app/browser/content/configure.zcml 1.25 => 1.26 ===
--- Zope3/src/zope/app/browser/content/configure.zcml:1.25	Sun Jun  8 12:39:45 2003
+++ Zope3/src/zope/app/browser/content/configure.zcml	Wed Jun 11 09:47:57 2003
@@ -324,13 +324,6 @@
       />
 
   <browser:menuItem
-      menu="zmi_views"
-      for="zope.app.interfaces.content.sql.ISQLScript"
-      title="Cache"
-      action="Caching.html"
-      />
-
-  <browser:menuItem
       menu="add_content"
       for="zope.app.interfaces.container.IAdding"
       title="SQLScript"


=== Zope3/src/zope/app/browser/content/sql.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/browser/content/sql.py:1.8	Sat Jun  7 02:37:19 2003
+++ Zope3/src/zope/app/browser/content/sql.py	Wed Jun 11 09:47:57 2003
@@ -14,7 +14,6 @@
 """
 $Id$
 """
-from zope.interface import implements
 from zope.publisher.browser import BrowserView
 from zope.app.interfaces.content.sql import ISQLScript
 from zope.app.interfaces.rdb import DatabaseException
@@ -23,18 +22,6 @@
 class SQLScriptTest(BrowserView):
     """Edit View for SQL Scripts"""
 
-    # XXX: if the following line is uncommented, @@test.html stops working
-    # __implements__ = BrowserView.__implements__
-    #
-    # Just found the reason: if you specify __implements__ here, it overrides
-    # the one defined in zope.app.pagetemplate.simpeviewclass.simple,
-    # and IBrowserPublisher disappears from the interface list.  Instead,
-    # __implements__ of the newly created class (see SimpleViewClass in the
-    # same module) ought to be a union of __implements__ of all the base
-    # classes.  Or perhaps it should be done by zope.app.browser.form.editview?
-    #
-    # XXX: is this still true now that we have the new interfaces package?
-
     __used_for__ = ISQLScript
 
     error = None
@@ -42,20 +29,19 @@
     def getArguments(self):
         form = self.request.form
         arguments = {}
-        # XXX does anyone know what arg[0] and arg[1] are supposed to be?
-        for arg in self.context.getArguments().items():
-            value = form.get(arg[0])
+
+        for argname, argvalue in self.context.getArguments().items():
+            value = form.get(argname)
             if value is None:
-                value = arg[1].get('default')
+                value = argvalue.get('default')
             if value is not None:
-                arguments[arg[0].encode('UTF-8')] = value
+                arguments[argname.encode('UTF-8')] = value
         return arguments
 
     def getTestResults(self):
-        self.context.getConnection()
         try:
             return self.context(**self.getArguments())
-        except (DatabaseException, AttributeError), error:
+        except (DatabaseException, AttributeError, Exception), error:
             self.error = error
             return []
 


=== Zope3/src/zope/app/browser/content/sqltest.pt 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/content/sqltest.pt:1.2	Wed Dec 25 09:12:30 2002
+++ Zope3/src/zope/app/browser/content/sqltest.pt	Wed Jun 11 09:47:57 2003
@@ -7,7 +7,7 @@
   <div metal:fill-slot="body">
   <form action="." method="post">
 
-    <pre tal:content="context/getSource" />
+    <pre tal:content="context/source" />
 
     <table border="1"
         tal:define="args context/getArguments"