You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/04/25 22:20:31 UTC
[04/13] git commit: [#4370] ticket:322 Don't redirect from API to
login url
[#4370] ticket:322 Don't redirect from API to login url
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ad54b2fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ad54b2fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ad54b2fd
Branch: refs/heads/db/2835
Commit: ad54b2fde6231bf18d7489d4c67c4050e80aef24
Parents: 3207e95
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Apr 24 10:10:28 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 20:02:25 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/custom_middleware.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ad54b2fd/Allura/allura/lib/custom_middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index 6633489..6c121b4 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -93,7 +93,8 @@ class LoginRedirectMiddleware(object):
def __call__(self, environ, start_response):
status, headers, app_iter, exc_info = call_wsgi_application(
self.app, environ, catch_exc_info=True)
- if status[:3] == '401':
+ is_api_request = environ.get('PATH_INFO', '').startswith('/rest/')
+ if status[:3] == '401' and not is_api_request:
login_url = tg.config.get('auth.login_url', '/auth/')
if environ['REQUEST_METHOD'] == 'GET':
return_to = environ['PATH_INFO']