X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/357027375ff8867f42ca34bcbfb5a78b5b185fc3..afb3cc283074103e1137e79589d15390c825ecf1:/src/catalogue/management/commands/checkcovers.py diff --git a/src/catalogue/management/commands/checkcovers.py b/src/catalogue/management/commands/checkcovers.py index 7535dd474..2466728a9 100644 --- a/src/catalogue/management/commands/checkcovers.py +++ b/src/catalogue/management/commands/checkcovers.py @@ -18,6 +18,8 @@ def ancestor_has_cover(book): current_domain = lazy(lambda: Site.objects.get_current().domain, str)() + + def full_url(obj): return 'http://%s%s' % ( current_domain, @@ -27,7 +29,7 @@ def full_url(obj): class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('-q', '--quiet', action='store_false', dest='verbose', default=True, - help='Suppress output'), + help='Suppress output'), ) help = 'Checks cover sources and licenses.' @@ -51,7 +53,7 @@ class Command(BaseCommand): good_license = re.compile("(%s)" % ")|(".join( app_settings.GOOD_LICENSES)) - with transaction.commit_on_success(): + with transaction.atomic(): for book in Book.objects.all().order_by('slug').iterator(): extra_info = book.extra_info if not extra_info.get('cover_url'): @@ -60,8 +62,7 @@ class Command(BaseCommand): else: without_cover.append(book) else: - if not extra_info.get('cover_source', '' - ).startswith(redakcja_url): + if not extra_info.get('cover_source', '').startswith(redakcja_url): not_redakcja.append(book) match = re_license.match(extra_info.get('cover_by', '')) if match: