+ )
+
+
+@route('/download/', method='POST')
+@cheetah_view('download.tmpl')
+def download_books():
+ books_ids = []
+ form = request.forms
+ for k in form:
+ if k.split('_')[-1] == 'books':
+ for bid in form.getall(k):
+ books_ids.append(bid)
+ if books_ids:
+ download_path = get_config().getpath('download', 'path')
+ for bid in books_ids:
+ book = Book.get(int(bid))
+ download(book, download_path)
+ return {
+ 'message': u'Книги сохранены.',
+ }
+ else:
+ return {
+ 'message': u'Не выбрано книг для сохранения.',
+ }
+
+
+@route('/search_books', method='GET')
+def _search_books():
+ return redirect('/search_books/')
+
+
+@route('/search_books/', method='GET')
+@cheetah_view('search_books.tmpl')
+def search_books_get():
+ return {
+ 'get_config': get_config,