wsgi environ access #12

Closed
ruthenium opened this Issue Aug 4, 2011 · 5 comments

Comments

Projects
None yet
2 participants

To use itty-based applications in a wsgi pipeline with another, itty app should have more access to environ dict.
The most important is a 'SCRIPT_NAME' param, because it is used to construct application urls.
For example, I've implemented it in a ruthenium@23ceba7, where I've just added the script_name and user params to request:

self.script_name = self._environ.get('SCRIPT_NAME', '')
self.user = self._environ.get('REMOTE_USER', None)

But maybe the request should have access to the private environ variable using something like 'getenv' or etc?..

Owner

toastdriven commented Aug 10, 2011

I guess I'm confused on this. Couldn't you get the same information elsewhere by doing request._environ.get('SCRIPT_NAME', '')? If you could explain the use case a little better (like in conjunction with what other software does this fall down), that'd help me a lot.

Of course I can do it, but the issue is that the class members starting with _ are supposed to be private in python. Yes, they are accessible from the outside, but I thought it is not a good practice to do so. Anyway, I've created this issue mainly in order to find a better way to access the environ — should it be accessed directly, as you described, or through some helpers, that, as I thought would be more ideologically correct.

Owner

toastdriven commented Aug 11, 2011

Fair enough. That variable wasn't going to change anytime soon but I can understand not feeling comfortable using it. Let me think on it a bit & I'll work up a better way to access things.

OK, thanks for your effort!

Owner

toastdriven commented Aug 18, 2011

Fixed in SHA: c3b716f & released as v0.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment