Clean imports in code

This patch set modifies lines which are importing objects
instead of modules. As per openstack import guide lines, user should
import modules in a file not objects.

http://docs.openstack.org/developer/hacking/#imports

Change-Id: I6624bc15c64e4e31e6988c60e40fdfa6ab1488fb
This commit is contained in:
Cao Xuan Hoang 2016-08-29 15:40:15 +07:00
parent d2ad33f07c
commit 9f5b518150
2 changed files with 7 additions and 5 deletions

View File

@ -15,7 +15,7 @@
"""wsgi transport helpers."""
from distutils.version import LooseVersion
from distutils import version
import uuid
import falcon
@ -103,8 +103,9 @@ def extract_project_id(req, resp, params):
u'string. Specify the right header '
u'X-PROJECT-ID and retry.'))
api_version = LooseVersion(api_version_string)
if not params['project_id'] and api_version >= LooseVersion('v1.1'):
api_version = version.LooseVersion(api_version_string)
if (not params['project_id'] and api_version >=
version.LooseVersion('v1.1')):
raise falcon.HTTPBadRequest('Project-Id Missing',
_(u'The header X-PROJECT-ID was missing'))

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from distutils.version import LooseVersion
from distutils import version as d_version
from wsgiref import simple_server
import falcon
@ -121,7 +121,8 @@ class Driver(transport.DriverBase):
# middleware instead of it, but for the compatibility with old version,
# we support them both now. Hook way can be removed after falcon
# version must be bigger than 1.0.0 in requirements.
if LooseVersion(falcon.__version__) >= LooseVersion("1.0.0"):
if (d_version.LooseVersion(falcon.__version__) >=
d_version.LooseVersion("1.0.0")):
middleware = [FuncMiddleware(hook) for hook in self.before_hooks]
self.app = falcon.API(middleware=middleware)
else: