On Oct 20, 9:25 pm, "wyatt-bC" <[EMAIL PROTECTED]> wrote:
> askel wrote:
> > wyatt-bC wrote:
> > > Howdy. I'm doing some AJAXy stuff and I can't seem to get a status code
> > > other than 200.
>
> > > The relevant controller looks like this (sort of):
>
> > >     def show(self, blah, blah):
> > >         # do stuff and set ``code`` depending on what happens
> > >         # ...
> > >         return render_response('/service/%s.myt' % template, code=code)
>
> > > Doesn't matter what I set ``code`` to. I always get status 200 back on
> > > the client side.
>
> > > I screwed around with middleware.py (turning different apps off) and
> > > that didn't help.
>
> > > Any ideas?
>
> > response = render_response(template)
> > response.status_code = code
> > return response
>
> Thanks. I ended up with this:
>
> return render_response('/service/%s.myt' % template, status_code=code)

OK, I thought it worked as a one-liner, but now it doesn't seem to be.
Now I'm doing it the long way:

            r = render_response(template, status_code=code)
            r.status_code = code
            return r

There must have been some caching going on, because I tried the long
way first, then changed it to the shorter way, then went away for a
while, and then it stopped working. 

--
Wyatt Baldwin
byCycle.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss
-~----------~----~----~----~------~----~------~--~---

Reply via email to