pull/94/head
eric 2019-03-27 21:46:25 -04:00
parent c142533898
commit 14346ed868
3 changed files with 20 additions and 38 deletions

View File

@ -18,12 +18,12 @@ from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.db import IntegrityError
from django.forms import ValidationError
from django.utils.timezone import now
from django_comments.models import Comment
from github3 import (login, GitHub)
from github3.repos.release import Release
from django.utils.timezone import now
from gitenberg.metadata.pandata import Pandata
# regluit imports
@ -251,9 +251,6 @@ def get_isbn_item(items, isbn):
for ident in industryIdentifiers:
if ident['identifier'] == isbn:
return item
else:
return None # no items
return item
def add_by_isbn_from_google(isbn, work=None):
"""add a book to the UnglueIt database from google based on ISBN. The work parameter

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
# encoding: utf-8
import datetime
import json
import logging
import re
@ -19,7 +18,6 @@ from oaipmh.metadata import MetadataRegistry, oai_dc_reader
from regluit.core import bookloader, cc
from regluit.core import models, tasks
from regluit.core.bookloader import merge_works
from regluit.core.isbn import ISBN
from regluit.core.loaders.utils import type_for_url
from regluit.core.validation import identifier_cleaner, valid_subject
@ -67,7 +65,7 @@ def store_doab_cover(doab_id, redo=False):
cover_file = ContentFile(r.content)
content_type = r.headers.get('content-type', '')
if u'text/html' in content_type:
logger.warning('Cover return html for doab_id={}: {}'.format(doab_id, e))
logger.warning('Cover return html for doab_id={}'.format(doab_id))
return (None, False)
cover_file.content_type = content_type
@ -408,20 +406,6 @@ def add_by_doab(doab_id, record=None):
url_to_provider(dl_url) if dl_url else None,
**metadata
)
else:
if 'format' in metadata:
del metadata['format']
edition = load_doab_edition(
title,
doab_id,
'',
'',
license,
language,
isbns,
None,
**metadata
)
return edition
except IdDoesNotExistError:
return None

View File

@ -78,3 +78,4 @@ def lang_to_language_code(lang):
if code:
return code
return ''