Esempio n. 1
0
def detail_page(request):
    try:
        stored = ToStore.get(request.matchdict['id'])
    except couchdbkit.exceptions.ResourceNotFound :
        return HTTPNotFound()

    return {'stored': stored}
Esempio n. 2
0
def detail_page(request):
    try:
        stored = ToStore.get(request.matchdict['id'])
    except couchdbkit.exceptions.ResourceNotFound:
        return HTTPNotFound()

    return {'stored': stored}
Esempio n. 3
0
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
Esempio n. 4
0
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