Rev 65: Test suite passing for python-2.5 and 2.6. in file:///net/bigmamac/Volumes/home/vila/.bazaar/plugins/local_test_server/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Feb 26 17:06:59 GMT 2009


At file:///net/bigmamac/Volumes/home/vila/.bazaar/plugins/local_test_server/

------------------------------------------------------------
revno: 65
revision-id: v.ladeuil+lp at free.fr-20090226170658-87ii1u5lomlgt6su
parent: v.ladeuil+lp at free.fr-20090226153522-q3exf8trxd5xzrsp
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: local_test_server
timestamp: Thu 2009-02-26 18:06:58 +0100
message:
  Test suite passing for python-2.5 and 2.6.
  
  * bin/pyftpdlib:
  (BZRConformingFTPHandler): Tweak the server to comply with bzr
  idiosyncrasies.
-------------- next part --------------
=== modified file 'bin/pyftpdlib'
--- a/bin/pyftpdlib	2009-02-26 15:09:32 +0000
+++ b/bin/pyftpdlib	2009-02-26 17:06:58 +0000
@@ -3,6 +3,31 @@
 import sys
 from pyftpdlib import ftpserver
 
+class BZRConformingFTPHandler(ftpserver.FTPHandler):
+
+    def ftp_SIZE(self, path):
+        # bzr is overly picky here, but we want to make the test suite pass
+        # first. This may need to be revisited -- vila 20090226
+        line = self.fs.fs2ftp(path)
+        if self.fs.isdir(self.fs.realpath(path)):
+            why = "%s is a directory" % line
+            self.log('FAIL SIZE "%s". %s.' % (line, why))
+            self.respond("550 %s."  %why)
+        else:
+            ftpserver.FTPHandler.ftp_SIZE(self, path)
+
+    def ftp_NLST(self, path):
+        # bzr is overly picky here, but we want to make the test suite pass
+        # first. This may need to be revisited -- vila 20090226
+        line = self.fs.fs2ftp(path)
+        if self.fs.isfile(self.fs.realpath(path)):
+            why = "Not a directory: %s" % line
+            self.log('FAIL SIZE "%s". %s.' % (line, why))
+            self.respond("550 %s."  %why)
+        else:
+            ftpserver.FTPHandler.ftp_NLST(self, path)
+
+
 class AnonymousWithWriteAccessAuthorizer(ftpserver.DummyAuthorizer):
 
     def _check_permissions(self, username, perm):
@@ -18,7 +43,7 @@
     authorizer.add_user('anonymous', None, '/', perm='elradfmw')
     ftpserver.FTPHandler.authorizer = authorizer
     address = (conf['host'], conf['port'])
-    ftpd = ftpserver.FTPServer(address, ftpserver.FTPHandler)
+    ftpd = ftpserver.FTPServer(address, BZRConformingFTPHandler)
     log_file = open(conf['log_file'], 'w')
     def do_log(msg):
         log_file.write(msg + '\n')



More information about the bazaar-commits mailing list