Commit d2ef59d6 authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

pylint: remove too broad exceptions. Let's see what happens

parent f1fcb974
......@@ -266,10 +266,7 @@ class DeferredBlock(StrMixin):
if hasattr(result, 'traceback'):
traceBack = result.traceback
else:
try:
traceBack = result.getBriefTraceback()
except BaseException as exc:
traceBack = 'twisted cannot give us a traceback:{}'.format(exc)
traceBack = result.getBriefTraceback()
self.table.abort(
msg,
request.user.name,
......
......@@ -282,40 +282,37 @@ class EditableRuleModel(RuleModel):
# pylint: disable=too-many-branches
if not index.isValid():
return False
try:
dirty = False
column = index.column()
item = index.internalPointer()
ruleset = item.ruleset()
content = item.rawContent
if role == Qt.EditRole:
if isinstance(content, Ruleset) and column == 0:
oldName = content.name
content.rename(english(value))
dirty = oldName != content.name
elif isinstance(content, RuleBase):
dirty, message = self.__setRuleData(column, content, value)
if message:
Sorry(message)
return False
else:
return False
elif role == Qt.CheckStateRole:
if isinstance(content, BoolRule) and column == 1:
if not isinstance(ruleset, PredefinedRuleset):
newValue = value == Qt.Checked
if content.parameter != newValue:
dirty = True
content.parameter = newValue
else:
dirty = False
column = index.column()
item = index.internalPointer()
ruleset = item.ruleset()
content = item.rawContent
if role == Qt.EditRole:
if isinstance(content, Ruleset) and column == 0:
oldName = content.name
content.rename(english(value))
dirty = oldName != content.name
elif isinstance(content, RuleBase):
dirty, message = self.__setRuleData(column, content, value)
if message:
Sorry(message)
return False
if dirty:
if isinstance(content, RuleBase):
ruleset.updateRule(content)
self.dataChanged.emit(index, index)
return True
except BaseException:
return False
else:
return False
elif role == Qt.CheckStateRole:
if isinstance(content, BoolRule) and column == 1:
if not isinstance(ruleset, PredefinedRuleset):
newValue = value == Qt.Checked
if content.parameter != newValue:
dirty = True
content.parameter = newValue
else:
return False
if dirty:
if isinstance(content, RuleBase):
ruleset.updateRule(content)
self.dataChanged.emit(index, index)
return True
def flags(self, index): # pylint: disable=no-self-use
"""tell the view what it can do with this item"""
......
......@@ -353,7 +353,7 @@ class Voice(StrMixin):
(existingMd5sum, md5Name, self.__md5sum))
try:
open(md5Name, 'w').write('%s\n' % self.__md5sum)
except BaseException as exception:
except OSError as exception:
logException(
'\n'.join([i18n('cannot write <filename>%1</filename>: %2',
md5Name,
......@@ -396,7 +396,7 @@ class Voice(StrMixin):
if len(line) == self.md5sumLength:
return line
logWarning('{} has wrong content: {}'.format(self.md5FileName(), line))
except BaseException as exc:
except OSError as exc:
logWarning('{} has wrong content: {}'.format(self.md5FileName(), exc))
return None
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment