fix construction of conditional path queries

I broke this in the last flurry of refactors but, as is usually the case, I
have no idea why it ever worked before.
This commit is contained in:
Adrian Sampson 2013-03-14 11:05:35 -07:00
parent d0e9e3db1e
commit fe8092139b
2 changed files with 6 additions and 7 deletions

View file

@ -590,10 +590,9 @@ class CollectionQuery(Query):
return clause, subvals
@classmethod
def from_strings(cls, query_parts, default_fields=None,
all_keys=ITEM_KEYS):
def from_strings(cls, query_parts, default_fields, all_keys):
"""Creates a query from a list of strings in the format used by
_parse_query_part. If default_fields are specified, they are the
parse_query_part. If default_fields are specified, they are the
fields to be searched by unqualified search terms. Otherwise,
all fields are searched for those terms.
"""
@ -607,7 +606,8 @@ class CollectionQuery(Query):
return cls(subqueries)
@classmethod
def from_string(cls, query, default_fields=None, all_keys=ITEM_KEYS):
def from_string(cls, query, default_fields=ITEM_DEFAULT_FIELDS,
all_keys=ITEM_KEYS):
"""Creates a query based on a single string. The string is split
into query parts using shell-style syntax.
"""
@ -617,8 +617,7 @@ class CollectionQuery(Query):
if isinstance(query, unicode):
query = query.encode('utf8')
parts = [s.decode('utf8') for s in shlex.split(query)]
return cls.from_strings(parts, default_fields=default_fields,
all_keys=all_keys)
return cls.from_strings(parts, default_fields, all_keys)
class AnyFieldQuery(CollectionQuery):
"""A query that matches if a given FieldQuery subclass matches in

View file

@ -20,7 +20,7 @@ import _common
from _common import unittest
import beets.library
pqp = beets.library.CollectionQuery._parse_query_part
pqp = beets.library.parse_query_part
some_item = _common.item()