X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/51c6366416694fe151fdcea3d9da7a06a08f7ef1..2245baeed5c7fb97da2aeb5441aadf26c280fee9:/src/depot/publishers/woblink.py diff --git a/src/depot/publishers/woblink.py b/src/depot/publishers/woblink.py index c373d81c..e98ec585 100644 --- a/src/depot/publishers/woblink.py +++ b/src/depot/publishers/woblink.py @@ -220,6 +220,12 @@ class Woblink(BasePublisher): 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()) @@ -488,6 +494,7 @@ class Woblink(BasePublisher): '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) @@ -501,12 +508,13 @@ class Woblink(BasePublisher): '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) @@ -523,6 +531,10 @@ class Woblink(BasePublisher): 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, } @@ -530,10 +542,6 @@ class Woblink(BasePublisher): 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),