diff --git a/core/ungluify_record.py b/core/ungluify_record.py index f0d2c09c..1a58318e 100644 --- a/core/ungluify_record.py +++ b/core/ungluify_record.py @@ -17,13 +17,14 @@ from django.core.urlresolvers import reverse from regluit.core import models -def makemarc(marcfile, license, edition): +def makemarc(marcfile, edition): """ fyi if we're going to suck down LOC records directly: parse_xml_to_array takes a file, so we need to faff about with file writes would be nice to have a suitable z39.50 can use LCCN to grab record with urllib, but file writes are inconsistent """ + license = edition.ebooks.all()[0].rights logger = logging.getLogger(__name__) logger.info("Making MARC records for edition %s and license %s" % (edition, license)) if '/unglue.it' in settings.BASE_URL: diff --git a/frontend/forms.py b/frontend/forms.py index 55e510f2..7d98d065 100644 --- a/frontend/forms.py +++ b/frontend/forms.py @@ -577,19 +577,6 @@ class MARCUngluifyForm(forms.Form): error_messages={'required': 'Please specify an edition.'}, ) file = forms.FileField(label='Download a MARCXML file from Library of Congress; then upload it here.') - license = forms.ChoiceField(choices=settings.CHOICES) - - # insist that there is at least one ebook to link to - def clean(self): - ebooks = False - for format_tuple in settings.FORMATS: - format = format_tuple[0] - if self.cleaned_data['edition'].ebooks.filter(format=format): - ebooks = True - break - if not ebooks: - raise forms.ValidationError('Please add at least one unglued ebook link to THIS EDITION through the work or admin page before creating a MARC record.') - return self.cleaned_data class MARCFormatForm(forms.ModelForm): class Meta: diff --git a/frontend/views.py b/frontend/views.py index 2194aa3b..f4e8fb6c 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -2632,13 +2632,11 @@ class MARCUngluifyView(FormView): success_url = reverse_lazy('MARCUngluify') def form_valid(self, form): - license = form.cleaned_data['license'] edition = form.cleaned_data['edition'] try: ungluify_record.makemarc( marcfile=self.request.FILES['file'], - license=license, edition=edition ) messages.success(