Fix replaced items in importer

Previously, `task.replaced_items[item]` was a `Result` instance.
This meant that iterating over these, in the plugin stage for
example, would fetch them from the database. But by then the
items had been replaced with the imported versions.

Now we instantiate the list of replaced items so that we always
get the same, old ones.
This commit is contained in:
Thomas Scholtes 2014-05-21 11:58:18 +02:00
parent b8143d2561
commit de08059da4

View file

@ -549,7 +549,7 @@ class ImportTask(object):
self.replaced_items = defaultdict(list)
for item in self.imported_items():
dup_items = lib.items(dbcore.query.BytesQuery('path', item.path))
self.replaced_items[item] = dup_items
self.replaced_items[item] = list(dup_items)
for dup_item in dup_items:
log.debug('replacing item %i: %s' %
(dup_item.id, displayable_path(item.path)))