[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/SQLScript - SQLScript.py:1.10

Albertas Agejevas alga@codeworks.lt
Mon, 2 Dec 2002 15:04:19 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/SQLScript
In directory cvs.zope.org:/tmp/cvs-serv5490/lib/python/Zope/App/OFS/Content/SQLScript

Modified Files:
	SQLScript.py 
Log Message:
Added stats reporting to the RAMCache.
Had to make Zope.App.RDB.ResultSet pickleable on the way.
Renamed ResultSet.names to ResultSet.columns.
Updated SQLScript to pass the location to the cache, not self.


=== Zope3/lib/python/Zope/App/OFS/Content/SQLScript/SQLScript.py 1.9 => 1.10 ===
--- Zope3/lib/python/Zope/App/OFS/Content/SQLScript/SQLScript.py:1.9	Mon Nov 25 08:48:07 2002
+++ Zope3/lib/python/Zope/App/OFS/Content/SQLScript/SQLScript.py	Mon Dec  2 15:03:48 2002
@@ -19,18 +19,18 @@
 from Persistence import Persistent
 from Zope.ComponentArchitecture import getService
 from Zope.ContextWrapper import ContextMethod
+from Zope.Proxy.ProxyIntrospection import removeAllProxies
 
 from Zope.DocumentTemplate.DT_HTML import HTML
 from Zope.App.Traversing import getParent
 from Zope.App.RDB.SQLCommand import SQLCommand
 from Zope.App.RDB.Util import queryForResults
-
 from Zope.App.OFS.Content.IFileContent import IFileContent
 from Zope.App.OFS.Content.SQLScript.ISQLScript import ISQLScript
 from Zope.App.OFS.Content.SQLScript.Arguments import parseArguments
 from Zope.App.OFS.Annotation.IAttributeAnnotatable import IAttributeAnnotatable
 
-from Zope.App.Caching.Caching import getCacheForObj
+from Zope.App.Caching.Caching import getCacheForObj, getLocationForCache
 
 from DT_SQLVar import SQLVar
 from DT_SQLTest import SQLTest
@@ -94,8 +94,12 @@
         'See Zope.App.OFS.Content.SQLScript.ISQLScript.ISQLScript'
         self._connectionName = name
         cache = getCacheForObj(self)
-        if cache:
-            cache.invalidate(self)
+        location = getLocationForCache(self)
+
+        if cache and location:
+            cache.invalidate(location)
+
+    setConnectionName = ContextMethod(setConnectionName)
 
     def getConnectionName(self):
         'See Zope.App.OFS.Content.SQLScript.ISQLScript.ISQLScript'
@@ -146,14 +150,15 @@
 
         query = apply(self.template, (), arg_values)
         cache = getCacheForObj(self)
-        if cache:
+        location = getLocationForCache(self)
+        if cache and location:
             _marker = []
-            result = cache.query(self, {'query': query}, default=_marker)
+            result = cache.query(location, {'query': query}, default=_marker)
             if result is not _marker:
                 return result
         result = queryForResults(connection, query)
-        if cache:
-            cache.set(result, self, {'query': query})
+        if cache and location:
+            cache.set(result, location, {'query': query})
         return result
 
     __call__ = ContextMethod(__call__)