# HG changeset patch # User ymh # Date 1310141616 -7200 # Node ID 949e319fbaa09cae34c9820b4746a4d4e57fd08e # Parent 149cf0d19b10ac35323e69d040b405ea99d3f52a Correction pb import popularité ; bug #17 diff -r 149cf0d19b10 -r 949e319fbaa0 web/hdabo/management/commands/import_tag_popularity.py --- a/web/hdabo/management/commands/import_tag_popularity.py Fri Jul 08 16:34:01 2011 +0200 +++ b/web/hdabo/management/commands/import_tag_popularity.py Fri Jul 08 18:13:36 2011 +0200 @@ -10,6 +10,7 @@ from django.core.management.base import BaseCommand, CommandError from hdabo.models import Tag +from hdabo.utils import normalize from optparse import make_option import csv import math @@ -128,11 +129,10 @@ row = dict([(safe_decode(key, self.encoding), safe_decode(value, self.encoding)) for key, value in row.items()]) - label = row['label'].strip() + label = normalize(row['label'].strip()) if not label: continue - - for tag in Tag.objects.filter(label__iexact=label): + for tag in Tag.objects.filter(normalized_label__icontains=label): tag.popularity = int(row['popularity']) tag.save()