diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-09-08 01:52:10 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-09-08 01:52:10 -0700 |
| commit | 1ddc8cde319a70479bb22b4d3e7176d69e206bb2 (patch) | |
| tree | 9fe88ae59e5fe3be852b5349032afe3b9e8f0138 | |
| parent | de5af510a1621d4a2f665e894f1d56189c43d818 (diff) | |
| parent | f8a970e98bcef40142dee39642320f1cab5a78aa (diff) | |
| download | nova-1ddc8cde319a70479bb22b4d3e7176d69e206bb2.tar.gz nova-1ddc8cde319a70479bb22b4d3e7176d69e206bb2.tar.xz nova-1ddc8cde319a70479bb22b4d3e7176d69e206bb2.zip | |
merged orm
| -rw-r--r-- | nova/db/sqlalchemy/models.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index fe3a77a52..960b7089b 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -55,18 +55,18 @@ class NovaBase(object): """Get all objects of this type""" if not session: session = get_session() - return session.query(cls) \ - .filter_by(deleted=False) \ - .all() + return session.query(cls + ).filter_by(deleted=False + ).all() @classmethod def count(cls, session=None): """Count objects of this type""" if not session: session = get_session() - return session.query(cls) \ - .filter_by(deleted=False) \ - .count() + return session.query(cls + ).filter_by(deleted=False + ).count() @classmethod def find(cls, obj_id, session=None): @@ -74,10 +74,10 @@ class NovaBase(object): if not session: session = get_session() try: - return session.query(cls) \ - .filter_by(id=obj_id) \ - .filter_by(deleted=False) \ - .one() + return session.query(cls + ).filter_by(id=obj_id + ).filter_by(deleted=False + ).one() except exc.NoResultFound: new_exc = exception.NotFound("No model for id %s" % obj_id) raise new_exc.__class__, new_exc, sys.exc_info()[2] @@ -170,10 +170,10 @@ class Service(BASE, NovaBase): if not session: session = get_session() try: - return session.query(cls) \ - .filter_by(host=host) \ - .filter_by(binary=binary) \ - .filter_by(deleted=False) \ + return session.query(cls + ).filter_by(host=host + ).filter_by(binary=binary + ).filter_by(deleted=False .one() except exc.NoResultFound: new_exc = exception.NotFound("No model for %s, %s" % (host, @@ -335,9 +335,9 @@ class FixedIp(BASE, NovaBase): if not session: session = get_session() try: - return session.query(cls) \ - .filter_by(address=str_id) \ - .filter_by(deleted=False) \ + return session.query(cls + ).filter_by(address=str_id + ).filter_by(deleted=False .one() except exc.NoResultFound: new_exc = exception.NotFound("No model for address %s" % str_id) @@ -364,9 +364,9 @@ class FloatingIp(BASE, NovaBase): if not session: session = get_session() try: - return session.query(cls) \ - .filter_by(address=str_id) \ - .filter_by(deleted=False) \ + return session.query(cls + ).filter_by(address=str_id + ).filter_by(deleted=False .one() except exc.NoResultFound: session.rollback() |
