def detail_page(request): try: stored = ToStore.get(request.matchdict['id']) except couchdbkit.exceptions.ResourceNotFound : return HTTPNotFound() return {'stored': stored}
def detail_page(request): try: stored = ToStore.get(request.matchdict['id']) except couchdbkit.exceptions.ResourceNotFound: return HTTPNotFound() return {'stored': stored}
def dl_page(request): try: stored = ToStore.get(request.matchdict['id']) body = stored.fetch_attachment('attachment', stream=True) except couchdbkit.exceptions.ResourceNotFound : return HTTPNotFound() response = Response(content_type=stored._attachments['attachment']['content_type'], body_file=body, content_length=stored._attachments['attachment']['length'], content_md5=stored._attachments['attachment']['digest'], content_disposition='attachment; filename="%s"' % stored.filename.encode('ascii', 'ignore')) return response
def dl_page(request): try: stored = ToStore.get(request.matchdict['id']) body = stored.fetch_attachment('attachment', stream=True) except couchdbkit.exceptions.ResourceNotFound: return HTTPNotFound() response = Response( content_type=stored._attachments['attachment']['content_type'], body_file=body, content_length=stored._attachments['attachment']['length'], content_md5=stored._attachments['attachment']['digest'], content_disposition='attachment; filename="%s"' % stored.filename.encode('ascii', 'ignore')) return response