Sync up model_query module to neutron-lib
The implementation of method 'apply_filters' in neutron_lib.db.model_query is updated [1]. This patch sync up the neutron's side implementation. [1] https://review.openstack.org/#/c/609847/ Change-Id: I180c0813bb433088f6037ff108327fd7a119512b
This commit is contained in:
parent
79133155e1
commit
3e2e2e5577
@ -90,16 +90,8 @@ def apply_filters(query, model, filters, context=None):
|
||||
# do multiple equals matches
|
||||
query = query.filter(
|
||||
or_(*[column == v for v in value]))
|
||||
elif isinstance(value, obj_utils.StringMatchingFilterObj):
|
||||
if value.is_contains:
|
||||
query = query.filter(
|
||||
column.contains(value.contains))
|
||||
elif value.is_starts:
|
||||
query = query.filter(
|
||||
column.startswith(value.starts))
|
||||
elif value.is_ends:
|
||||
query = query.filter(
|
||||
column.endswith(value.ends))
|
||||
elif isinstance(value, obj_utils.FilterObj):
|
||||
query = query.filter(value.filter(column))
|
||||
elif None in value:
|
||||
# in_() operator does not support NULL element so we have
|
||||
# to do multiple equals matches
|
||||
|
Loading…
Reference in New Issue
Block a user