On Tuesday 25 November 2008 16:31:09 Gustavo Narea wrote: > Hello, Diez. > > I know that's another option, but Chris McDonough has already explained to > me > > why that should be avoided. This is a part of the conversation: > > > So, before implementing such a functionality with a thread-local, I > > > wanted to ask: Why did you prefer passing the environ around instead of > > > using a thread-local? > > > > The reason the Pylons folks need the StackedObjectProxy (which is a bug > > and confusion magnet) is because they use thread locals like this to > > represent request-local state. For instance, when one Pylons application > > calls into another via WSGI, this thing stacks the environment in such a > > way that one application doesn't stomp on another's thread-locals. > > > > SOP is nasty, and I suspect using a "bare" thread local will become > > problematic in oddball environment configurations like the above, so were > > it me, I'd write it in such a way that the "raw" repoze.what stuff > > expects the environ to be passed in. In any case, if you do end up using > > thread locals, I'd put the thread local stuff in the *calling* app, and > > not in repoze.what itself. > > That's why I prefer repoze.what to be passed the environ every time it > needs the environ.
I understand that sentiment, and if repoze.wha and what are supposed to be independent middlewares - so mote it be. >From and end-user POV however this is a moot point. I don't have the environ available in TG2. Django makes these things explicit - TG doesn't. So not putting them into repoze.what will introduce the need to wrap them again, passing the explicit environment which is fetched from some thread-local storage (or even the SOP, to keep mulit-apps possible I presume, yet I don't know when such a stack is pushed/pop'd). Diez --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
