[FIX] flake8 fixes

This commit is contained in:
Carlos Almeida 2015-10-17 01:53:55 -03:00
parent 109ce4c35b
commit 54520fb4f6
5 changed files with 25 additions and 22 deletions

View File

@ -48,4 +48,3 @@
'images/3_document_ftp.jpeg'],
'post_load': 'post_load',
}

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
@ -17,7 +17,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -26,18 +26,19 @@ import logging
import document_ftp.ftpserver.Authorizer
import document_ftp.ftpserver.AbstractedFs
import document_ftp.ftpserver.ftpserver
import document_ftp.ftpserver.FtpServer
import openerp
from openerp.tools import config
_logger = logging.getLogger(__name__)
import socket
def start_server():
if openerp.multi_process:
_logger.info("FTP disabled in multiprocess mode")
return
ip_address = ([(s.connect(('8.8.8.8', 80)), s.getsockname()[0], s.close()) \
ip_address = ([(s.connect(('8.8.8.8', 80)), s.getsockname()[0], s.close())
for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1])
if not ip_address:
ip_address = '127.0.0.1'
@ -49,21 +50,21 @@ def start_server():
PASSIVE_PORTS = int(pps[0]), int(pps[1])
class FtpServer(threading.Thread):
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.AbstractedFs
autho = Authorizer.Authorizer()
FtpServer.FTPHandler.Authorizer = autho
FtpServer.max_cons = 300
FtpServer.max_cons_per_ip = 50
FtpServer.FTPHandler.AbstractedFs = AbstractedFs.AbstractedFs
if PASSIVE_PORTS:
ftpserver.FTPHandler.passive_ports = PASSIVE_PORTS
FtpServer.FTPHandler.passive_ports = PASSIVE_PORTS
ftpserver.log = lambda msg: _logger.info(msg)
ftpserver.logline = lambda msg: None
ftpserver.logerror = lambda msg: _logger.error(msg)
FtpServer.log = lambda msg: _logger.info(msg)
FtpServer.logline = lambda msg: None
FtpServer.logerror = lambda msg: _logger.error(msg)
ftpd = ftpserver.FTPServer((HOST, PORT), ftpserver.FTPHandler)
ftpd = FtpServer.FTPServer((HOST, PORT), FtpServer.FTPHandler)
ftpd.serve_forever()
if HOST.lower() == 'none':
@ -72,4 +73,4 @@ def start_server():
_logger.info("\n Serving FTP on %s:%s\n" % (HOST, PORT))
ds = FtpServer()
ds.daemon = True
ds.start()
ds.start()

View File

@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-
import pooler
import security
class Authorizer:
read_perms = "elr"
write_perms = "adfmw"
@ -67,4 +71,3 @@ class Authorizer:
def get_msg_quit(self, username):
"""Return the user's quitting message."""
return 'Bye.'

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
@ -17,10 +17,9 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import ftp_browse
from . import ftp_configuration
from . import ftp_configuration

View File

@ -25,6 +25,7 @@ from openerp.osv.orm import fields
from openerp.osv.orm import TransientModel
from .. import ftpserver
class DocumentFtpBrowse(TransientModel):
_name = 'document.ftp.browse'
_description = 'Document FTP Browse'