[Zope-CVS] CVS: Products/AdaptableStorage/gateway_fs - FSClassificationSection.py:1.10 FSConnection.py:1.14

Shane Hathaway shane@zope.com
Mon, 10 Feb 2003 21:30:44 -0500


Update of /cvs-repository/Products/AdaptableStorage/gateway_fs
In directory cvs.zope.org:/tmp/cvs-serv19336/gateway_fs

Modified Files:
	FSClassificationSection.py FSConnection.py 
Log Message:
- FSConnection provides a mechanism for stripping extensions in Zope,
but when this mechanism was employed, AdaptableStorage reverted to
loading the objects as simple files.  Now it sees the extension
and the objects are loaded using the preferred class.

- Added docstrings to IFSConnection.



=== Products/AdaptableStorage/gateway_fs/FSClassificationSection.py 1.9 => 1.10 ===
--- Products/AdaptableStorage/gateway_fs/FSClassificationSection.py:1.9	Tue Feb  4 23:59:16 2003
+++ Products/AdaptableStorage/gateway_fs/FSClassificationSection.py	Mon Feb 10 21:30:09 2003
@@ -33,14 +33,6 @@
     def getSchema(self):
         return self.schema
 
-    def getIdFrom(self, event):
-        path = event.getKeychain()[-1]
-        pos = path.rfind('/')
-        if pos >= 0:
-            return path[pos + 1:]
-        else:
-            return path
-
     def load(self, event):
         c = self.fs_conn
         p = event.getKeychain()[-1]
@@ -52,8 +44,7 @@
                 if '=' in line:
                     k, v = line.split('=', 1)
                     classification[k.strip()] = v.strip()
-        filename = self.getIdFrom(event)
-        classification['extension'] = os.path.splitext(filename)[1]
+        classification['extension'] = c.getExtension(p)
         return classification, text.strip()
 
     def store(self, event, state):


=== Products/AdaptableStorage/gateway_fs/FSConnection.py 1.13 => 1.14 ===
--- Products/AdaptableStorage/gateway_fs/FSConnection.py:1.13	Wed Feb  5 13:49:59 2003
+++ Products/AdaptableStorage/gateway_fs/FSConnection.py	Mon Feb 10 21:30:09 2003
@@ -221,6 +221,12 @@
                 f.close()
 
 
+    def getExtension(self, subpath):
+        path = self.expandPath(subpath)
+        stuff, ext = os.path.splitext(path)
+        return ext
+
+
     def getPropertiesPath(self, path):
         if os.path.isdir(path):
             props_fn = os.path.join(path, self.metadata_prefix +