[Repoze-checkins] r1188 - repoze.vhm/trunk/repoze/vhm
Rocky Burt
rocky at serverzen.com
Mon Jun 30 10:07:28 EDT 2008
Author: Rocky Burt <rocky at serverzen.com>
Date: Mon Jun 30 10:07:28 2008
New Revision: 1188
Log:
Simple whitespace cleanups (pep8)
Modified:
repoze.vhm/trunk/repoze/vhm/middleware.py
Modified: repoze.vhm/trunk/repoze/vhm/middleware.py
==============================================================================
--- repoze.vhm/trunk/repoze/vhm/middleware.py (original)
+++ repoze.vhm/trunk/repoze/vhm/middleware.py Mon Jun 30 10:07:28 2008
@@ -16,6 +16,7 @@
from repoze.vhm.constants import DEFAULT_PORTS
+
class VHMFilter:
""" WSGI ingress filter:
@@ -25,9 +26,10 @@
o After conversion, the environment should be suitable for munging
via 'utils.setServerURL' (for compatibility with OFS.Traversable).
"""
+
def __init__(self, application):
self.application = application
-
+
def __call__(self, environ, start_response):
host_header = environ.get('HTTP_X_VHM_HOST')
@@ -49,12 +51,14 @@
if root_header is not None:
environ['repoze.vhm.virtual_root'] = root_header
-
+
return self.application(environ, start_response)
-
+
+
def make_filter(app, global_conf):
return VHMFilter(app)
+
class VHMPathFilter:
""" WSGI ingress filter:
@@ -64,9 +68,10 @@
o After conversion, the environment should be suitable for munging
via 'setServerURL' below (for compatibility with OFS.Traversable).
"""
+
def __init__(self, application):
self.application = application
-
+
def __call__(self, environ, start_response):
scheme = 'HTTPS' in environ and 'https' or 'http'
path = environ['PATH_INFO']
@@ -92,10 +97,11 @@
port = DEFAULT_PORTS[scheme]
environ['SERVER_NAME'] = host
environ['SERVER_PORT'] = port
- environ['repoze.vhm.virtual_host_base'] = '%s:%s' % (host, port)
+ environ['repoze.vhm.virtual_host_base'] = '%s:%s' \
+ % (host, port)
elif token == 'VirtualHostRoot':
- vroot_path = real_path[:] # prefix of vroot
+ vroot_path = real_path[:] # prefix of vroot
if vroot_path and vroot_path != ['']:
environ['repoze.vhm.virtual_root'] = '/'.join(vroot_path)
else:
@@ -106,7 +112,7 @@
if token.startswith('_vh_'): # capture external subsite
script_name_path.append(token[len('_vh_'):])
- else:
+ else:
checking_vh_names = False
if script_name_path:
script_name_path.insert(0, '')
@@ -120,5 +126,6 @@
return self.application(environ, start_response)
+
def make_path_filter(app, global_conf):
return VHMPathFilter(app)
More information about the Repoze-checkins
mailing list