diff options
Diffstat (limited to 'ishtar_common/management/commands/reassociate_similar_images.py')
| -rw-r--r-- | ishtar_common/management/commands/reassociate_similar_images.py | 16 | 
1 files changed, 7 insertions, 9 deletions
| diff --git a/ishtar_common/management/commands/reassociate_similar_images.py b/ishtar_common/management/commands/reassociate_similar_images.py index 0dbb3a765..9e52bc6f6 100644 --- a/ishtar_common/management/commands/reassociate_similar_images.py +++ b/ishtar_common/management/commands/reassociate_similar_images.py @@ -127,9 +127,9 @@ class Command(BaseCommand):                  for attr in attributes:                      ref_value = getattr(ref_item, attr)                      other_value = getattr(item, attr) +                    if not other_value: +                        continue                      if ref_value: -                        if not other_value: -                            continue                          if other_value != ref_value:                              if attr == 'title' and merged_title:                                  setattr(ref_item, 'title', merged_title) @@ -138,8 +138,6 @@ class Command(BaseCommand):                                      (attr, ref_value, other_value)                                  )                      else: -                        if not other_value: -                            continue                          setattr(ref_item, attr, other_value)                  base_csv = [ @@ -184,11 +182,11 @@ class Command(BaseCommand):                  item.delete()                  nb_merged_items += 1          if not quiet: -            out.write(u"\n") +            out.write("\n")          n = datetime.datetime.now().isoformat().split('.')[0].replace(':', '-')          if conflicts: -            filename = output_path + u"{}-conflict.csv".format(n) +            filename = output_path + "{}-conflict.csv".format(n)              with open(filename, 'w') as csvfile:                  writer = csv.writer(csvfile)                  writer.writerow( @@ -202,10 +200,10 @@ class Command(BaseCommand):                  for conflict in conflicts:                      writer.writerow(conflict)              if not quiet: -                out.write(u"* {} conflicted items ({})\n".format( +                out.write("* {} conflicted items ({})\n".format(                      nb_conflicted_items, filename))          if merged: -            filename = output_path + u"{}-merged.csv".format(n) +            filename = output_path + "{}-merged.csv".format(n)              with open(filename, 'w') as csvfile:                  writer = csv.writer(csvfile)                  writer.writerow( @@ -218,7 +216,7 @@ class Command(BaseCommand):                  for merge in merged:                      writer.writerow(merge)              if not quiet: -                out.write(u"* {} merged items ({})\n".format(nb_merged_items, +                out.write("* {} merged items ({})\n".format(nb_merged_items,                                                              filename))          if not quiet:              out.write("* {} distinct images\n".format(distinct_image)) | 
