Remove unused db engine variable in api

This patch removes the unused db engine variable passed in each request
in the API

Change-Id: I8e939b6f37ec3021b05c99e8b889ec16dfc6af2b
This commit is contained in:
Mehdi Abaakouk 2014-01-27 13:14:35 +01:00
parent 9afba7255c
commit 6e8b33cbe4
3 changed files with 3 additions and 9 deletions

View File

@ -53,12 +53,10 @@ def get_pecan_config():
def setup_app(pecan_config=None, extra_hooks=None):
storage_engine = storage.get_engine(cfg.CONF)
# FIXME: Replace DBHook with a hooks.TransactionHook
app_hooks = [hooks.ConfigHook(),
hooks.DBHook(
storage_engine,
storage_engine.get_connection(cfg.CONF),
storage.get_connection(cfg.CONF),
),
hooks.PipelineHook(),
hooks.TranslationHook()]

View File

@ -37,12 +37,10 @@ class ConfigHook(hooks.PecanHook):
class DBHook(hooks.PecanHook):
def __init__(self, storage_engine, storage_connection):
self.storage_engine = storage_engine
def __init__(self, storage_connection):
self.storage_connection = storage_connection
def before(self, state):
state.request.storage_engine = self.storage_engine
state.request.storage_conn = self.storage_connection

View File

@ -53,10 +53,8 @@ def make_app(conf, enable_acl=True, attach_storage=True,
if attach_storage:
@app.before_request
def attach_storage():
storage_engine = storage.get_engine(conf)
flask.request.storage_engine = storage_engine
flask.request.storage_conn = \
storage_engine.get_connection(conf)
storage.get_connection(conf)
# Install the middleware wrapper
if enable_acl: