def get(self, request, *args, **kwargs): work = request.GET.get('work', None) if work: if self.json: return HttpResponse( opds_json.opds_feed_for_work(work), content_type="application/opds-publication+json") else: return HttpResponse( opds.opds_feed_for_work(work), content_type= "application/atom+xml;profile=opds-catalog;kind=acquisition" ) facet = kwargs.get('facet') page = request.GET.get('page', None) order_by = request.GET.get('order_by', 'newest') try: page = int(page) except: page = None if self.json: facet_class = opds_json.get_facet_class(facet)() return HttpResponse(facet_class.feed(page, order_by), content_type="application/opds+json") else: facet_class = opds.get_facet_class(facet)() return HttpResponse( facet_class.feed(page, order_by), content_type= "application/atom+xml;profile=opds-catalog;kind=acquisition")
def get(self, request, *args, **kwargs): work = request.GET.get('work', None) if work: try: work = models.safe_get_work(work) except models.Work.DoesNotExist: raise Http404 return HttpResponse(onix.onix_feed_for_work(work), content_type="text/xml") facet = kwargs.get('facet', 'all') if not facet: return HttpResponseBadRequest(content='No facet provided') max_records = request.GET.get('max', 100) try: max_records = int(max_records) except Exception: max_records = None facet_class = opds.get_facet_class(facet)() page = request.GET.get('page', None) try: page = int(page) except: page = None feed = onix.onix_feed(facet_class, max_records, page_number=page) return StreamingHttpResponse(feed, content_type="text/xml")
def get(self, request, *args, **kwargs): work = request.GET.get('work', None) if work: try: work = models.safe_get_work(work) except models.Work.DoesNotExist: raise Http404 return HttpResponse(onix.onix_feed_for_work(work), content_type="text/xml") facet = kwargs.get('facet', 'all') if facet: max = request.GET.get('max', 100) try: max = int(max) except: max = None facet_class = opds.get_facet_class(facet)() return HttpResponse(onix.onix_feed(facet_class, max), content_type="text/xml")