[Zope3-checkins] CVS: Zope3/src/zope/app/ftp - __init__.py:1.8

Jim Fulton jim at zope.com
Sat Mar 6 12:49:23 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/ftp
In directory cvs.zope.org:/tmp/cvs-serv21993/src/zope/app/ftp

Modified Files:
	__init__.py 
Log Message:
Changed most calls to queryAdapter to use interface calls instead.


=== Zope3/src/zope/app/ftp/__init__.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/ftp/__init__.py:1.7	Sat Mar  6 11:50:24 2004
+++ Zope3/src/zope/app/ftp/__init__.py	Sat Mar  6 12:48:50 2004
@@ -18,7 +18,7 @@
 """
 __metaclass__ = type
 
-from zope.component import queryAdapter, queryNamedAdapter
+from zope.component import queryNamedAdapter
 from zope.proxy import removeAllProxies
 
 from zope.app.interfaces.file import IReadFile, IWriteFile
@@ -41,7 +41,7 @@
         return self._dir[name]
 
     def _type(self, file):
-        if queryAdapter(file, IReadDirectory) is not None:
+        if IReadDirectory(file, None) is not None:
             return 'd'
         else:
             return 'f'
@@ -73,17 +73,17 @@
                 'mtime': self._mtime(file),
                 }
 
-        f = queryAdapter(file, IReadDirectory)
+        f = IReadDirectory(file, None)
         if f is not None:
             # It's a directory
             info['type'] = 'd'
             info['group_readable'] = hasattr(f, 'get')
-            f = queryAdapter(file, IWriteDirectory)
+            f = IWriteDirectory(file, None)
             info['group_writable'] = hasattr(f, '__setitem__')
         else:
             # It's a file
             info['type'] = 'f'
-            f = queryAdapter(file, IReadFile)
+            f = IReadFile(file, None)
             if f is not None:
                 size = getattr(f, 'size', self)
                 if size is not self:
@@ -93,7 +93,7 @@
             else:
                 info['group_readable'] = False
 
-            f = queryAdapter(file, IWriteFile)
+            f = IWriteFile(file, None)
             info['group_writable'] = hasattr(f, 'write')
 
         return info
@@ -125,7 +125,7 @@
         return self._mtime(self)
 
     def _size(self, file):
-        file = queryAdapter(file, IReadFile)
+        file = IReadFile(file, None)
         if file is not None:
             return file.size()
         return 0
@@ -136,30 +136,30 @@
         return 0
 
     def mkdir(self, name):
-        dir = queryAdapter(self.context, IWriteDirectory)
+        dir = IWriteDirectory(self.context, None)
         factory = IDirectoryFactory(self.context)
         newdir = factory(name)
         publish(self.context, ObjectCreatedEvent(newdir))
         dir[name] = newdir
 
     def remove(self, name):
-        dir = queryAdapter(self.context, IWriteDirectory)
+        dir = IWriteDirectory(self.context, None)
         del dir[name]
 
     def rmdir(self, name):
         self.remove(name)
 
     def rename(self, old, new):
-        dir = queryAdapter(self.context, IWriteDirectory)
+        dir = IWriteDirectory(self.context, None)
         rename(dir, old, new)
 
     def _overwrite(self, name, instream, start=None, end=None, append=False):
         file = self._dir[name]
         if append:
-            reader = removeAllProxies(queryAdapter(file, IReadFile))
+            reader = removeAllProxies(IReadFile(file, None))
             data = reader.read() + instream.read()
         elif start is not None or end is not None:
-            reader = removeAllProxies(queryAdapter(file, IReadFile))
+            reader = removeAllProxies(IReadFile(file, None))
             data = reader.read()
             if start is not None:
                 prefix = data[:start]
@@ -178,7 +178,7 @@
         else:
             data = instream.read()
 
-        f = queryAdapter(self._dir[name], IWriteFile)
+        f = IWriteFile(self._dir[name], None)
         f.write(data)
 
     def writefile(self, name, instream, start=None, end=None, append=False):
@@ -201,7 +201,7 @@
         else:
             ext = "."
 
-        dir = queryAdapter(self.context, IWriteDirectory)
+        dir = IWriteDirectory(self.context, None)
 
         factory = queryNamedAdapter(self.context, IFileFactory, ext)
         if factory is None:
@@ -213,9 +213,9 @@
 
     def writable(self, name):
         if name in self._dir:
-            f = queryAdapter(self._dir[name], IWriteFile)
+            f = IWriteFile(self._dir[name], None)
             return hasattr(f, 'write')
-        d = queryAdapter(self.context, IWriteDirectory)
+        d = IWriteDirectory(self.context, None)
         return hasattr(d, '__setitem__')
 
 




More information about the Zope3-Checkins mailing list