Fix some excepts (bare, useless, unused)
This commit is contained in:
parent
b29b70da0f
commit
3317604c65
6 changed files with 9 additions and 9 deletions
|
@ -116,7 +116,7 @@ class Plugin(BasePlugin):
|
||||||
def command_done(self, arg="0"):
|
def command_done(self, arg="0"):
|
||||||
try:
|
try:
|
||||||
id_ = int(arg)
|
id_ = int(arg)
|
||||||
except:
|
except ValueError:
|
||||||
return
|
return
|
||||||
if id_ not in self.tasks:
|
if id_ not in self.tasks:
|
||||||
return
|
return
|
||||||
|
|
|
@ -9,6 +9,8 @@ log = logging.getLogger(__name__)
|
||||||
import os
|
import os
|
||||||
from xml.etree import cElementTree as ET
|
from xml.etree import cElementTree as ET
|
||||||
|
|
||||||
|
from slixmpp.exceptions import XMPPError
|
||||||
|
from slixmpp.xmlstream.xmlstream import NotConnectedError
|
||||||
from slixmpp.xmlstream.stanzabase import StanzaBase
|
from slixmpp.xmlstream.stanzabase import StanzaBase
|
||||||
from slixmpp.xmlstream.handler import Callback
|
from slixmpp.xmlstream.handler import Callback
|
||||||
from slixmpp.xmlstream.matcher import StanzaPath
|
from slixmpp.xmlstream.matcher import StanzaPath
|
||||||
|
@ -157,7 +159,7 @@ class CommandCore:
|
||||||
pres = self.core.xmpp.make_presence(pto=jid, ptype=ptype, pstatus=status)
|
pres = self.core.xmpp.make_presence(pto=jid, ptype=ptype, pstatus=status)
|
||||||
self.core.events.trigger('send_normal_presence', pres)
|
self.core.events.trigger('send_normal_presence', pres)
|
||||||
pres.send()
|
pres.send()
|
||||||
except:
|
except (XMPPError, NotConnectedError):
|
||||||
self.core.information('Could not send directed presence', 'Error')
|
self.core.information('Could not send directed presence', 'Error')
|
||||||
log.debug('Could not send directed presence to %s', jid, exc_info=True)
|
log.debug('Could not send directed presence to %s', jid, exc_info=True)
|
||||||
return
|
return
|
||||||
|
|
|
@ -55,7 +55,7 @@ class CompletionCore:
|
||||||
themes_dir = os.path.expanduser(themes_dir)
|
themes_dir = os.path.expanduser(themes_dir)
|
||||||
try:
|
try:
|
||||||
names = os.listdir(themes_dir)
|
names = os.listdir(themes_dir)
|
||||||
except OSError as e:
|
except OSError:
|
||||||
log.error('Completion for /theme failed', exc_info=True)
|
log.error('Completion for /theme failed', exc_info=True)
|
||||||
return False
|
return False
|
||||||
theme_files = [name[:-3] for name in names if name.endswith('.py') and name != '__init__.py']
|
theme_files = [name[:-3] for name in names if name.endswith('.py') and name != '__init__.py']
|
||||||
|
|
|
@ -52,10 +52,7 @@ class PluginManager(object):
|
||||||
|
|
||||||
def disable_plugins(self):
|
def disable_plugins(self):
|
||||||
for plugin in set(self.plugins.keys()):
|
for plugin in set(self.plugins.keys()):
|
||||||
try:
|
self.unload(plugin, notify=False)
|
||||||
self.unload(plugin, notify=False)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def load(self, name, notify=True):
|
def load(self, name, notify=True):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -26,6 +26,7 @@ from poezio.common import safeJID
|
||||||
from poezio.config import config
|
from poezio.config import config
|
||||||
from poezio.decorators import refresh_wrapper
|
from poezio.decorators import refresh_wrapper
|
||||||
from poezio.roster import roster
|
from poezio.roster import roster
|
||||||
|
from poezio.text_buffer import CorrectionError
|
||||||
from poezio.theming import get_theme, dump_tuple
|
from poezio.theming import get_theme, dump_tuple
|
||||||
from poezio.decorators import command_args_parser
|
from poezio.decorators import command_args_parser
|
||||||
|
|
||||||
|
@ -116,7 +117,7 @@ class ConversationTab(OneToOneTab):
|
||||||
self.modify_message(msg['body'], self.last_sent_message['id'], msg['id'], jid=self.core.xmpp.boundjid,
|
self.modify_message(msg['body'], self.last_sent_message['id'], msg['id'], jid=self.core.xmpp.boundjid,
|
||||||
nickname=self.core.own_nick)
|
nickname=self.core.own_nick)
|
||||||
replaced = True
|
replaced = True
|
||||||
except:
|
except CorrectionError:
|
||||||
log.error('Unable to correct a message', exc_info=True)
|
log.error('Unable to correct a message', exc_info=True)
|
||||||
else:
|
else:
|
||||||
del msg['replace']
|
del msg['replace']
|
||||||
|
|
|
@ -487,7 +487,7 @@ def update_themes_dir(option=None, value=None):
|
||||||
# system-wide import
|
# system-wide import
|
||||||
try:
|
try:
|
||||||
import poezio_themes
|
import poezio_themes
|
||||||
except:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if poezio_themes.__path__:
|
if poezio_themes.__path__:
|
||||||
|
|
Loading…
Reference in a new issue