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/25 00:30:37 UTC

[12/50] git commit: [#6093] Rearranged https and error middleware to get WebError working

[#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/cj/5655
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