mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-11 09:45:27 +00:00
Small code cleanup
This commit is contained in:
parent
470c5d4acb
commit
72b4e7da76
3 changed files with 16 additions and 13 deletions
|
@ -17,16 +17,19 @@ class AbstractConnector(ABC):
|
|||
|
||||
self.book_mappings = {}
|
||||
|
||||
self.base_url = info.base_url
|
||||
self.books_url = info.books_url
|
||||
self.covers_url = info.covers_url
|
||||
self.search_url = info.search_url
|
||||
self.key_name = info.key_name
|
||||
self.max_query_count = info.max_query_count
|
||||
self.name = info.name
|
||||
self.local = info.local
|
||||
self.id = info.id
|
||||
self.identifier = info.identifier
|
||||
fields = [
|
||||
'base_url',
|
||||
'books_url',
|
||||
'covers_url',
|
||||
'search_url',
|
||||
'key_name',
|
||||
'max_query_count',
|
||||
'name',
|
||||
'identifier',
|
||||
'local'
|
||||
]
|
||||
for field in fields:
|
||||
setattr(self, field, getattr(info, field))
|
||||
|
||||
|
||||
def is_available(self):
|
||||
|
@ -235,7 +238,7 @@ def get_data(url):
|
|||
return data
|
||||
|
||||
|
||||
class SearchResult:
|
||||
class SearchResult(object):
|
||||
''' standardized search result object '''
|
||||
def __init__(self, title, key, author, year):
|
||||
self.title = title
|
||||
|
|
|
@ -131,7 +131,7 @@ class Connector(AbstractConnector):
|
|||
|
||||
|
||||
def get_cover(cover_url):
|
||||
''' ask openlibrary for the cover '''
|
||||
''' download the cover '''
|
||||
image_name = cover_url.split('/')[-1]
|
||||
response = requests.get(cover_url)
|
||||
if not response.ok:
|
||||
|
|
|
@ -310,7 +310,7 @@ def handle_boost(activity):
|
|||
|
||||
@app.task
|
||||
def handle_tag(activity):
|
||||
''' someone is tagging or shelving a book '''
|
||||
''' someone is tagging a book '''
|
||||
user = get_or_create_remote_user(activity['actor'])
|
||||
if not user.local:
|
||||
book = activity['target']['id']
|
||||
|
|
Loading…
Reference in a new issue