Oops! Thanks for the response, and that was a silly typo... I put it in its own module because there is a fair amount of stuff done to generate the file that I want to return.
I'm having a problem now with the Content Type not being properly set - the file is a FITS file (http://heasarc.gsfc.nasa.gov/docs/heasarc/ fits.html), but it is being downloaded by browsers as an HTML file. I changed the code from what is above to using pylons: pylons.response.headers['Content-Type'] = 'application/fits' pylons.response.headers['Content-Disposition'] = 'attachment; filename="spSpec.fits" This doesn't seem to set the content type properly - is there a correct way to do it? Thanks! On Jul 29, 5:14 pm, "Diez B. Roggisch" <[email protected]> wrote: > Am 29.07.2010 um 22:43 schrieb Adrian: > > > > > > > Hello, > > > I've been following some posts in the mailing list about specifying a > > custom content type, but I can't get this (seemingly) simple code to > > work. For my purposes, I want to be able to return a FITS file - but > > just to test I have the following code in my controller: > > > **some imports up here** > > __all__ = ['ReturnSpSpecController'] > > > class ReturnSpSpecController: > > > �...@expose() > > def index(self, **kwargs): > > #tg.response.set_header("content-type", "application/fits") <-- > > eventually what I want > > tg.response.set_header("content-type", "text/html") # But I > > wanted > > to test this with a simple example > > return "\n\nTesting, hello world." > > > Then in root.py I have the standard: > > from spectrawebapp.controllers.returnSpSpec import > > ReturnSpSpecController > > [...] > > class RootController(BaseController): > > [...] > > returnSpSpecController = ReturnSpSpecController() > > [...] > > > However, when I try to go tohttp://mypage/returnSpSpecI get a 404 > > not found. > > Which is to be expected when you bind the ReturnSpSpecController() > under the name "returnSpSpecController", but then only ask for > "returnSpSpec". > > Either change the line to > > returnSpSpec = ReturnSpSpecController() > > or maybe even better, forego the sub-controller (unless you want other > methods in it), and just add a returnSpSpec-action to the root > controller. > > Diez -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

