Re: How to force the content-type of each response?

"Jonathan Ellis" <[email protected]> Thu, 26 Apr 2007 15:00:23 -0700
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
On Thu, 26 Apr 2007 17:49:06 -0400, "Philip Semanchuk"
<[email protected]> said:
> So now I have a working module called HeaderModule.py. It looks like  
> this:
> 
> import spyceModule
> import time
> 
> class HeaderModule(spyceModule.spyceModulePlus):
>      def start(self):
>          self.modules.response.setContentType("text/html; charset=utf-8")
>          file("/tmp/ResponseStart.txt", "w").write(time.asctime())
> 
> When I add [[.import name= HeaderModule]] to the top of a .spy file, my  
> content-type header gets sent and the timestamp in the /tmp file is  
> updated, so I know that the module works.
> 
> I still can't get it to work automatically, though. You mentioned a  
> globalmodules option and I can't find reference to that anywhere in the  
> code or documentation. Adding HeaderModule to the globals in  
> spyceconf.py doesn't seem to do the trick. What am I missing?

you updated to the latest 2.2 branch?

there should be a line in spyceconf.py that says 
globalmodules = []

so in your config.py you can write
globalmodules.append('HeaderModule')

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