mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 01:25:47 +01:00
map comp queries declaratively
Woohoo! More removal of special cases.
This commit is contained in:
parent
74d0dc8352
commit
d44f9f7052
2 changed files with 3 additions and 7 deletions
|
|
@ -132,8 +132,8 @@ class BooleanQuery(MatchQuery):
|
|||
"""Matches a boolean field. Pattern should either be a boolean or a
|
||||
string reflecting a boolean.
|
||||
"""
|
||||
def __init__(self, field, pattern):
|
||||
super(BooleanQuery, self).__init__(field, pattern)
|
||||
def __init__(self, field, pattern, fast=True):
|
||||
super(BooleanQuery, self).__init__(field, pattern, fast)
|
||||
if isinstance(pattern, basestring):
|
||||
self.pattern = util.str2bool(pattern)
|
||||
self.pattern = int(self.pattern)
|
||||
|
|
|
|||
|
|
@ -828,12 +828,8 @@ def construct_query_part(query_part, model_cls):
|
|||
|
||||
key = key.lower()
|
||||
|
||||
# A boolean field.
|
||||
if key.lower() == 'comp':
|
||||
return dbcore.query.BooleanQuery(key, pattern)
|
||||
|
||||
# Singleton query (not a real field).
|
||||
elif key == 'singleton':
|
||||
if key == 'singleton':
|
||||
return SingletonQuery(util.str2bool(pattern))
|
||||
|
||||
# Other field.
|
||||
|
|
|
|||
Loading…
Reference in a new issue