[albatross-users] ctx.request.write_header, AppContext, and Content-Types Oh my!

Michael C. Neel neel at mediapulse.com
Tue Feb 18 07:30:36 EST 2003


I should have questioned the code, it wasn't working this morning (the
not setting any content-type).

I changed the line in the SimpleSessionApp to:

    def write_headers(self):
        self.request.write_header('Pragma', 'no-cache')
        if not self.request.get_header('Content-Type'):
            self.request.write_header('Content-Type', 'text/html')

And it works great.  I guess technically I should have created a new
class and redifined that one method, but I was lazy ;)

BTW, when can we expect the next version?  We've deployed 3 sites in
Albatross so far, I have a hobby site in Albatross, and we have another
2 projects nearing release in Albtross, so it's an understament to say
I'm excited about the next release.

Mike

-----Original Message-----
From: Andrew McNamara [mailto:andrewm at object-craft.com.au] 
Sent: Monday, February 17, 2003 2:14 AM
To: Michael C. Neel
Cc: albatross-users at object-craft.com.au
Subject: Re: [albatross-users] ctx.request.write_header, AppContext, and
Content-Types Oh my! 


>I did notice that leaving the line commented out, all the other html 
>pages were getting a Content-Type header of text/html, as they should. 
>If this is apache doing this, or Albatross I don't know, but sometimes 
>you don't questing working code too much.

I'd guess it's the web server - strange though.

>I'd like to request that the AppContext's check for any existing header

>before replacing that header in the next version, or if it is truly 
>safe to pull out the Content-Type header as I have done to just do 
>that.  The other header I saw being set was the no-cache header, which 
>right now I can't see a reason I'd wanna change that, but better safe 
>than sorry and allow the app to decide if it need to change the 
>default.

The header stuff has been completely replaced for the next Albatross
release (we needed to be able to set Content-Type also... 8-).

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/



More information about the Albatross-users mailing list