From fe8092139b6eeb6c98b2c9ecb276ab944e1b61de Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 14 Mar 2013 11:05:35 -0700 Subject: [PATCH] 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. --- beets/library.py | 11 +++++------ test/test_query.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/beets/library.py b/beets/library.py index e33c5cbcd..29d1a6966 100644 --- a/beets/library.py +++ b/beets/library.py @@ -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 diff --git a/test/test_query.py b/test/test_query.py index 5c29ab03f..54b30cf1e 100644 --- a/test/test_query.py +++ b/test/test_query.py @@ -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()