Ok I tried:

@cache.action(time_expire=1200, cache_model=cache.memcache, quick='SVL')
def fast_download():
    import time, os
    import contenttype as c


    # very basic security:
    if not request.args(0).startswith("file.file"):
        return download()
    
    file_id = request.args(-1)
    myfile = db.file(db.file.file==file_id)


    filename, file = db.file.file.retrieve(myfile.file)
    response.headers["Content-Type"] = c.contenttype(file_id)
    response.headers["Content-Disposition"] = "attachment; filename=%s" 
%filename
    #response.headers['Last-Modified'] = time.strftime("%a, %d %b %Y 
%H:%M:%S +0000", time.localtime(myfile.last_modified))
    stream = response.stream(file, chunk_size=64*1024, request=request)
    raise HTTP(200, stream, **response.headers)

Now I'm getting an error:

PicklingError: Can't pickle <type 'generator'>: attribute lookup 
__builtin__.generator failed

Is there a way to response.render the download?


On Wednesday, January 29, 2014 2:30:37 AM UTC+13, Niphlod wrote:
>
> lots and lots of time passed under the bridge. Now there's cache.action 
> ...........
>
>>
>>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to