Example #1
0
def fetch_booklist(request):
    server    = request.REQUEST.get("server", config.DEFAULT_SERVER)
    book      = request.REQUEST.get("book")
    interface = request.REQUEST.get("interface", "Booki")
    if interface == "Booki":
        books = booki_wrapper.get_book_list(server)
    else:
        books = twiki_wrapper.get_book_list(server)
    context = {
        "books" : books,
        "default" : book,
        }
    return render_to_response("booklist.html", context, context_instance=RequestContext(request))
Example #2
0
#-------------------------------------------------------------#

import traceback
from objavi.fmbook import log, ZipBook, make_book_name
from objavi import config
from objavi.twiki_wrapper import get_book_list


def make_epub(server, bookid):
    log('making epub for %s %s' % (server, bookid))
    bookname = make_book_name(bookid, server, '.epub')
    book = ZipBook(server, bookid, bookname=bookname, project='FM')
    book.make_epub(use_cache=True)


for server, settings in config.SERVER_DEFAULTS.items():
    if settings['interface'] == 'Booki':
        continue
    books = get_book_list(server)

    for book in books:
        try:
            make_epub(server, book)
            log('SUCCEEDED: %s %s' % (server, book))
        except Exception, e:
            log('FAILED: %s %s' % (server, book))
            traceback.print_exc()