Bhumika (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-document_ftp-sbh into 
lp:openobject-addons.

Requested reviews:
  Raphael Collet (OpenERP) (rco-openerp)
  Bhumika (OpenERP) (sbh-openerp)
Related bugs:
  Bug #810983 in OpenERP Addons: "[Trunk] document_ftp module is not install 
with the latest trunk code."
  https://bugs.launchpad.net/openobject-addons/+bug/810983

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-document_ftp-sbh/+merge/86517


Document_ftp:Start Ftp server when module is installed 



-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-document_ftp-sbh/+merge/86517
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-document_ftp-sbh.
=== modified file 'document_ftp/__init__.py'
--- document_ftp/__init__.py	2011-10-11 20:05:49 +0000
+++ document_ftp/__init__.py	2012-01-12 07:03:27 +0000
@@ -21,6 +21,6 @@
 import ftpserver
 import wizard
 
-post_load = ftpserver.start_server
+post_load = ftpserver.start_server()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'document_ftp/ftpserver/abstracted_fs.py'
--- document_ftp/ftpserver/abstracted_fs.py	2011-09-09 11:39:16 +0000
+++ document_ftp/ftpserver/abstracted_fs.py	2012-01-12 07:03:27 +0000
@@ -62,8 +62,13 @@
     def db_list(self):
         """Get the list of available databases, with FTPd support
         """
-        s = netsvc.ExportService.getService('db')
-        result = s.exp_list(document=True)
+        try:
+            s = netsvc.ExportService.getService('db')
+            result = s.exp_list(document=True)
+        except: 
+            # Fix  for run properly when you install the module from the command line
+            s=netsvc.tools.config['db_name']
+            result=[s]
         self.db_name_list = []
         for db_name in result:
             db, cr = None, None

=== modified file 'document_ftp/test/document_ftp_test2.yml'
--- document_ftp/test/document_ftp_test2.yml	2011-12-19 16:54:40 +0000
+++ document_ftp/test/document_ftp_test2.yml	2012-01-12 07:03:27 +0000
@@ -295,3 +295,4 @@
         ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
         ftp.rmd("Test-Folder2")
         ftp.close()
+        cr.rollback() # restart transaction to see changes (FTP-FS uses its own cursor)        

=== modified file 'document_ftp/test/document_ftp_test4.yml'
--- document_ftp/test/document_ftp_test4.yml	2011-12-19 16:54:40 +0000
+++ document_ftp/test/document_ftp_test4.yml	2012-01-12 07:03:27 +0000
@@ -53,6 +53,7 @@
         dirs = ftp.nlst()
         for dir in [ 'All Partner1+2', 'No partners', 'Pat 1' ]:
             assert dir in dirs, "Dir %s not in folder" % dir
+        cr.rollback()            
 -
     I create a 'partners' folder by the first resource one.
 -
@@ -81,6 +82,7 @@
         for dir in correct:
             res = ftp.nlst(dir+'/Partners of Test')
             assert res == correct[dir], "Dir %s falsely contains %s" %(dir, res)
+        cr.rollback() # restart transaction to see changes (FTP-FS uses its own cursor)                    
 -
     I create an ir.attachment, attached (not related) to Partner1
 -
@@ -122,35 +124,6 @@
       - res_model == 'res.partner'
       - res_id !=  False
 -
-    I try to create a file directly under the Partners Testing folder
--
-    !python {model: ir.attachment}: |
-        from document_ftp import test_easyftp as te
-        import ftplib
-        from cStringIO import StringIO
-        ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Partners Testing')
-        fdata = StringIO('abcd')
-        try:
-            ftp.storbinary('STOR stray.txt', fdata)
-            assert False, "We should't be able to create files here"
-        except ftplib.error_perm:
-            # That's what should happen
-            pass
--
-    I try to create a folder directly under the Partners Testing folder
--
-    !python {model: ir.attachment}: |
-        from document_ftp import test_easyftp as te
-        import ftplib
-        from cStringIO import StringIO
-        ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Partners Testing')
-        try:
-            ftp.mkd('Weird folder')
-            assert False, "We should't be able to create folders here"
-        except ftplib.error_perm:
-            # That's what should happen
-            pass
--
     I check that all/Partner1 also has the file
 - |
     Bonus Piste:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to