from catalogue.models import Chunk
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_exempt
from catalogue.models import Chunk
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_exempt
def preview(request, book, chunk=None, rev=None):
"""Creates a cover image.
def preview(request, book, chunk=None, rev=None):
"""Creates a cover image.
cover = WLCover(info)
response = HttpResponse(mimetype=cover.mime_type())
image = cover.image().resize(PREVIEW_SIZE, Image.ANTIALIAS)
cover = WLCover(info)
response = HttpResponse(mimetype=cover.mime_type())
image = cover.image().resize(PREVIEW_SIZE, Image.ANTIALIAS)
html = urlopen(url).read()
match = re.search(r'<a href="([^"]*)" rel="license cc:license">Some rights reserved</a>', html)
html = urlopen(url).read()
match = re.search(r'<a href="([^"]*)" rel="license cc:license">Some rights reserved</a>', html)
-
- re_license = re.compile(r'http://creativecommons.org/licenses/([^/]*)/([^/]*)/.*')
- m = re_license.match(license_url)
- if m:
+ re_license = re.compile(r'http://creativecommons.org/licenses/([^/]*)/([^/]*)/.*')
+ m = re_license.match(license_url)
+ assert m