On 4/9/06, Jeff Watkins <[EMAIL PROTECTED]> wrote:
> In my controller method, I'd like to know whether I'm returning JSON or HTML
> to determine whether to redirect or just return a status code. So I have
> something like:
>
> @expose( template="foo", allow_json=True )
> def method( self ):
>  if format_is_json:
>  return dict( status: "OK" )
>  else:
>  turbogears.redirect( next_url )
>
> Given that there are several ways to specify that output should be JSON
> format (Accept header and tg_format parameter at least), how can I be
> certain whether the caller is looking for JSON?

I dont think you at this point can do that. but it would sure be nice
to be able to do.
please open a ticket for it.
>
> On an unrelated note: the new Generic function nastiness that's been stuffed
> into the expose decorator makes things considerably more difficult to
> understand. I'm certain it makes someone feel warm and fuzzy knowing TG is
> using generic functions, but I took one look at it and decided I didn't want
> to know how it worked.

Yes. it makes things harder to understand but it gives more power and
flexibility.
I will try to clean it up and add some comments to it when I can find the time

>
> Of course, some comments might help.
>
>
>
> --
> Jeff Watkins
> http://newburyportion.com/
>
> "Advertising directed at children is inherently deceptive and exploits
> children under eight years of age."
> -- American Academy of Pediatrics
>
>
>  >
>


--
cheers
    elvelind grandin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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-trunk
-~----------~----~----~----~------~----~------~--~---

Reply via email to