So, one of the big advantages of TurboGears for me personally is that
we work in a very web 2.0 environment and are often exposing the exact
same data as HTML, RSS , JSON (for use by client side apps, and by
javascript in our web-app). The current stacked expose method is
clean, looks nice, and makes all kinds of sense to me.
But I've been thinking about a couple of changes to how that all
works under the hood for tg2 and I'd like to get feeback from the rest
of you.
My plan is to remove the rule-dispatch portion of the API and replace
it with something simpler. Basically I'd like to have two main ways
to declare what content type you want returned from an HTTP request to
a tg controller:
1) add the proper accept header to the HTTP Post request. ("text/JSON")
2) use a file extension at the end of a URL to declare what you want
(http://../user.json)
Then we'll just match up a request to the proper content type, and if
@expose registers a template/engine that matches that content type and
return it.
The plan would be to have the URL/file extension system overide the
accept headers since it's more publicly visible and therefore can be
considered more explicit.
We can also have a variation on 2 where we accept an tg_format
parameter, but I personally don't think that's very attractive and it
forces unwanted TG specific stuff into your URI, which isn't nice.
But practicality beats purity, so if there's a good reason to support
tg_format, I'll be more than happy to do it.
Any thoughts before I go off and start adding this kind of stuff to SVN?
--
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---