Fixes small logic errors
This commit is contained in:
parent
9beae9cfcd
commit
c8bb717634
|
@ -15,6 +15,8 @@ class AbstractConnector(ABC):
|
||||||
info = models.Connector.objects.get(identifier=identifier)
|
info = models.Connector.objects.get(identifier=identifier)
|
||||||
self.connector = info
|
self.connector = info
|
||||||
|
|
||||||
|
self.book_mappings = {}
|
||||||
|
|
||||||
self.base_url = info.base_url
|
self.base_url = info.base_url
|
||||||
self.books_url = info.books_url
|
self.books_url = info.books_url
|
||||||
self.covers_url = info.covers_url
|
self.covers_url = info.covers_url
|
||||||
|
@ -55,7 +57,6 @@ class AbstractConnector(ABC):
|
||||||
def create_book(self, key, data, model):
|
def create_book(self, key, data, model):
|
||||||
''' create a work or edition from data '''
|
''' create a work or edition from data '''
|
||||||
# we really would rather use an existing book than make a new one
|
# we really would rather use an existing book than make a new one
|
||||||
print(data)
|
|
||||||
match = match_from_mappings(data, self.key_mappings)
|
match = match_from_mappings(data, self.key_mappings)
|
||||||
if match:
|
if match:
|
||||||
if not isinstance(match, model):
|
if not isinstance(match, model):
|
||||||
|
@ -78,6 +79,7 @@ class AbstractConnector(ABC):
|
||||||
''' simple function to save data to a book '''
|
''' simple function to save data to a book '''
|
||||||
update_from_mappings(book, data, self.book_mappings)
|
update_from_mappings(book, data, self.book_mappings)
|
||||||
book.save()
|
book.save()
|
||||||
|
return book
|
||||||
|
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
|
|
@ -73,7 +73,6 @@ class Connector(AbstractConnector):
|
||||||
edition.parent_work = work
|
edition.parent_work = work
|
||||||
edition.save()
|
edition.save()
|
||||||
|
|
||||||
print(work, edition)
|
|
||||||
return edition
|
return edition
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue