diff options
Diffstat (limited to 'addons/document_ftp')
| -rw-r--r-- | addons/document_ftp/__init__.py | 2 | ||||
| -rw-r--r-- | addons/document_ftp/__openerp__.py | 5 | ||||
| -rw-r--r-- | addons/document_ftp/ftpserver/__init__.py | 61 | ||||
| -rw-r--r-- | addons/document_ftp/i18n/et.po | 135 | ||||
| -rw-r--r-- | addons/document_ftp/test/document_ftp_test2.yml | 7 | ||||
| -rw-r--r-- | addons/document_ftp/test/document_ftp_test4.yml | 3 |
6 files changed, 179 insertions, 34 deletions
diff --git a/addons/document_ftp/__init__.py b/addons/document_ftp/__init__.py index af514df8985..b86320f9909 100644 --- a/addons/document_ftp/__init__.py +++ b/addons/document_ftp/__init__.py @@ -21,4 +21,6 @@ import ftpserver import wizard +post_load = ftpserver.start_server + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/document_ftp/__openerp__.py b/addons/document_ftp/__openerp__.py index 2683ba5ef0a..499a928c077 100644 --- a/addons/document_ftp/__openerp__.py +++ b/addons/document_ftp/__openerp__.py @@ -21,9 +21,9 @@ { - 'name': 'Integrated FTP Server with Document Management System', + 'name': 'Shared Repositories (FTP)', 'version': '1.99', - 'category': 'Tools', + 'category': 'Knowledge Management', 'complexity': "normal", 'description': """ This is a support FTP Interface with document management system. @@ -51,6 +51,7 @@ FTP client. 'active': False, 'certificate': '00934787762705016005', 'images': ['images/1_configure_ftp.jpeg','images/2_document_browse.jpeg','images/3_document_ftp.jpeg'], + 'post_load': 'post_load', } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/document_ftp/ftpserver/__init__.py b/addons/document_ftp/ftpserver/__init__.py index d110267f175..2e09a938a05 100644 --- a/addons/document_ftp/ftpserver/__init__.py +++ b/addons/document_ftp/ftpserver/__init__.py @@ -26,41 +26,42 @@ import abstracted_fs import netsvc from tools import config -HOST = config.get('ftp_server_host', '127.0.0.1') -PORT = int(config.get('ftp_server_port', '8021')) -PASSIVE_PORTS = None -pps = config.get('ftp_server_passive_ports', '').split(':') -if len(pps) == 2: - PASSIVE_PORTS = int(pps[0]), int(pps[1]) +def start_server(): + HOST = config.get('ftp_server_host', '127.0.0.1') + PORT = int(config.get('ftp_server_port', '8021')) + PASSIVE_PORTS = None + pps = config.get('ftp_server_passive_ports', '').split(':') + if len(pps) == 2: + PASSIVE_PORTS = int(pps[0]), int(pps[1]) -class ftp_server(threading.Thread): - def log(self, level, message): - logger = netsvc.Logger() - logger.notifyChannel('FTP', level, message) + class ftp_server(threading.Thread): + def log(self, level, message): + logger = netsvc.Logger() + logger.notifyChannel('FTP', level, message) - def run(self): - autho = authorizer.authorizer() - ftpserver.FTPHandler.authorizer = autho - ftpserver.max_cons = 300 - ftpserver.max_cons_per_ip = 50 - ftpserver.FTPHandler.abstracted_fs = abstracted_fs.abstracted_fs - if PASSIVE_PORTS: - ftpserver.FTPHandler.passive_ports = PASSIVE_PORTS + def run(self): + autho = authorizer.authorizer() + ftpserver.FTPHandler.authorizer = autho + ftpserver.max_cons = 300 + ftpserver.max_cons_per_ip = 50 + ftpserver.FTPHandler.abstracted_fs = abstracted_fs.abstracted_fs + if PASSIVE_PORTS: + ftpserver.FTPHandler.passive_ports = PASSIVE_PORTS - ftpserver.log = lambda msg: self.log(netsvc.LOG_INFO, msg) - ftpserver.logline = lambda msg: None - ftpserver.logerror = lambda msg: self.log(netsvc.LOG_ERROR, msg) + ftpserver.log = lambda msg: self.log(netsvc.LOG_INFO, msg) + ftpserver.logline = lambda msg: None + ftpserver.logerror = lambda msg: self.log(netsvc.LOG_ERROR, msg) - ftpd = ftpserver.FTPServer((HOST, PORT), ftpserver.FTPHandler) - ftpd.serve_forever() + ftpd = ftpserver.FTPServer((HOST, PORT), ftpserver.FTPHandler) + ftpd.serve_forever() -if HOST.lower() == 'none': - netsvc.Logger().notifyChannel("FTP", netsvc.LOG_INFO, "\n Server FTP Not Started\n") -else: - netsvc.Logger().notifyChannel("FTP", netsvc.LOG_INFO, "\n Serving FTP on %s:%s\n" % (HOST, PORT)) - ds = ftp_server() - ds.daemon = True - ds.start() + if HOST.lower() == 'none': + netsvc.Logger().notifyChannel("FTP", netsvc.LOG_INFO, "\n Server FTP Not Started\n") + else: + netsvc.Logger().notifyChannel("FTP", netsvc.LOG_INFO, "\n Serving FTP on %s:%s\n" % (HOST, PORT)) + ds = ftp_server() + ds.daemon = True + ds.start() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/document_ftp/i18n/et.po b/addons/document_ftp/i18n/et.po new file mode 100644 index 00000000000..67b38b6bf0a --- /dev/null +++ b/addons/document_ftp/i18n/et.po @@ -0,0 +1,135 @@ +# Estonian translation for openobject-addons +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2011-01-11 11:15+0000\n" +"PO-Revision-Date: 2011-10-11 18:05+0000\n" +"Last-Translator: Aare Vesi <Unknown>\n" +"Language-Team: Estonian <et@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2011-10-12 04:40+0000\n" +"X-Generator: Launchpad (build 14124)\n" + +#. module: document_ftp +#: model:ir.model,name:document_ftp.model_document_ftp_configuration +msgid "Auto Directory Configuration" +msgstr "" + +#. module: document_ftp +#: view:document.ftp.configuration:0 +msgid "" +"Indicate the network address on which your OpenERP server should be " +"reachable for end-users. This depends on your network topology and " +"configuration, and will only affect the links displayed to the users. The " +"format is HOST:PORT and the default host (localhost) is only suitable for " +"access from the server machine itself.." +msgstr "" + +#. module: document_ftp +#: field:document.ftp.configuration,progress:0 +msgid "Configuration Progress" +msgstr "" + +#. module: document_ftp +#: model:ir.actions.url,name:document_ftp.action_document_browse +msgid "Browse Files" +msgstr "Failide sirvimine" + +#. module: document_ftp +#: field:document.ftp.configuration,config_logo:0 +msgid "Image" +msgstr "Pilt" + +#. module: document_ftp +#: field:document.ftp.configuration,host:0 +msgid "Address" +msgstr "Aadress" + +#. module: document_ftp +#: field:document.ftp.browse,url:0 +msgid "FTP Server" +msgstr "FTP server" + +#. module: document_ftp +#: model:ir.actions.act_window,name:document_ftp.action_config_auto_directory +msgid "FTP Server Configuration" +msgstr "FTP serveri konfiguratsioon" + +#. module: document_ftp +#: model:ir.module.module,description:document_ftp.module_meta_information +msgid "" +"This is a support FTP Interface with document management system.\n" +" With this module you would not only be able to access documents through " +"OpenERP\n" +" but you would also be able to connect with them through the file system " +"using the\n" +" FTP client.\n" +msgstr "" + +#. module: document_ftp +#: view:document.ftp.browse:0 +msgid "_Browse" +msgstr "_Sirvi" + +#. module: document_ftp +#: help:document.ftp.configuration,host:0 +msgid "" +"Server address or IP and port to which users should connect to for DMS access" +msgstr "" + +#. module: document_ftp +#: model:ir.ui.menu,name:document_ftp.menu_document_browse +msgid "Shared Repository (FTP)" +msgstr "" + +#. module: document_ftp +#: view:document.ftp.browse:0 +msgid "_Cancel" +msgstr "_Tühista" + +#. module: document_ftp +#: view:document.ftp.configuration:0 +msgid "Configure FTP Server" +msgstr "" + +#. module: document_ftp +#: model:ir.module.module,shortdesc:document_ftp.module_meta_information +msgid "Integrated FTP Server with Document Management System" +msgstr "" + +#. module: document_ftp +#: view:document.ftp.configuration:0 +msgid "title" +msgstr "pealkiri" + +#. module: document_ftp +#: model:ir.model,name:document_ftp.model_document_ftp_browse +msgid "Document FTP Browse" +msgstr "" + +#. module: document_ftp +#: view:document.ftp.configuration:0 +msgid "Knowledge Application Configuration" +msgstr "" + +#. module: document_ftp +#: model:ir.actions.act_window,name:document_ftp.action_ftp_browse +msgid "Document Browse" +msgstr "" + +#. module: document_ftp +#: view:document.ftp.browse:0 +msgid "Browse Document" +msgstr "" + +#. module: document_ftp +#: view:document.ftp.configuration:0 +msgid "res_config_contents" +msgstr "" diff --git a/addons/document_ftp/test/document_ftp_test2.yml b/addons/document_ftp/test/document_ftp_test2.yml index 872456e7191..33ce1416ec8 100644 --- a/addons/document_ftp/test/document_ftp_test2.yml +++ b/addons/document_ftp/test/document_ftp_test2.yml @@ -100,12 +100,13 @@ fdata = StringIO('abcd') ftp.storbinary('STOR test2.txt', fdata) ftp.close() + cr.commit() - I look for the "test2.txt" file at the server - !python {model: ir.attachment }: | ids = self.search(cr, uid, [('name', '=', 'test2.txt')]) - assert ids + assert ids, "No test2.txt file found." - I delete the "test2.txt" file using FTP. - @@ -115,12 +116,13 @@ ftp = te.get_ftp_folder(cr, uid, self, 'Documents') ftp.delete('test2.txt') ftp.close() + cr.commit() - I check at the server that test2.txt is deleted - !python {model: ir.attachment }: | ids = self.search(cr, uid, [('name', '=', 'test2.txt')]) - assert not ids + assert not ids, "test2.txt file can still be found." - I create a test2.txt file again. - @@ -131,6 +133,7 @@ fdata = StringIO('abcd') ftp.storbinary('STOR test2.txt', fdata) ftp.close() + cr.commit() - I delete the test2.txt from the server (RPC). - diff --git a/addons/document_ftp/test/document_ftp_test4.yml b/addons/document_ftp/test/document_ftp_test4.yml index f05fac397bf..0a3ff33333e 100644 --- a/addons/document_ftp/test/document_ftp_test4.yml +++ b/addons/document_ftp/test/document_ftp_test4.yml @@ -4,6 +4,7 @@ !python {model: ir.attachment}: | from document_ftp import test_easyftp as te ftp = te.get_plain_ftp(timeout=1.0) + cr.commit() - | I create two partners 'Partner1' and 'Partner2'. I create three partner categories: 'none', 'pat1' and 'all' @@ -53,6 +54,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.commit() - I create a 'partners' folder by the first resource one. - @@ -79,6 +81,7 @@ for dir in correct: res = ftp.nlst(dir+'/Partners of Test') assert res == correct[dir], "Dir %s falsely contains %s" %(dir, res) + cr.commit() - I create an ir.attachment, attached (not related) to Partner1 - |
