forked from mirrors/bookwyrm
Move importers into module
This commit is contained in:
parent
1f0c4f86c2
commit
754ccaedd6
8 changed files with 16 additions and 10 deletions
5
bookwyrm/importers/__init__.py
Normal file
5
bookwyrm/importers/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
""" import classes """
|
||||
|
||||
from .importer import Importer
|
||||
from .goodreads_import import GoodreadsImporter
|
||||
from .librarything_import import LibrarythingImporter
|
|
@ -1,5 +1,5 @@
|
|||
""" handle reading a csv from goodreads """
|
||||
from bookwyrm.importer import Importer
|
||||
from . import Importer
|
||||
|
||||
|
||||
class GoodreadsImporter(Importer):
|
|
@ -2,7 +2,7 @@
|
|||
import re
|
||||
import math
|
||||
|
||||
from bookwyrm.importer import Importer
|
||||
from . import Importer
|
||||
|
||||
|
||||
class LibrarythingImporter(Importer):
|
1
bookwyrm/tests/importers/__init__.py
Normal file
1
bookwyrm/tests/importers/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from . import *
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue