[Zope-CVS] CVS: Products/Ape/lib/apelib/fs - base.py:1.4.4.1 classification.py:1.2.4.2 connection.py:1.3.4.2 structure.py:1.3.2.2

Shane Hathaway shane@zope.com
Thu, 24 Jul 2003 08:16:08 -0400


Update of /cvs-repository/Products/Ape/lib/apelib/fs
In directory cvs.zope.org:/tmp/cvs-serv8851/lib/apelib/fs

Modified Files:
      Tag: ape-scan-branch
	base.py classification.py connection.py structure.py 
Log Message:
Modified strategy that asks gateways for sources directly.


=== Products/Ape/lib/apelib/fs/base.py 1.4 => 1.4.4.1 ===
--- Products/Ape/lib/apelib/fs/base.py:1.4	Mon May 19 15:32:34 2003
+++ Products/Ape/lib/apelib/fs/base.py	Thu Jul 24 08:15:33 2003
@@ -33,3 +33,5 @@
     def getConnection(self, event):
         return event.getConnection(self.conn_name)
 
+    def getSources(self, event):
+        return None


=== Products/Ape/lib/apelib/fs/classification.py 1.2.4.1 => 1.2.4.2 ===
--- Products/Ape/lib/apelib/fs/classification.py:1.2.4.1	Wed Jul 23 00:12:45 2003
+++ Products/Ape/lib/apelib/fs/classification.py	Thu Jul 24 08:15:33 2003
@@ -58,4 +58,3 @@
         text = '\n'.join(text)
         fs_conn.writeSection(p, 'classification', text)
         return text.strip()
-


=== Products/Ape/lib/apelib/fs/connection.py 1.3.4.1 => 1.3.4.2 ===
--- Products/Ape/lib/apelib/fs/connection.py:1.3.4.1	Wed Jul 23 00:12:45 2003
+++ Products/Ape/lib/apelib/fs/connection.py	Thu Jul 24 08:15:33 2003
@@ -565,27 +565,34 @@
         self.reset()
 
 
+    def _get_paths_mtime(self, paths):
+        t = []
+        for path in paths:
+            try:
+                t.append(self.ops.getmtime(path))
+            except OSError:
+                t.append(None)
+        return t
+
+
     def getSources(self, subpath):
-        path = self._expandPath(subpath)
-        props, remainder = self._getPropertyPaths(path)
-        return [(self, (path, props, remainder))]
+        p = self._expandPath(subpath)
+        props, remainder = self._getPropertyPaths(p)
+        paths = (p, props, remainder)
+        t = self._get_paths_mtime(paths)
+        return {(self, paths): t}
 
 
-    def freshen(self, d):
+    def freshen(self, sources):
         """ISourceRepository implementation.
 
         Returns the changed items.
         """
         res = {}
-        for source, t in d.items():
+        for source, t in sources.items():
             myself, paths = source
             assert myself is self
-            new_t = []
-            for path in paths:
-                try:
-                    new_t.append(self.ops.getmtime(path))
-                except OSError:
-                    new_t.append(None)
+            new_t = self._get_paths_mtime(paths)
             if t != new_t:
                 res[source] = new_t
         return res


=== Products/Ape/lib/apelib/fs/structure.py 1.3.2.1 => 1.3.2.2 ===
--- Products/Ape/lib/apelib/fs/structure.py:1.3.2.1	Wed Jul 23 00:12:45 2003
+++ Products/Ape/lib/apelib/fs/structure.py	Thu Jul 24 08:15:33 2003
@@ -74,16 +74,18 @@
 
     def load(self, event):
         id = self.getIdFrom(event)
-        event.addSources(self.getConnection(event).getSources(event.getKey()))
         return id, id
 
     def store(self, event, state):
         id = self.getIdFrom(event)
         if state != id:
             raise ValueError('Mismatched file ID')
-        event.addSources(self.getConnection(event).getSources(event.getKey()))
         return id
 
+    def getSources(self, event):
+        fs_conn = self.getConnection(event)
+        return fs_conn.getSources(event.getKey())
+        
 
 
 class FSDirectoryItems (FSGatewayBase):