fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support for source names, developmentStage.
[wolnelektury.git]
/
apps
/
opds
/
views.py
diff --git
a/apps/opds/views.py
b/apps/opds/views.py
index
f7658c2
..
33ca9df
100644
(file)
--- a/
apps/opds/views.py
+++ b/
apps/opds/views.py
@@
-12,12
+12,12
@@
from django.utils.feedgenerator import Atom1Feed
from django.conf import settings
from django.http import Http404
from django.contrib.sites.models import Site
from django.conf import settings
from django.http import Http404
from django.contrib.sites.models import Site
+from django.utils.functional import lazy
from basicauth import logged_in_or_basicauth, factory_decorator
from catalogue.models import Book, Tag
from basicauth import logged_in_or_basicauth, factory_decorator
from catalogue.models import Book, Tag
-from search.views import Search, SearchResult
-from lucene import Term, QueryWrapperFilter, TermQuery
+from search.views import Search
import operator
import logging
import re
import operator
import logging
import re
@@
-65,21
+65,22
@@
_root_feeds = (
)
)
+current_domain = lazy(lambda: Site.objects.get_current().domain, str)()
def full_url(url):
def full_url(url):
- return urljoin("http://%s" %
Site.objects.get_current().
domain, url)
+ return urljoin("http://%s" %
current_
domain, url)
class OPDSFeed(Atom1Feed):
link_rel = u"subsection"
link_type = u"application/atom+xml"
class OPDSFeed(Atom1Feed):
link_rel = u"subsection"
link_type = u"application/atom+xml"
- _book_parent_img =
full_url(os.path.join(settings.STATIC_URL, "img/book-parent.png")
)
+ _book_parent_img =
lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book-parent.png")), str)(
)
try:
_book_parent_img_size = unicode(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book-parent.png")))
except:
_book_parent_img_size = ''
try:
_book_parent_img_size = unicode(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book-parent.png")))
except:
_book_parent_img_size = ''
- _book_img =
full_url(os.path.join(settings.STATIC_URL, "img/book.png")
)
+ _book_img =
lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book.png")), str)(
)
try:
_book_img_size = unicode(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book.png")))
except:
try:
_book_img_size = unicode(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book.png")))
except:
@@
-112,6
+113,7
@@
class OPDSFeed(Atom1Feed):
u"length": self._book_parent_img_size,
u"type": u"image/png"})
if item['pubdate'] is not None:
u"length": self._book_parent_img_size,
u"type": u"image/png"})
if item['pubdate'] is not None:
+ # FIXME: rfc3339_date is undefined, is this ever run?
handler.addQuickElement(u"updated", rfc3339_date(item['pubdate']).decode('utf-8'))
# Author information.
handler.addQuickElement(u"updated", rfc3339_date(item['pubdate']).decode('utf-8'))
# Author information.
@@
-128,6
+130,7
@@
class OPDSFeed(Atom1Feed):
if item['unique_id'] is not None:
unique_id = item['unique_id']
else:
if item['unique_id'] is not None:
unique_id = item['unique_id']
else:
+ # FIXME: get_tag_uri is undefined, is this ever run?
unique_id = get_tag_uri(item['link'], item['pubdate'])
handler.addQuickElement(u"id", unique_id)
unique_id = get_tag_uri(item['link'], item['pubdate'])
handler.addQuickElement(u"id", unique_id)
@@
-223,7
+226,7
@@
class ByCategoryFeed(Feed):
author_link = u"http://wolnelektury.pl/"
def get_object(self, request, category):
author_link = u"http://wolnelektury.pl/"
def get_object(self, request, category):
- feed = [feed for feed in _root_feeds if feed['category']
==
category]
+ feed = [feed for feed in _root_feeds if feed['category']
==
category]
if feed:
feed = feed[0]
else:
if feed:
feed = feed[0]
else: