luca72 schrieb:
> @expose()
> def scarica_file(self, ID):
> from cherrypy.lib.cptools import serve_file
> import os
> dir_corrente = os.getcwd()
> b= Musica.get(ID)
> nome = b.nome_file
> nome_band = b.band
> return serve_file('/static/'+nome_band+'/'+nome,"application/x-
> download", "attachment")
serve_file() takes the *filename* of the file to serve, NOT the URL of
the file.
You can get the path of your "static" directory like this:
from os.path import join, normpath
import pkg_resources
static_dir = pkg_resources.resource_file('mypkg', 'static')
filename = join(normpath(static_dir), nome_band, nome)
HTH, Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---