if errors is not None:
errors.append(NoMainThemaWarning())
thema_codes.extend(meta.thema)
+
+ thema_codes.extend(
+ Audience.objects.filter(code__in=meta.audiences).exclude(
+ thema=None).values_list('thema', flat=True)
+ )
+
if not thema_codes:
if errors is not None:
errors.append(NoThema())
'pubFileFormat': 'epub+mobi',
'pubIsAcs': '0',
'pubPublisherIndex': '',
+ 'save_and_continue': '',
}
d = self.with_form_name(d, 'EditPublicationStep3')
return self.session.post(self.STEP3_URL % woblink_id, data=d)
'pubMobiDemoResId': mobi_demo,
'pubFileFormat': 'epub+mobi',
'pubId': woblink_id,
+ 'save_and_continue': '',
}
d = self.with_form_name(d, 'EditPublicationStep4')
return self.session.post(self.STEP4_URL % woblink_id, data=d)
def edit_step5(self, woblink_id, book_data):
- d = {}
+ d = {'save': ''}
d = self.with_form_name(d, 'EditPublicationStep5')
return self.session.post(self.STEP5_URL % woblink_id, data=d)
sleep(2)
def upload_file(self, woblink_id, filename, content, field_name, mime_type):
+ form_name = f'Upload{field_name}'
+ id_field = f'pub{field_name}ResId'
+ field_name = field_name.lower()
+
data = {
'pubId': woblink_id,
}
field_name: (filename, content, mime_type)
}
- form_name = f'Upload{field_name}'
- id_field = f'pub{field_name}ResId'
- field_name = field_name.lower()
-
response = self.session.post(
self.UPLOAD_URL % field_name,
data=self.with_form_name(data, form_name),
woblink_id,
doc.meta.url.slug + '.epub',
content,
- 'UploadEpub',
- 'epub',
+ 'Epub',
'application/epub+zip'
)
demo_id = self.generate_demo(woblink_id, 'epub')
woblink_id,
doc.meta.url.slug + '.mobi',
content,
- 'UploadMobi',
- 'mobi',
+ 'Mobi',
'application/x-mobipocket-ebook'
)
demo_id = self.generate_demo(woblink_id, 'mobi', check=False)
woblink_id,
doc.meta.url.slug + '.jpeg',
content,
- 'UploadCover',
- 'cover',
+ 'Cover',
cover.mime_type()
)
return file_id