set charset on opds
parent
6713ea82a8
commit
d2765da9bb
|
@ -25,7 +25,8 @@ FORMAT_TO_MIMETYPE = {'pdf':"application/pdf",
|
||||||
'text':"text/html"}
|
'text':"text/html"}
|
||||||
|
|
||||||
UNGLUEIT_URL = 'https://unglue.it'
|
UNGLUEIT_URL = 'https://unglue.it'
|
||||||
ACQUISITION = "application/atom+xml;profile=opds-catalog;kind=acquisition"
|
ACQUISITION = "application/atom+xml; profile=opds-catalog ;kind=acquisition; charset=utf-8"
|
||||||
|
NAVIGATION = "application/atom+xml; profile=opds-catalog; kind=navigation; charset=utf-8"
|
||||||
FACET_RELATION = "http://opds-spec.org/facet"
|
FACET_RELATION = "http://opds-spec.org/facet"
|
||||||
|
|
||||||
old_facets = ["creative_commons", "active_campaigns"]
|
old_facets = ["creative_commons", "active_campaigns"]
|
||||||
|
|
|
@ -176,7 +176,7 @@ class OPDSNavigationView(TemplateView):
|
||||||
if self.json:
|
if self.json:
|
||||||
response_kwargs['content_type'] = "application/vnd.opds.navigation+json"
|
response_kwargs['content_type'] = "application/vnd.opds.navigation+json"
|
||||||
else:
|
else:
|
||||||
response_kwargs['content_type'] = "application/atom+xml;profile=opds-catalog;kind=navigation"
|
response_kwargs['content_type'] = opds.NAVIGATION
|
||||||
return super(TemplateView, self).render_to_response(context, **response_kwargs)
|
return super(TemplateView, self).render_to_response(context, **response_kwargs)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
@ -199,7 +199,7 @@ class OPDSAcquisitionView(View):
|
||||||
content_type="application/opds-publication+json")
|
content_type="application/opds-publication+json")
|
||||||
else:
|
else:
|
||||||
return StreamingHttpResponse(opds.opds_feed_for_work(work),
|
return StreamingHttpResponse(opds.opds_feed_for_work(work),
|
||||||
content_type="application/atom+xml;profile=opds-catalog;kind=acquisition")
|
content_type=opds.ACQUISITION)
|
||||||
facet = kwargs.get('facet')
|
facet = kwargs.get('facet')
|
||||||
page = request.GET.get('page', None)
|
page = request.GET.get('page', None)
|
||||||
order_by = request.GET.get('order_by', 'newest')
|
order_by = request.GET.get('order_by', 'newest')
|
||||||
|
@ -214,11 +214,11 @@ class OPDSAcquisitionView(View):
|
||||||
if self.json:
|
if self.json:
|
||||||
facet_class = opds_json.get_facet_class(facet)()
|
facet_class = opds_json.get_facet_class(facet)()
|
||||||
return StreamingHttpResponse(facet_class.feed(page,order_by),
|
return StreamingHttpResponse(facet_class.feed(page,order_by),
|
||||||
content_type="application/opds+json")
|
content_type="application/opds+json; charset=utf-8")
|
||||||
else:
|
else:
|
||||||
facet_class = opds.get_facet_class(facet)()
|
facet_class = opds.get_facet_class(facet)()
|
||||||
return StreamingHttpResponse(facet_class.feed(page,order_by),
|
return StreamingHttpResponse(facet_class.feed(page,order_by),
|
||||||
content_type="application/atom+xml;profile=opds-catalog;kind=acquisition")
|
content_type=opds.ACQUISITION)
|
||||||
|
|
||||||
class OnixView(View):
|
class OnixView(View):
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue