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 to http://mypage/returnSpSpec I 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.

Reply via email to