How to send a raw http header in python just like header() in PHP ?
                
                A: 
                
                
              Pass a list of two-tuples containing the header name and header value to the start_response() function.
                  Ignacio Vazquez-Abrams
                   2010-10-16 11:35:58
                
              This is for WSGI applications.
                  Epeli
                   2010-10-16 11:39:04
                
                +1 
                A: 
                
                
              
            In Django, you'd be like:
def someview(request):
    # ... etc ...
    out = HttpResponse(outputstring,
        mimetype="text/html",
        status_code="302",
        )
    out['Content-Disposition'] = "attachment; filename=download.html"
    # fill in all your favorite HTTP headers here
    return out
... for cache-control and friends, you need to import a bunch of decorators and wrap your view functions accordingly (I forget which) -- this is because django has a caching system with which many sub-rosa bits of the framework are integrated.
I find the cache stuff confusing, but also nice. non-cache HTTP headers are E-Z.
                  fish2000
                   2010-10-16 11:49:39