[mod_python] Cookies & Redirects

Byron Ellacott bje at apnic.net
Mon Aug 23 15:08:41 EDT 2004


Jim Dabell wrote:
> Under what circumstances is having separate sets of headers useful?  Does 

def handle_response():
     set_content_type()
     set_cache_controls()
     set_content_length()
     do_fallible_operation()
     return apache.OK

... and if do_fallible_operation() happens to raise an exception, 
assuming it's handled correctly and an appropriate error message is 
generated for the user and a 5xx return code is raised, then the content 
type, length and cache controls that have been set are no longer 
appropriate.

Essentially, having a separate set of headers for error output allows 
you to handle an error when it occurs, and not worry about it otherwise, 
by giving you a clean slate to work with when generating an error response.

Whether that's worth while or not is another question, but those are 
probably the circumstances under which it's useful to ahve separate headers.

-- 
bje


More information about the Mod_python mailing list