- download_path = get_config().getpath('download', 'path')
- for bid in books_ids:
- book = Book.get(int(bid))
- download(book, download_path)
- return {
- 'message': u'Книги сохранены.',
- }
+ try:
+ for bid in books_ids:
+ book = Book.get(int(bid))
+ download(book)
+ except Exception as e:
+ return {
+ 'error': str(e),
+ }
+ else:
+ return {
+ 'message': u'Книги сохранены.',
+ }