You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/04/24 15:46:10 UTC
[1/2] git commit: [#6093] Rearranged https and error middleware to
get WebError working
Updated Branches:
refs/heads/master e6136bd36 -> 02ac4677b
[#6093] Rearranged https and error middleware to get WebError working
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/02ac4677
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/02ac4677
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/02ac4677
Branch: refs/heads/master
Commit: 02ac4677b9abd82fde2490a8c1e03ce3a517ce66
Parents: 3f9ff9a
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue Apr 23 22:28:05 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Apr 24 13:44:40 2013 +0000
----------------------------------------------------------------------
Allura/allura/config/middleware.py | 28 ++++++++++++++--------------
requirements-sf.txt | 2 ++
2 files changed, 16 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/02ac4677/Allura/allura/config/middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index a877221..805a9b9 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -123,16 +123,6 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
app = RoutesMiddleware(app, config['routes.map'])
# Required for sessions
app = SessionMiddleware(app, config)
- # Converts exceptions to HTTP errors, shows traceback in debug mode
- tg.error.footer_html = '<!-- %s %s -->' # don't use TG footer with extra CSS & images that take time to load
- app = tg.error.ErrorHandler(app, global_conf, **config['pylons.errorware'])
- # Redirect some status codes to /error/document
- if config.get('override_root') != 'task':
- # "task" wsgi would get a 2nd request to /error/document if we used this middleware
- if asbool(config['debug']):
- app = StatusCodeRedirect(app, base_config.handle_status_codes)
- else:
- app = StatusCodeRedirect(app, base_config.handle_status_codes + [500])
# Redirect 401 to the login page
app = LoginRedirectMiddleware(app)
# Add instrumentation
@@ -153,10 +143,6 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
script_name=app_conf.get('ew.script_name', '/_ew_resources/'),
url_base=app_conf.get('ew.url_base', '/_ew_resources/'),
extra_headers=eval(app_conf.get('ew.extra_headers', 'None')))
- # Make sure that the wsgi.scheme is set appropriately when we
- # have the funky HTTP_X_SFINC_SSL environ var
- if asbool(app_conf.get('auth.method', 'local')=='sfx'):
- app = set_scheme_middleware(app)
# Handle static files (by tool)
app = StaticFilesMiddleware(app, app_conf.get('static.script_name'))
# Handle setup and flushing of Ming ORM sessions
@@ -165,6 +151,20 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
# streaming=true ensures they won't be cleaned up till
# the WSGI application's iterator is exhausted
app = RegistryManager(app, streaming=True)
+ # Converts exceptions to HTTP errors, shows traceback in debug mode
+ tg.error.footer_html = '<!-- %s %s -->' # don't use TG footer with extra CSS & images that take time to load
+ app = tg.error.ErrorHandler(app, global_conf, **config['pylons.errorware'])
+ # Make sure that the wsgi.scheme is set appropriately when we
+ # have the funky HTTP_X_SFINC_SSL environ var
+ if asbool(app_conf.get('auth.method', 'local')=='sfx'):
+ app = set_scheme_middleware(app)
+ # Redirect some status codes to /error/document
+ if config.get('override_root') != 'task':
+ # "task" wsgi would get a 2nd request to /error/document if we used this middleware
+ if asbool(config['debug']):
+ app = StatusCodeRedirect(app, base_config.handle_status_codes)
+ else:
+ app = StatusCodeRedirect(app, base_config.handle_status_codes + [500])
return app
def set_scheme_middleware(app):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/02ac4677/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index 79cdfe3..42a1b02 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -21,6 +21,8 @@ html2text==3.200.3dev-20121112
# for unmerged fix for [#5411]
GitPython==0.3.2.RC1.20130214
+WebError==0.10.3-20130423
+
# for the migration scripts only
postmarkup==1.2.0dev-20121116
# suds needed for teamforge import script
[2/2] git commit: [#6093] better middleware response,
so WebError works
Posted by jo...@apache.org.
[#6093] better middleware response, so WebError works
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3f9ff9a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3f9ff9a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3f9ff9a5
Branch: refs/heads/master
Commit: 3f9ff9a5582cac80c2587083c22e01d579240bb2
Parents: e6136bd
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Apr 22 19:44:23 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Apr 24 13:44:40 2013 +0000
----------------------------------------------------------------------
Allura/allura/config/middleware.py | 1 +
Allura/allura/lib/custom_middleware.py | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3f9ff9a5/Allura/allura/config/middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index 9cadf6b..a877221 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -124,6 +124,7 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
# Required for sessions
app = SessionMiddleware(app, config)
# Converts exceptions to HTTP errors, shows traceback in debug mode
+ tg.error.footer_html = '<!-- %s %s -->' # don't use TG footer with extra CSS & images that take time to load
app = tg.error.ErrorHandler(app, global_conf, **config['pylons.errorware'])
# Redirect some status codes to /error/document
if config.get('override_root') != 'task':
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3f9ff9a5/Allura/allura/lib/custom_middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index 1a1b678..6633489 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -165,10 +165,10 @@ class SSLMiddleware(object):
elif secure:
resp = exc.HTTPFound(location='http://' + srv_path)
- if resp is None:
- resp = req.get_response(self.app)
+ if not resp:
+ resp = self.app
return resp(environ, start_response)
-
+
class AlluraTimerMiddleware(TimerMiddleware):
def timers(self):
import genshi