Fix flake8

This commit is contained in:
Valentin Chemiere 2015-03-18 12:28:55 +01:00
parent 5f9e5b1f44
commit 2c461fdffe
6 changed files with 19 additions and 20 deletions

View File

@ -6,6 +6,11 @@ from base64 import b64encode
class AbstractTask(object):
_name = None
_key = None
_synchronize_type = None
_default_port = None
def create_file(self, filename, data):
ir_attachment_id = self.env['ir.attachment.metadata'].create({
'name': filename,

View File

@ -50,7 +50,6 @@ class Task(models.Model):
return [('move', 'Move'), ('delete', 'Delete')]
def _get_method(self):
print 'get method'
res = []
for cls in itersubclasses(AbstractTask):
if cls._synchronize_type: # \

View File

@ -20,7 +20,6 @@
##############################################################################
from ..abstract_task import AbstractTask
from base64 import b64decode
import logging
import os
_logger = logging.getLogger(__name__)
@ -31,6 +30,7 @@ class AbstractFSTask(AbstractTask):
_name = None
_key = None
_synchronize_type = None
_default_port = None
def __init__(self, env, config):
self.env = env
@ -127,7 +127,8 @@ class AbstractFSTask(AbstractTask):
def _target_name(self, fs_conn, upload_directory, filename):
return os.path.join(upload_directory, filename)
def _upload_file(self, conn, host, port, user, pwd, path, filename, filedata):
def _upload_file(self, conn, host, port, user, pwd,
path, filename, filedata):
upload_directory = path or '.'
target_name = self._target_name(conn,
upload_directory,

View File

@ -21,11 +21,8 @@
from .abstract_fs import AbstractFSTask
from base64 import b64decode
import fs
from fs.osfs import OSFS
from ftputil.error import FTPIOError
import logging
import os
_logger = logging.getLogger(__name__)
@ -70,7 +67,7 @@ class FileStoreExportTask(FileStoreTask):
for attachment in self.attachment_ids:
if attachment.state in ('pending', 'failed'):
self.attachment_id = attachment
with OSFS(host) as fs_conn:
with OSFS(self.host) as fs_conn:
self._upload_file(fs_conn,
self.host,
self.port,

View File

@ -23,7 +23,6 @@ from .abstract_fs import AbstractFSTask
from base64 import b64decode
from fs.ftpfs import FTPFS
import logging
import os
_logger = logging.getLogger(__name__)

View File

@ -23,7 +23,6 @@ from .abstract_fs import AbstractFSTask
from base64 import b64decode
from fs.sftpfs import SFTPFS
import logging
import os
_logger = logging.getLogger(__name__)
@ -72,8 +71,7 @@ class SftpExportTask(SftpTask):
if attachment.state in ('pending', 'failed'):
self.attachment_id = attachment
connection_string = "{}:{}".format(self.host, self.port)
root = "/home/{}".format(self.user)
with SFTPFS(connection=connection_string, root_path=root,
with SFTPFS(connection=connection_string,
username=self.user,
password=self.pwd) as sftp_conn:
self._upload_file(sftp_conn, self.host, self.port,