Exemple #1
0
def download_jsbook(request, title, key, nonce=None):
    '''Return the archive wrapped in monocle.'''
    document = _get_document(request, title, key)
    
    if document is None:
        raise Http404 
    
    r = HttpResponse()
    r['Content-Type'] = 'text/javascript'
    r.write("squarebook = %s" % cyclops.resolve_book(document).get_monocle())
    return r
Exemple #2
0
        # If we got 0 stylesheets, this may be a legacy book
        if len(stylesheets) == 0:
            stylesheets = StylesheetFile.objects.filter(archive=document)[0:settings.MAX_CSS_FILES]

    except InvalidEpubException, e:
        log.error(traceback.format_exc())
        chapter = None
        stylesheets = None
        message = _('''
This book contained content that SocialBooks couldn't read.  You may need to check with the 
publisher that this is a valid ePub book that contains either XHTML or DTBook-formatted
content.''')


    book = cyclops.resolve_book(document).get_monocle()
	
    return direct_to_template(request, 'view.html', {'chapter':chapter,
                                            'document':document,
                                            'book': book,
                                            'next':next,
                                            'message':message,      
                                            'toc':toc,
                                            'subchapter_href':subchapter_href,
                                            'parent_chapter':parent_chapter,
                                            'stylesheets':stylesheets,
                                            'google_books':google_books,
                                            'previous':previous})


@cache_page(60 * 15)