From a671a8b4f3529df347e736f3d521f133319f228e Mon Sep 17 00:00:00 2001 From: Ekaterina Fedorova Date: Wed, 30 Apr 2014 13:25:12 +0400 Subject: [PATCH] Add fix for compatibility with SQLalchemy 0.7.9 Change-Id: I08e96281549796753d8177a232d033197674edf4 Closes-Bug: #1314540 --- muranoapi/db/catalog/api.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/muranoapi/db/catalog/api.py b/muranoapi/db/catalog/api.py index 21a136ab..95214ce5 100644 --- a/muranoapi/db/catalog/api.py +++ b/muranoapi/db/catalog/api.py @@ -260,13 +260,15 @@ def package_search(filters, context): if context.is_admin: if not include_disabled: - query = session.query(pkg).filter(pkg.enabled) + #NOTE(efedorova): is needed for SA 0.7.9, but could be done + # simpler in SA 0.8. See http://goo.gl/9stlKu for a details + query = session.query(pkg).filter(pkg.__table__.c.enabled) else: query = session.query(pkg) elif filters.get('owned', '').lower() == 'true': if not include_disabled: query = session.query(pkg).filter( - pkg.owner_id == context.tenant & pkg.enabled + (pkg.owner_id == context.tenant) & pkg.enabled ) else: query = session.query(pkg).filter(pkg.owner_id == context.tenant) @@ -274,7 +276,7 @@ def package_search(filters, context): if not include_disabled: query = session.query(pkg).filter( or_((pkg.is_public & pkg.enabled), - (pkg.owner_id == context.tenant and pkg.enabled)) + ((pkg.owner_id == context.tenant) & pkg.enabled)) ) else: query = session.query(pkg).filter(