added basic download capabilities
git-svn-id: http://yolanda.mister-muffin.de/svn@378 7eef14d0-6ed0-489d-bf55-20463b2d70dbmain
parent
243cf1fa7f
commit
e3c4f65849
@ -0,0 +1,19 @@
|
||||
from yolanda.lib.base import *
|
||||
|
||||
import paste.fileapp
|
||||
import os
|
||||
|
||||
class DownloadFileApp(paste.fileapp.FileApp):
|
||||
def __init__(self, path, filename, headers=None, **kwargs):
|
||||
self.filename = path
|
||||
kwargs['content-type'] = "video/ogg"
|
||||
kwargs['Content-Disposition'] =' attachment; filename="'+filename+'"'
|
||||
paste.fileapp.DataApp.__init__(self, None, headers, **kwargs)
|
||||
|
||||
class DownloadController(BaseController):
|
||||
|
||||
def download(self, id, title):
|
||||
fapp = DownloadFileApp(
|
||||
path=os.path.join(config['pylons.paths']['static_files'], "videos", id),
|
||||
filename=title+".ogv")
|
||||
return fapp(request.environ, self.start_response)
|
Loading…
Reference in New Issue