Move importers into module

This commit is contained in:
Mouse Reeve 2021-03-30 08:56:25 -07:00
parent 1f0c4f86c2
commit 754ccaedd6
8 changed files with 16 additions and 10 deletions

View file

@ -0,0 +1,5 @@
""" import classes """
from .importer import Importer
from .goodreads_import import GoodreadsImporter
from .librarything_import import LibrarythingImporter

View file

@ -1,5 +1,5 @@
""" handle reading a csv from goodreads """
from bookwyrm.importer import Importer
from . import Importer
class GoodreadsImporter(Importer):

View file

@ -2,7 +2,7 @@
import re
import math
from bookwyrm.importer import Importer
from . import Importer
class LibrarythingImporter(Importer):

View file

@ -0,0 +1 @@
from . import *

View file

@ -7,8 +7,8 @@ from unittest.mock import patch
from django.test import TestCase
import responses
from bookwyrm import models, importer
from bookwyrm.goodreads_import import GoodreadsImporter
from bookwyrm import models
from bookwyrm.importers import importer, GoodreadsImporter
from bookwyrm.settings import DOMAIN

View file

@ -6,8 +6,8 @@ from unittest.mock import patch
from django.test import TestCase
import responses
from bookwyrm import models, importer
from bookwyrm.librarything_import import LibrarythingImporter
from bookwyrm import models
from bookwyrm.importers import importer, LibrarythingImporter
from bookwyrm.settings import DOMAIN

View file

@ -9,8 +9,8 @@ from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from django.views import View
from bookwyrm import forms, goodreads_import, librarything_import, models
from bookwyrm.importer import Importer
from bookwyrm import forms, models
from bookwyrm.importers import Importer, LibrarythingImporter, GoodreadsImporter
from bookwyrm.tasks import app
# pylint: disable= no-self-use
@ -41,10 +41,10 @@ class Import(View):
importer = None
if source == "LibraryThing":
importer = librarything_import.LibrarythingImporter()
importer = LibrarythingImporter()
else:
# Default : GoodReads
importer = goodreads_import.GoodreadsImporter()
importer = GoodreadsImporter()
try:
job = importer.create_job(