From 7499ef6b0f175290322a13f5196149bfa0fc471e Mon Sep 17 00:00:00 2001 From: Andrea Date: Wed, 22 May 2019 09:16:14 +0200 Subject: [PATCH] Add readme fragments + code review --- base_directory_file_download/__manifest__.py | 4 ++-- .../models/ir_filesystem_directory.py | 6 +++--- base_directory_file_download/models/ir_filesystem_file.py | 4 ++-- base_directory_file_download/readme/CONFIGURE.rst | 3 +++ base_directory_file_download/readme/CONTRIBUTORS.rst | 1 + base_directory_file_download/readme/DESCRIPTION.rst | 8 ++++++++ base_directory_file_download/readme/USAGE.rst | 7 +++++++ .../tests/test_directory_files_download.py | 2 +- .../views/ir_filesystem_directory.xml | 2 +- 9 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 base_directory_file_download/readme/CONFIGURE.rst create mode 100644 base_directory_file_download/readme/CONTRIBUTORS.rst create mode 100644 base_directory_file_download/readme/DESCRIPTION.rst create mode 100644 base_directory_file_download/readme/USAGE.rst diff --git a/base_directory_file_download/__manifest__.py b/base_directory_file_download/__manifest__.py index 03679b426..52bd1f347 100644 --- a/base_directory_file_download/__manifest__.py +++ b/base_directory_file_download/__manifest__.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# Copyright 2017-2018 Onestein () +# Copyright 2017-2018 Onestein () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { 'name': 'Directory Files Download', 'summary': 'Download all files of a directory on server', 'author': 'Onestein, Odoo Community Association (OCA)', - 'website': 'http://www.onestein.eu', + 'website': 'https://github.com/OCA/server-tools', 'category': 'Tools', 'version': '10.0.1.0.0', 'license': 'AGPL-3', diff --git a/base_directory_file_download/models/ir_filesystem_directory.py b/base_directory_file_download/models/ir_filesystem_directory.py index 908e8a0cd..ddd615a67 100644 --- a/base_directory_file_download/models/ir_filesystem_directory.py +++ b/base_directory_file_download/models/ir_filesystem_directory.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2017-2018 Onestein () +# Copyright 2017-2018 Onestein () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging @@ -21,11 +21,11 @@ class IrFilesystemDirectory(models.Model): file_ids = fields.One2many( 'ir.filesystem.file', compute='_compute_file_ids', - string='Files' + string='Files', ) file_count = fields.Integer( compute='_compute_file_count', - string="# Files" + string="# Files", ) @api.multi diff --git a/base_directory_file_download/models/ir_filesystem_file.py b/base_directory_file_download/models/ir_filesystem_file.py index 3c6d09d02..bd875e21a 100644 --- a/base_directory_file_download/models/ir_filesystem_file.py +++ b/base_directory_file_download/models/ir_filesystem_file.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2017-2018 Onestein () +# Copyright 2017-2018 Onestein () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging @@ -21,7 +21,7 @@ class IrFilesystemDirectoryLine(models.TransientModel): stored_filename = fields.Char() directory_id = fields.Many2one( 'ir.filesystem.directory', - string='Directory' + string='Directory', ) @api.multi diff --git a/base_directory_file_download/readme/CONFIGURE.rst b/base_directory_file_download/readme/CONFIGURE.rst new file mode 100644 index 000000000..80d5c0dcb --- /dev/null +++ b/base_directory_file_download/readme/CONFIGURE.rst @@ -0,0 +1,3 @@ +To configure this module, you need to: + +#. Set the group "Download files of directory" for the users who need this functionality. diff --git a/base_directory_file_download/readme/CONTRIBUTORS.rst b/base_directory_file_download/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..4518218c8 --- /dev/null +++ b/base_directory_file_download/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Andrea Stirpe diff --git a/base_directory_file_download/readme/DESCRIPTION.rst b/base_directory_file_download/readme/DESCRIPTION.rst new file mode 100644 index 000000000..f350f09ba --- /dev/null +++ b/base_directory_file_download/readme/DESCRIPTION.rst @@ -0,0 +1,8 @@ +View and download the files contained in a directory on the server. + +This functionality can have impacts on the security of your system, +since it allows to download the content of a directory. +Be careful when choosing the directory! + +Notice that, for security reasons, files like symbolic links +and up-level references are ignored. diff --git a/base_directory_file_download/readme/USAGE.rst b/base_directory_file_download/readme/USAGE.rst new file mode 100644 index 000000000..f15fdbc4c --- /dev/null +++ b/base_directory_file_download/readme/USAGE.rst @@ -0,0 +1,7 @@ +To use this module, you need to: + +#. Go to Settings -> Downloads -> Directory Content +#. Create a record specifying Name and Directory of the server +#. Save; a list of files contained in the selected directory is displayed +#. Download the file you need +#. In case the content of the directory is modified, refresh the list by clicking the button on the top-right of the form diff --git a/base_directory_file_download/tests/test_directory_files_download.py b/base_directory_file_download/tests/test_directory_files_download.py index 8d15867a3..7105c5a44 100644 --- a/base_directory_file_download/tests/test_directory_files_download.py +++ b/base_directory_file_download/tests/test_directory_files_download.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2017-2018 Onestein () +# Copyright 2017-2018 Onestein () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import os diff --git a/base_directory_file_download/views/ir_filesystem_directory.xml b/base_directory_file_download/views/ir_filesystem_directory.xml index b1b2d42ac..ae3990feb 100644 --- a/base_directory_file_download/views/ir_filesystem_directory.xml +++ b/base_directory_file_download/views/ir_filesystem_directory.xml @@ -49,7 +49,7 @@ ir.filesystem.directory - +