Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

wsgi environ access #12

Closed
ruthenium opened this Issue · 5 comments

2 participants

@ruthenium

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?..

@toastdriven
Owner

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.

@ruthenium

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.

@toastdriven
Owner

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.

@ruthenium

OK, thanks for your effort!

@toastdriven
Owner

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
Something went wrong with that request. Please try again.