def get_description(self, wlbook, description_add=''):
description = ''
+
+ if wlbook.meta.audience in ('L', 'SP1', 'SP2', 'SP3', 'SP4'):
+ description += '<p><em>{}</em> to lektura szkolna.'.format(wlbook.meta.title)
+ if wlbook.tree.find('//pe') is not None:
+ description += '<br>Ebook <em>{title}</em> zawiera przypisy opracowane specjalnie dla uczennic i uczniów {school}.'.format(
+ title=wlbook.meta.title,
+ school='szkoły podstawowej' if wlbook.meta.audience.startswith('SP') else 'liceum i technikum'
+ )
+ description += '</p>\n'
+
abstract = wlbook.tree.find('.//abstrakt')
if abstract is not None:
- description = transform_abstrakt(abstract)
+ description += transform_abstrakt(abstract)
description += description_add
description += '<p>'
description += ', '.join(
for p in wlbook.meta.genres
) + '</p>'
- # TODO: Move away from using audiences for this.
- if wlbook.meta.audience in ('L', 'SP1', 'SP2', 'SP3', 'SP4'):
- description += '<p><em>{}</em> to lektura szkolna.'.format(wlbook.meta.title)
- if wlbook.tree.find('//pe') is not None:
- description += '<br>Ebook <em>{title}</em> zawiera przypisy opracowane specjalnie dla uczennic i uczniów {school}.'.format(
- title=wlbook.meta.title,
- school='szkoły podstawowej' if wlbook.meta.audience.startswith('SP') else 'liceum i technikum'
- )
- description += '</p>'
return description
d = {
'errors': [],
'warnings': [],
+ 'info': []
}
if meta.thema_main or meta.thema:
if meta.thema_main:
"<b><tt>{code}</tt></b>".format(code=escape(t))
for t in meta.thema
)
- d['comment'] = mark_safe(comment)
+ d['info'].append(mark_safe(comment))
elif meta.thema:
- d['comment'] = mark_safe(
+ d['info'].append(mark_safe(
"w kategorii " + ", ".join(
"<b><tt>{code}</tt></b>".format(code=escape(t))
for t in meta.thema
)
- )
+ ))
d['warnings'].append('Brak głównej kategorii Thema')
else:
d['errors'].append('Brak kategorii Thema.')
STEP1_URL = BASE_URL + 'catalog/edit/%s'
STEP2_URL = BASE_URL + 'catalog/edit/%s/2'
STEP3_URL = BASE_URL + 'catalog/edit/%s/3'
+ STEP4_URL = BASE_URL + 'catalog/edit/%s/4'
+ STEP5_URL = BASE_URL + 'catalog/edit/%s/5'
UPLOAD_URL = BASE_URL + 'file/upload-%s'
JOB_STATUS_URL = BASE_URL + 'task/status'
GENERATE_DEMO_URL = BASE_URL + 'task/run/generate-%s-demo/%s/%d'
d = {
'warnings': [],
'errors': [],
+ 'info': [],
}
errors = []
book_data = self.get_book_data(shop, wldoc, errors)
errlist.append(error.as_html())
if book_data.get('genres'):
- d['comment'] = format_html(
+ d['info'].append(format_html(
'W kategoriach: {cat} ({price} zł)',
cat=', '.join(self.describe_category(g) for g in book_data['genres']),
- price=book_data['price']
- )
+ price=book_data['price'],
+ ))
+ d['info'].append(mark_safe(
+ '<strong>' + book_data['abstract']['header'] +
+ '</strong><br/>' + book_data['abstract']['rest']
+ ))
return d
book.woblink_id, wldoc, book.gallery_path(),
fundraising=texts
)
+ self.edit_step4(book.woblink_id, book_data)
+ self.edit_step5(book.woblink_id, book_data)
def get_book_data(self, shop, wldoc, errors=None):
return {
d = self.with_form_name(d, 'EditPublicationStep3')
return self.session.post(self.STEP3_URL % woblink_id, data=d)
+ def edit_step4(self, woblink_id, book_data):
+ d = {}
+ 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 = self.with_form_name(d, 'EditPublicationStep5')
+ return self.session.post(self.STEP5_URL % woblink_id, data=d)
+
def wait_for_job(self, job_id):
while True:
response = self.session.post(