more pep fixups.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld
2012-04-27 13:12:33 +10:00
parent f7c6773542
commit 524d214b84
9 changed files with 50 additions and 37 deletions

View File

@@ -43,6 +43,8 @@ db_opts = [
#conf.db_backend = 'heat.db.sqlalchemy.api'
IMPL = heat.utils.LazyPluggable('db_backend',
sqlalchemy='heat.db.sqlalchemy.api')
def configure(conf):
global SQL_CONNECTION
global SQL_IDLE_TIMEOUT
@@ -50,7 +52,6 @@ def configure(conf):
SQL_IDLE_TIMEOUT = conf.sql_idle_timeout
def raw_template_get(context, template_id):
return IMPL.raw_template_get(context, template_id)

View File

@@ -23,6 +23,7 @@ from migrate.versioning import util as migrate_util
_REPOSITORY = None
@migrate_util.decorator
def patched_with_engine(f, *a, **kw):
url = a[0]
@@ -55,7 +56,7 @@ except ImportError:
from migrate import exceptions as versioning_exceptions
except ImportError:
sys.exit(_("python-migrate is not installed. Exiting."))
#_REPOSITORY = None
@@ -86,7 +87,7 @@ def db_version():
engine = get_engine()
meta.reflect(bind=engine)
try:
for table in ('stack', 'resource', 'event',
for table in ('stack', 'resource', 'event',
'parsed_template', 'raw_template'):
assert table in meta.tables
return db_version_control(1)

View File

@@ -26,6 +26,7 @@ _MAKER = None
class Error(Exception):
pass
class DBError(Error):
"""Wraps an implementation specific exception."""
def __init__(self, inner_exception=None):
@@ -45,6 +46,7 @@ def _wrap_db_error(f):
_wrap.func_name = f.func_name
return _wrap
def get_session(autocommit=True, expire_on_commit=False):
"""Return a SQLAlchemy session."""
global _ENGINE, _MAKER