Re: How to force the content-type of each response?
"Jonathan Ellis" <[email protected]> Thu, 26 Apr 2007 11:22:00 -0700
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
module init stuff goes in start(), teardown in end() On Thu, 26 Apr 2007 13:58:56 -0400, "Philip Semanchuk" <[email protected]> said: > > On Apr 26, 2007, at 12:37 PM, Jonathan Ellis wrote: > > > Hmm. I think the right solution is to add a hook to have custom Spyce > > modules loaded for each request, like the builtin response request etc. > > modules. Then you could create a very short module that just did a > > response.setContentType(). > > > > Try that with 1354. append the module name (as a string) to > > globalmodules in your config.py. > > Thanks for the suggestion. Unfortunately, I can't figure out how to do > this. I can follow the custom module example (I've not written one > before) and create my module as a class, but Spyce has the restriction > that I can't override the __init__() method so I don't see how I can > get the class/module to automatically call response.setContentType(). > And if I don't create a class that inherits from spyceModule, I don't > see how I should get a handle to the response object. Further > suggestions appreciated! =) > > Cheers > Philip > > > > > > > > On Thu, 26 Apr 2007 12:21:17 -0400, "Philip Semanchuk" > > <[email protected]> said: > >> Hi all, > >> This seems like a simple question, but I can't figure out how to do > >> it. > >> I have Spyce proxied behind Apache. With each response I would like to > >> send this header: > >> Content-Type: text/html; charset=utf-8 > >> > >> I realize that I can accomplish this with a custom tag that will call > >> response.setContentType() but that only works if I remember to include > >> the tag on each page. Is there any way to customize headers via > >> spyceconf.py? Or via Apache config? My Apache-fu is pretty weak and > >> I'm > >> not sure one can get Apache to add headers to a response once > >> responsibility for the response has been handed over to a proxy. > >> > >> > >> Thanks > >> Philip > >> > >> > >> ---------------------------------------------------------------------- > >> --- > >> This SF.net email is sponsored by DB2 Express > >> Download DB2 Express C - the FREE version of DB2 express and take > >> control of your XML. No limits. Just data. Click to get it now. > >> http://sourceforge.net/powerbar/db2/ > >> _______________________________________________ > >> Spyce-users mailing list > >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/spyce-users > > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/