Fix errors detected by pylint. Among them a fix for traceback when adding an item to the servicemanager.

bzr-revno: 2858
This commit is contained in:
Tomas Groth 2019-04-13 15:11:57 +02:00
commit 68dc577f77
5 changed files with 5 additions and 5 deletions

View File

@ -595,7 +595,7 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties):
:param remote: Triggered from remote :param remote: Triggered from remote
:param position: Position to place item :param position: Position to place item
""" """
service_item = self.build_service_item(item, True, remote=remote, context=ServiceItemContext.Service) service_item = self.build_service_item(item, remote=remote, context=ServiceItemContext.Service)
if service_item: if service_item:
service_item.from_plugin = False service_item.from_plugin = False
self.service_manager.add_service_item(service_item, replace=replace, position=position) self.service_manager.add_service_item(service_item, replace=replace, position=position)

View File

@ -239,7 +239,7 @@ class PrintServiceForm(QtWidgets.QDialog, Ui_PrintServiceDialog, RegistryPropert
footer_html = footer_html.partition('<br>')[2] footer_html = footer_html.partition('<br>')[2]
if footer_html: if footer_html:
footer_html = html.escape(footer_html.replace('<br>', '\n')) footer_html = html.escape(footer_html.replace('<br>', '\n'))
self._add_element('div', footer_html.replace('\n', '<br>'), parent=div, classId='itemFooter') self._add_element('div', footer_html.replace('\n', '<br>'), parent=div, class_id='itemFooter')
# Add service items' notes. # Add service items' notes.
if self.notes_check_box.isChecked(): if self.notes_check_box.isChecked():
if item.notes: if item.notes:

View File

@ -352,7 +352,7 @@ class PathEdit(QtWidgets.QWidget):
:rtype: None :rtype: None
""" """
if self._path != path: if self._path != path:
self.path = path self._path = path
self.pathChanged.emit(path) self.pathChanged.emit(path)

View File

@ -187,7 +187,7 @@ class BibleManager(LogMixin, RegistryProperties):
bible = self.db_cache[name] bible = self.db_cache[name]
bible.session.close_all() bible.session.close_all()
bible.session = None bible.session = None
return delete_file(bible.path, bible.file_path) return delete_file(bible.path / '{name}{suffix}'.format(name=name, suffix=self.suffix))
def get_bibles(self): def get_bibles(self):
""" """

View File

@ -67,4 +67,4 @@ class TestManager(TestCase):
assert result is True assert result is True
mocked_close_all.assert_called_once_with() mocked_close_all.assert_called_once_with()
assert mocked_bible.session is None assert mocked_bible.session is None
mocked_delete_file.assert_called_once_with(Path('bibles'), 'KJV.sqlite') mocked_delete_file.assert_called_once_with(Path('bibles') / 'KJV.sqlite')