Add fix for compatibility with SQLalchemy 0.7.9

Change-Id: I08e96281549796753d8177a232d033197674edf4
Closes-Bug: #1314540
This commit is contained in:
Ekaterina Fedorova 2014-04-30 13:25:12 +04:00
parent 531e334610
commit a671a8b4f3

View File

@ -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(