prevent traceback when check update from ftp. see https://trac.gajim.org/ticket/7023#comment:13
This commit is contained in:
parent
844c66e08e
commit
159dbdbe92
|
@ -81,30 +81,34 @@ class PluginInstaller(GajimPlugin):
|
||||||
@log_calls('PluginInstallerPlugin')
|
@log_calls('PluginInstallerPlugin')
|
||||||
def check_update(self):
|
def check_update(self):
|
||||||
def _run():
|
def _run():
|
||||||
to_update = []
|
try:
|
||||||
con = ftplib.FTP_TLS(ftp.server)
|
to_update = []
|
||||||
con.login()
|
con = ftplib.FTP_TLS(ftp.server)
|
||||||
con.prot_p()
|
con.login()
|
||||||
con.cwd('plugins')
|
con.prot_p()
|
||||||
plugins_dirs = con.nlst()
|
con.cwd('plugins')
|
||||||
for dir_ in plugins_dirs:
|
plugins_dirs = con.nlst()
|
||||||
try:
|
for dir_ in plugins_dirs:
|
||||||
con.retrbinary('RETR %s/manifest.ini' % dir_,
|
try:
|
||||||
ftp.handleDownload)
|
con.retrbinary('RETR %s/manifest.ini' % dir_,
|
||||||
except Exception, error:
|
ftp.handleDownload)
|
||||||
if str(error).startswith('550'):
|
except Exception, error:
|
||||||
continue
|
if str(error).startswith('550'):
|
||||||
ftp.config.readfp(io.BytesIO(ftp.buffer_.getvalue()))
|
continue
|
||||||
local_version = ftp.get_plugin_version(ftp.config.get('info',
|
ftp.config.readfp(io.BytesIO(ftp.buffer_.getvalue()))
|
||||||
'name'))
|
local_version = ftp.get_plugin_version(ftp.config.get(
|
||||||
if local_version:
|
'info', 'name'))
|
||||||
local = convert_version_to_list(local_version)
|
if local_version:
|
||||||
remote = convert_version_to_list(ftp.config.get('info',
|
local = convert_version_to_list(local_version)
|
||||||
'version'))
|
remote = convert_version_to_list(ftp.config.get('info',
|
||||||
if remote > local:
|
'version'))
|
||||||
to_update.append(ftp.config.get('info', 'name'))
|
if remote > local:
|
||||||
con.quit()
|
to_update.append(ftp.config.get('info', 'name'))
|
||||||
gobject.idle_add(self.warn_update, to_update)
|
con.quit()
|
||||||
|
gobject.idle_add(self.warn_update, to_update)
|
||||||
|
except Exception, e:
|
||||||
|
WarningDialog(_('Ftp error'), str(e),
|
||||||
|
gajim.interface.roster.window)
|
||||||
ftp = Ftp(self)
|
ftp = Ftp(self)
|
||||||
ftp.run = _run
|
ftp.run = _run
|
||||||
ftp.start()
|
ftp.start()
|
||||||
|
|
Loading…
Reference in New Issue