Ian Charnas wrote:
> Many of you have probably noticed that sometimes on the internet when
> you click on a link, a "Download File" dialog box appears without the
> page refreshing.  You may even know that this is a special feature of
> HTTP that allows for attachments.  This is also how most sites do
> "automatic downloads".
>
> Like I said this is an HTTP feature.  All you have to do is set the
> "Content-Type" header to "application/x-download" and the
> "Content-Disposition" header to indicate an attachment.
>
> [this might be good for the TG documentation section]

Indeed. CherryPy 3 has a helper for this in lib/static:

def serve_download(path, name=None):
    """Serve 'path' as an application/x-download attachment."""
    # This is such a common idiom I felt it deserved its own wrapper.
    return serve_file(path, "application/x-download", "attachment",
name)


Robert Brewer
System Architect
Amor Ministries
[EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to