Skip to content

Commit 4c5b508

Browse files
committed
Avoid overeager inclusion of album attributes
1 parent 0c7c586 commit 4c5b508

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

beets/dbcore/db.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ class FormattedMapping(Mapping):
5656
are replaced.
5757
"""
5858

59-
def __init__(self, model, for_path=False):
59+
def __init__(self, model, for_path=False, compute_keys=True):
6060
self.for_path = for_path
6161
self.model = model
62-
self.model_keys = model.keys(True)
62+
if compute_keys:
63+
self.model_keys = model.keys(True)
6364

6465
def __getitem__(self, key):
6566
if key in self.model_keys:

beets/library.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ class FormattedItemMapping(dbcore.db.FormattedMapping):
375375
"""
376376

377377
def __init__(self, item, for_path=False):
378-
super(FormattedItemMapping, self).__init__(item, for_path)
378+
super(FormattedItemMapping, self).__init__(item, for_path, compute_keys=False)
379379
# We treat album and item keys specially here,
380380
# so exclude transitive album keys from the model's keys.
381381
self.model_keys = item.keys(computed=True, with_album=False)

0 commit comments

Comments
 (0)