fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix preview_until
[wolnelektury.git]
/
src
/
api
/
handlers.py
diff --git
a/src/api/handlers.py
b/src/api/handlers.py
index
9e75c53
..
199f030
100644
(file)
--- a/
src/api/handlers.py
+++ b/
src/api/handlers.py
@@
-161,7
+161,7
@@
class BookDetailHandler(BaseHandler, BookDetails):
"""
allowed_methods = ['GET']
fields = ['title', 'parent', 'children'] + Book.formats + [
"""
allowed_methods = ['GET']
fields = ['title', 'parent', 'children'] + Book.formats + [
- 'media', 'url', 'cover', 'cover_thumb', 'simple_thumb', 'simple_cover', 'fragment_data'] + [
+ 'media', 'url', 'cover', 'cover_thumb', 'simple_thumb', 'simple_cover', 'fragment_data'
, 'preview'
] + [
category_plural[c] for c in book_tag_categories]
@piwik_track
category_plural[c] for c in book_tag_categories]
@piwik_track
@@
-394,18
+394,18
@@
def add_tag_getters():
setattr(BookDetails, plural, _tags_getter(singular))
setattr(BookDetails, singular, _tag_getter(singular))
setattr(BookDetails, plural, _tags_getter(singular))
setattr(BookDetails, singular, _tag_getter(singular))
+
add_tag_getters()
# add fields for files in Book
def _file_getter(book_format):
add_tag_getters()
# add fields for files in Book
def _file_getter(book_format):
- field = "%s_file" % book_format
- @
class
method
- def get_file(
cls,
book):
- f
= getattr(book, field
)
- if f:
- return MEDIA_BASE + f
.
url
+ @
static
method
+ def get_file(book):
+ f
_url = book.media_url(book_format
)
+ if f
_url
:
+ return MEDIA_BASE + f
_
url
else:
return ''
return get_file
else:
return ''
return get_file