Mercurial > kallithea
comparison rhodecode/lib/middleware/https_fixup.py @ 1275:2723276285ae beta
pep8ify middlewares
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 23 Apr 2011 15:17:42 +0200 |
parents | a671db5bdd58 |
children | bf263968da47 89efedac4e6c |
comparison
equal
deleted
inserted
replaced
1274:7a0004efde12 | 1275:2723276285ae |
---|---|
23 # You should have received a copy of the GNU General Public License | 23 # You should have received a copy of the GNU General Public License |
24 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 24 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
25 | 25 |
26 from rhodecode.lib import str2bool | 26 from rhodecode.lib import str2bool |
27 | 27 |
28 | |
28 class HttpsFixup(object): | 29 class HttpsFixup(object): |
30 | |
29 def __init__(self, app, config): | 31 def __init__(self, app, config): |
30 self.application = app | 32 self.application = app |
31 self.config = config | 33 self.config = config |
32 | 34 |
33 def __call__(self, environ, start_response): | 35 def __call__(self, environ, start_response): |
34 self.__fixup(environ) | 36 self.__fixup(environ) |
35 return self.application(environ, start_response) | 37 return self.application(environ, start_response) |
36 | 38 |
37 | |
38 def __fixup(self, environ): | 39 def __fixup(self, environ): |
39 """Function to fixup the environ as needed. In order to use this | 40 """ |
41 Function to fixup the environ as needed. In order to use this | |
40 middleware you should set this header inside your | 42 middleware you should set this header inside your |
41 proxy ie. nginx, apache etc. | 43 proxy ie. nginx, apache etc. |
42 """ | 44 """ |
43 proto = environ.get('HTTP_X_URL_SCHEME') | 45 proto = environ.get('HTTP_X_URL_SCHEME') |
44 | 46 |