Mark Ramm wrote: > Of course it would also be possible to do 1 and 2 inside of the > use_wsgi_app function, and I thought I added a ticket to make that > happen, but I can't find it now. >
Hmm, not really I believe... Take close look at the code I posted. The default() method needs to see what arguments were passed as positional args to calculate how many elements it needs to pop from PATH_INFO into SCRIPT_NAME. Unless TG stores this info somewhere in the request object there's no way to get it from inside use_wsgi_app > One use case of use_wsgi_app was that's not covered by the above > example is that we wanted it to be simple to just return the response > OR for the controller to monkey with the response on the way out. > Hmm, subclass and override "default"? Anyway, I've made it more explicit b adding a "delegate" method and documenting in its docstring thta you can use it for that purpose > But, I like the idea of a mounting a wsgi application more directly > than use_wsgi_app allows... > Ok, you got it at http://trac.turbogears.org/changeset/6035 I've also implemented a TracController so you can easily (perhaps too easily) mount a Trac instance inside a TG2 app: class RootController(BaseController): trac = TracController(some_predicate, env_path='/path/o/your/trac') Try it out, it's cool :) BTW, authentication info is passed to Trac to of course.. and I took cae of the edge cases I banged my head agains with when doing something similar in tw.org (making the request body seekable, rewinding it before delegating to Trac, translating the HTTPExceptions Trac raises into proper WSGI responses, etc...) The only caveat is that it probably doesn't belong inside tg.controllers... but I do think that TG2 should bundle a bunch of helpers like this inside since it they're so short and don't need to pull dependencies (since you can do the imports inside __init__ and configire the app there). They also make great marketing material ;) So, should add some more of these in a separate module? For example, one for Rum? ;) Alberto --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
