[ADD] protect paramiko imports

This commit is contained in:
Holger Brunn 2017-04-02 16:18:50 +02:00
parent 790c568b86
commit abe12f6522
3 changed files with 16 additions and 7 deletions

View File

@ -1,7 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl> # © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from paramiko import SFTP_EOF, SFTPHandle try:
from paramiko import SFTP_EOF, SFTPHandle
except ImportError:
pass
from base64 import b64decode from base64 import b64decode

View File

@ -1,10 +1,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl> # © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from paramiko import AUTH_SUCCESSFUL, AUTH_FAILED,\ try:
OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED, OPEN_SUCCEEDED,\ from paramiko import AUTH_SUCCESSFUL, AUTH_FAILED,\
RSAKey, ServerInterface OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED, OPEN_SUCCEEDED,\
from paramiko.py3compat import decodebytes RSAKey, ServerInterface
from paramiko.py3compat import decodebytes
except ImportError:
pass
from openerp.exceptions import AccessDenied from openerp.exceptions import AccessDenied

View File

@ -1,8 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl> # © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from paramiko import Transport try:
from paramiko.transport import DEFAULT_WINDOW_SIZE, DEFAULT_MAX_PACKET_SIZE from paramiko import Transport
from paramiko.transport import DEFAULT_WINDOW_SIZE, DEFAULT_MAX_PACKET_SIZE
except ImportError:
pass
from openerp import api, SUPERUSER_ID from openerp import api, SUPERUSER_ID
from openerp.modules.registry import RegistryManager from openerp.modules.registry import RegistryManager