plugin_installer.do not use tls if python<2.7
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
[info]
|
[info]
|
||||||
name: Plugin Installer
|
name: Plugin Installer
|
||||||
short_name: plugin_installer
|
short_name: plugin_installer
|
||||||
version: 0.5
|
version: 0.6
|
||||||
description: Install and upgrade plugins from ftp
|
description: Install and upgrade plugins from ftp
|
||||||
authors: Denis Fomin <fominde@gmail.com>
|
authors: Denis Fomin <fominde@gmail.com>
|
||||||
Yann Leboulanger <asterix@lagaule.org>
|
Yann Leboulanger <asterix@lagaule.org>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ from plugins.helpers import log_calls, log
|
|||||||
from dialogs import WarningDialog, HigDialog, YesNoDialog
|
from dialogs import WarningDialog, HigDialog, YesNoDialog
|
||||||
from plugins.gui import GajimPluginConfigDialog
|
from plugins.gui import GajimPluginConfigDialog
|
||||||
|
|
||||||
|
python_version = sys.version_info
|
||||||
|
|
||||||
def convert_version_to_list(version_str):
|
def convert_version_to_list(version_str):
|
||||||
version_list = version_str.split('.')
|
version_list = version_str.split('.')
|
||||||
@@ -78,15 +79,22 @@ class PluginInstaller(GajimPlugin):
|
|||||||
' your installer plugins. Do you want to update those plugins:'
|
' your installer plugins. Do you want to update those plugins:'
|
||||||
'\n%s') % plugins_str, on_response_yes=open_update)
|
'\n%s') % plugins_str, on_response_yes=open_update)
|
||||||
|
|
||||||
|
def ftp_connect(self):
|
||||||
|
if python_version[:2] > (2, 6):
|
||||||
|
con = ftplib.FTP_TLS(self.config['ftp_server'])
|
||||||
|
con.login()
|
||||||
|
con.prot_p()
|
||||||
|
else:
|
||||||
|
con = ftplib.FTP(self.config['ftp_server'])
|
||||||
|
con.login()
|
||||||
|
return con
|
||||||
|
|
||||||
@log_calls('PluginInstallerPlugin')
|
@log_calls('PluginInstallerPlugin')
|
||||||
def check_update(self):
|
def check_update(self):
|
||||||
def _run():
|
def _run():
|
||||||
try:
|
try:
|
||||||
to_update = []
|
to_update = []
|
||||||
con = ftplib.FTP_TLS(ftp.server)
|
con = self.ftp_connect()
|
||||||
con.login()
|
|
||||||
con.prot_p()
|
|
||||||
con.cwd('plugins')
|
|
||||||
plugins_dirs = con.nlst()
|
plugins_dirs = con.nlst()
|
||||||
for dir_ in plugins_dirs:
|
for dir_ in plugins_dirs:
|
||||||
try:
|
try:
|
||||||
@@ -372,7 +380,6 @@ class Ftp(threading.Thread):
|
|||||||
super(Ftp, self).__init__()
|
super(Ftp, self).__init__()
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.window = plugin.window
|
self.window = plugin.window
|
||||||
self.server = plugin.config['ftp_server']
|
|
||||||
self.progressbar = plugin.progressbar
|
self.progressbar = plugin.progressbar
|
||||||
self.model = plugin.available_plugins_model
|
self.model = plugin.available_plugins_model
|
||||||
self.config = ConfigParser.ConfigParser()
|
self.config = ConfigParser.ConfigParser()
|
||||||
@@ -398,9 +405,7 @@ class Ftp(threading.Thread):
|
|||||||
try:
|
try:
|
||||||
gobject.idle_add(self.progressbar.set_text,
|
gobject.idle_add(self.progressbar.set_text,
|
||||||
_('Connecting to server'))
|
_('Connecting to server'))
|
||||||
self.ftp = ftplib.FTP_TLS(self.server)
|
self.ftp = self.plugin.ftp_connect()
|
||||||
self.ftp.login()
|
|
||||||
self.ftp.prot_p()
|
|
||||||
self.ftp.cwd('plugins')
|
self.ftp.cwd('plugins')
|
||||||
if not self.remote_dirs:
|
if not self.remote_dirs:
|
||||||
self.plugins_dirs = self.ftp.nlst()
|
self.plugins_dirs = self.ftp.nlst()
|
||||||
|
|||||||
Reference in New Issue
Block a user