Beispiel #1
0
def reader(request, slug):
    issue = get_object_or_404(Issue, slug=slug)

    # Let's get the total number pages from the comic archive
    # instead of from the db in case the file has been modified.
    # If I ever implement a file monitor function this can be removed.
    ca = ComicArchive(issue.file)
    page_count = ca.getNumberOfPages()

    uri_list = []
    for page in range(page_count):
        i = ImageAPIHandler()
        data_uri = i.get_uri(issue.file, page)
        uri_list.append(data_uri)

    return render(request, 'comics/reader.html', {
        'issue': issue,
        'data_uri': uri_list
    })
 def test_get_number_of_pages_zip(self):
     ca = ComicArchive(TEST_DATA)
     z = ca.getNumberOfPages()
     self.assertEqual(z, 24)