From 4f6d89ab5156526e3a371c0c954166d298621de6 Mon Sep 17 00:00:00 2001 From: Peter Portante Date: Thu, 14 Nov 2013 13:56:47 -0500 Subject: [PATCH] Import filter and app into namespace correctly The module used to simply "import swift", and then reference the classes: swift.common.middleware.catch_errors.CatchErrorsMiddleware swift.proxy.server.Application in order to very that the WSGI services loaded the proper filters and apps. However, those references only happen to work, as the WSGI loading would properly import the rest of the path so that the namespace reference would be okay. If the WSGI configuration were to change, or if the behavior of WSGI broke, instead of of seeing the actual failure condition, a module attribute error would result instead: AttributeError: 'module' object has no attribute 'middleware' The referenced names are now properly imported with this change to avoid misleading error conditions. Change-Id: Ifff4271bc5be1136bf17e4e5b291b01033d608db Signed-off-by: Peter Portante --- test/unit/common/test_wsgi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/unit/common/test_wsgi.py b/test/unit/common/test_wsgi.py index ab4b3bf672..0debe195d2 100644 --- a/test/unit/common/test_wsgi.py +++ b/test/unit/common/test_wsgi.py @@ -33,9 +33,11 @@ from urllib import quote from eventlet import listen -import swift import mock +import swift.common.middleware.catch_errors +import swift.proxy.server + from swift.common.swob import Request from swift.common import wsgi, utils, ring