def list_notebooks(request): import os response_data = [('http://shogun-toolbox.org' + nb[3], os.path.basename(nb[2])) for nb in notebook.get_notebook_list(".ipynb")] response = HttpResponse(json.dumps(response_data), content_type="application/json") response['Access-Control-Allow-Origin'] = '*' return response
def get_notebook_thumb(request, nbnum): try: nbnum=int(nbnum) except: raise Http404 notebooks=notebook.get_notebook_list('.html') if nbnum<0 or nbnum>=len(notebooks): raise Http404 nb=notebooks[nbnum] nburl=settings.NOTEBOOK_URL img=notebook.get_first_image(nb[1]) return HttpResponse(img, content_type="image/png")
def get_notebook_thumb(request, nbnum): try: nbnum = int(nbnum) except: raise Http404 notebooks = notebook.get_notebook_list('.html') if nbnum < 0 or nbnum >= len(notebooks): raise Http404 nb = notebooks[nbnum] nburl = settings.NOTEBOOK_URL img = notebook.get_first_image(nb[1]) return HttpResponse(img, content_type="image/png")
def list_notebooks(request): import os response_data=[('http://shogun-toolbox.org' + nb[3],os.path.basename(nb[2])) for nb in notebook.get_notebook_list(".ipynb")] response=HttpResponse(json.dumps(response_data), content_type="application/json") response['Access-Control-Allow-Origin']='*'; return response