From e2f04f224e36c16430d7f7430b05d625ca5145a1 Mon Sep 17 00:00:00 2001 From: termie Date: Wed, 18 Jan 2012 21:10:08 -0800 Subject: [PATCH] fix some imports --- keystone/catalog/core.py | 6 ------ keystone/common/sql/__init__.py | 2 +- keystone/common/sql/util.py | 2 +- keystone/common/wsgi.py | 11 ++++++++--- keystone/config.py | 2 +- keystone/contrib/ec2/backends/sql.py | 4 ---- keystone/contrib/ec2/core.py | 2 +- keystone/identity/core.py | 18 +++++++++++------- keystone/middleware/internal.py | 2 +- keystone/policy/__init__.py | 1 + keystone/policy/core.py | 2 +- keystone/test.py | 6 +++--- keystone/token/core.py | 2 +- tests/test_keystoneclient_sql.py | 4 ++-- 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/keystone/catalog/core.py b/keystone/catalog/core.py index 8177f2cffe..31e416885c 100644 --- a/keystone/catalog/core.py +++ b/keystone/catalog/core.py @@ -3,9 +3,6 @@ """Main entry point into the Catalog service.""" from keystone import config -from keystone import identity -from keystone import token -from keystone import policy from keystone.common import manager from keystone.common import wsgi @@ -31,9 +28,6 @@ class Manager(manager.Manager): class ServiceController(wsgi.Application): def __init__(self): self.catalog_api = Manager() - self.identity_api = identity.Manager() - self.token_api = token.Manager() - self.policy_api = policy.Manager() super(ServiceController, self).__init__() # CRUD extensions diff --git a/keystone/common/sql/__init__.py b/keystone/common/sql/__init__.py index c52d6cbce2..ae31c7029e 100644 --- a/keystone/common/sql/__init__.py +++ b/keystone/common/sql/__init__.py @@ -1 +1 @@ -from keystone.backends.sql.core import * +from keystone.common.sql.core import * diff --git a/keystone/common/sql/util.py b/keystone/common/sql/util.py index e96ac6c631..a181c28498 100644 --- a/keystone/common/sql/util.py +++ b/keystone/common/sql/util.py @@ -3,7 +3,7 @@ import os from keystone import config -from keystone.backends.sql import migration +from keystone.common.sql import migration CONF = config.CONF diff --git a/keystone/common/wsgi.py b/keystone/common/wsgi.py index b7b244fa6f..fafa969435 100644 --- a/keystone/common/wsgi.py +++ b/keystone/common/wsgi.py @@ -19,6 +19,7 @@ """Utility methods for working with WSGI servers.""" +import json import logging import sys @@ -31,6 +32,8 @@ import webob import webob.dec import webob.exc +from keystone.common import utils + class WritableLogger(object): """A thin wrapper that responds to `write` and logs.""" @@ -146,7 +149,7 @@ class BaseApplication(object): raise NotImplementedError('You must implement __call__') -class Application(wsgi.BaseApplication): +class Application(BaseApplication): @webob.dec.wsgify def __call__(self, req): arg_dict = req.environ['wsgiorg.routing_args'][1] @@ -375,7 +378,7 @@ class ComposingRouter(Router): super(ComposingRouter, self).__init__(mapper) -class ComposableRouter(object): +class ComposableRouter(Router): """Router that supports use by ComposingRouter.""" def __init__(self, mapper=None): @@ -394,7 +397,9 @@ class ExtensionRouter(Router): Expects to be subclassed. """ - def __init__(self, application, mapper): + def __init__(self, application, mapper=None): + if mapper is None: + mapper = routes.Mapper() self.application = application self.add_routes(mapper) mapper.connect('{path_info:.*}', controller=self.application) diff --git a/keystone/config.py b/keystone/config.py index f3064dc7be..a89c6e9031 100644 --- a/keystone/config.py +++ b/keystone/config.py @@ -5,7 +5,7 @@ import logging import sys import os -from keystone import cfg +from keystone.common import cfg gettext.install('keystone', unicode=1) diff --git a/keystone/contrib/ec2/backends/sql.py b/keystone/contrib/ec2/backends/sql.py index 3f786a6a6e..a0464ba855 100644 --- a/keystone/contrib/ec2/backends/sql.py +++ b/keystone/contrib/ec2/backends/sql.py @@ -20,10 +20,6 @@ class Ec2Credential(sql.ModelBase, sql.DictBase): class Ec2(sql.Base): - # Internal interface to manage the database - def db_sync(self): - migration.db_sync() - def get_credential(self, credential_id): session = self.get_session() credential_ref = session.query(Ec2Credential)\ diff --git a/keystone/contrib/ec2/core.py b/keystone/contrib/ec2/core.py index 1c83689c00..e12c9efce8 100644 --- a/keystone/contrib/ec2/core.py +++ b/keystone/contrib/ec2/core.py @@ -30,7 +30,7 @@ class Manager(manager.Manager): class Ec2Extension(wsgi.ExtensionRouter): - def add_routes(self, mapper) + def add_routes(self, mapper): ec2_controller = Ec2Controller() # validation mapper.connect('/ec2tokens', diff --git a/keystone/identity/core.py b/keystone/identity/core.py index 4400d7f6eb..3d46b66d41 100644 --- a/keystone/identity/core.py +++ b/keystone/identity/core.py @@ -2,8 +2,12 @@ """Main entry point into the Identity service.""" +from keystone import catalog from keystone import config -from keystone import manager +from keystone import policy +from keystone import token +from keystone.common import manager +from keystone.common import wsgi CONF = config.CONF @@ -65,9 +69,9 @@ class AdminRouter(wsgi.ComposableRouter): conditions=dict(method=['GET'])) -class TenantController(Application): +class TenantController(wsgi.Application): def __init__(self): - self.identity_api = identity.Manager() + self.identity_api = Manager() self.policy_api = policy.Manager() self.token_api = token.Manager() super(TenantController, self).__init__() @@ -148,10 +152,10 @@ class TenantController(Application): return o -class UserController(Application): +class UserController(wsgi.Application): def __init__(self): self.catalog_api = catalog.Manager() - self.identity_api = identity.Manager() + self.identity_api = Manager() self.policy_api = policy.Manager() self.token_api = token.Manager() super(UserController, self).__init__() @@ -211,10 +215,10 @@ class UserController(Application): return self.update_user(context, user_id, user) -class RoleController(Application): +class RoleController(wsgi.Application): def __init__(self): self.catalog_api = catalog.Manager() - self.identity_api = identity.Manager() + self.identity_api = Manager() self.token_api = token.Manager() self.policy_api = policy.Manager() super(RoleController, self).__init__() diff --git a/keystone/middleware/internal.py b/keystone/middleware/internal.py index ccf68b82d1..389c9bf0f8 100644 --- a/keystone/middleware/internal.py +++ b/keystone/middleware/internal.py @@ -3,7 +3,7 @@ import json from keystone import config -from keystone import wsgi +from keystone.common import wsgi CONF = config.CONF diff --git a/keystone/policy/__init__.py b/keystone/policy/__init__.py index e69de29bb2..d16de59fc2 100644 --- a/keystone/policy/__init__.py +++ b/keystone/policy/__init__.py @@ -0,0 +1 @@ +from keystone.policy.core import * diff --git a/keystone/policy/core.py b/keystone/policy/core.py index 4aa24df759..87ad743cd6 100644 --- a/keystone/policy/core.py +++ b/keystone/policy/core.py @@ -3,7 +3,7 @@ """Main entry point into the Policy service.""" from keystone import config -from keystone import manager +from keystone.common import manager CONF = config.CONF diff --git a/keystone/test.py b/keystone/test.py index b3473b5486..04502f80b3 100644 --- a/keystone/test.py +++ b/keystone/test.py @@ -11,10 +11,10 @@ from paste import deploy from keystone import catalog from keystone import config from keystone import identity -from keystone import logging from keystone import token -from keystone import utils -from keystone import wsgi +from keystone.common import logging +from keystone.common import utils +from keystone.common import wsgi ROOTDIR = os.path.dirname(os.path.dirname(__file__)) diff --git a/keystone/token/core.py b/keystone/token/core.py index d3e9a5f09a..c48ca0be05 100644 --- a/keystone/token/core.py +++ b/keystone/token/core.py @@ -3,7 +3,7 @@ """Main entry point into the Token service.""" from keystone import config -from keystone import manager +from keystone.common import manager CONF = config.CONF diff --git a/tests/test_keystoneclient_sql.py b/tests/test_keystoneclient_sql.py index 2adcc745d9..ce8ce01151 100644 --- a/tests/test_keystoneclient_sql.py +++ b/tests/test_keystoneclient_sql.py @@ -1,8 +1,8 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 from keystone import config from keystone import test -from keystone.backends.sql import util as sql_util -from keystone.backends.sql import migration +from keystone.common.sql import util as sql_util +from keystone.common.sql import migration import test_keystoneclient