X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/967eed676fc83d15b26149047f353ac61faa8217..972f33fb2d98a9ff59c931ac6a8a82def7cea6fe:/src/isbn/management/commands/export_onix.py?ds=sidebyside diff --git a/src/isbn/management/commands/export_onix.py b/src/isbn/management/commands/export_onix.py index 386dd1b99..73cb8db4b 100644 --- a/src/isbn/management/commands/export_onix.py +++ b/src/isbn/management/commands/export_onix.py @@ -1,5 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +import json from django.core.management.base import BaseCommand from django.utils import timezone @@ -113,7 +115,7 @@ class Command(BaseCommand): for record in ONIXRecord.objects.all(): xml += self.render_product(record) xml += FOOTER - print(xml.encode('utf-8')) + print(xml) def render_product(self, record): if record.product_form_detail: @@ -125,7 +127,7 @@ class Command(BaseCommand): else: part_number = '' contributors = '' - for no, contributor in enumerate(record.contributors, start=1): + for no, contributor in enumerate(json.loads(record.contributors), start=1): contributors += self.render_contributor(no, contributor) return PRODUCT % { 'datestamp': record.datestamp.strftime('%Y%m%d'),