Make pylint happy

This commit is contained in:
Guewen Baconnier
2016-11-03 16:58:36 +01:00
parent 3fd26cb894
commit 3c8b74369b
9 changed files with 32 additions and 15 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
{'name': 'Attachments on S3 storage',
'summary': 'Store assets and attachments on a S3 compatible object storage',
'version': '9.0.1.1.0',
'author': 'Camptocamp',
'author': 'Camptocamp,Odoo Community Association (OCA)',
'license': 'AGPL-3',
'category': 'Knowledge Management',
'depends': ['base'],
+13 -6
View File
@@ -10,16 +10,20 @@ import xml.dom.minidom
from contextlib import closing, contextmanager
from functools import partial
import boto
from boto.exception import S3ResponseError
import openerp
from openerp import _, api, exceptions, models, SUPERUSER_ID
from ..s3uri import S3Uri
_logger = logging.getLogger(__name__)
try:
import boto
from boto.exception import S3ResponseError
except ImportError:
boto = None # noqa
S3ResponseError = None # noqa
_logger.debug("Cannot 'import boto'.")
class IrAttachment(models.Model):
_inherit = "ir.attachment"
@@ -216,7 +220,8 @@ class IrAttachment(models.Model):
elif attachment.db_datas:
_logger.info('moving on the object storage from database')
attachment.write({'datas': attachment.datas})
new_env.cr.commit()
# we are in a new env, this is a valid commit
new_env.cr.commit() # pylint: disable=invalid-commit
@contextmanager
def do_in_new_env(self):
@@ -237,7 +242,9 @@ class IrAttachment(models.Model):
cr.rollback()
raise
else:
cr.commit()
# disable pylint error because this is a valid commit,
# we are in a new env
cr.commit() # pylint: disable=invalid-commit
@api.model
def force_storage(self):