fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow wl disconnect.
[redakcja.git]
/
src
/
cover
/
views.py
diff --git
a/src/cover/views.py
b/src/cover/views.py
index
638f1c0
..
d00123c
100644
(file)
--- a/
src/cover/views.py
+++ b/
src/cover/views.py
@@
-22,7
+22,7
@@
from cover import forms
from cover.utils import get_import_data
from cover.utils import get_import_data
-PREVIEW_SIZE = (21
6
, 300)
+PREVIEW_SIZE = (21
2
, 300)
def preview(request, book, chunk=None, rev=None):
def preview(request, book, chunk=None, rev=None):
@@
-31,7
+31,14
@@
def preview(request, book, chunk=None, rev=None):
If chunk and rev number are given, use version from given revision.
If rev is not given, use publishable version.
"""
If chunk and rev number are given, use version from given revision.
If rev is not given, use publishable version.
"""
- chunk = Chunk.get(book, chunk)
+ try:
+ chunk = Chunk.get(book, chunk)
+ except Chunk.DoesNotExist:
+ raise Http404
+
+ if chunk.book.cover and rev is None and not request.GET.get('width') and not request.GET.get('height'):
+ return HttpResponseRedirect(chunk.book.cover.url)
+
if rev is not None:
try:
revision = chunk.at_revision(rev)
if rev is not None:
try:
revision = chunk.at_revision(rev)
@@
-158,7
+165,7
@@
def quick_import(request, pk):
if url.startswith('%s://%s/' % (
request.scheme,
request.get_host())):
if url.startswith('%s://%s/' % (
request.scheme,
request.get_host())):
- cover_id = url.rsplit('/', 1)[-1]
+ cover_id = url.rs
trip('/').rs
plit('/', 1)[-1]
cover = Image.objects.get(pk=cover_id)
else:
data = get_import_data(url)
cover = Image.objects.get(pk=cover_id)
else:
data = get_import_data(url)