correct popularity import. close bug #17
authorymh <ymh.work@gmail.com>
Fri, 08 Jul 2011 21:22:10 +0200
changeset 81 955f1b6fa9c5
parent 80 15fb85252d88
child 82 0f2844b9ae41
correct popularity import. close bug #17
web/hdabo/fixtures/datasheet_10.yaml.bz2
web/hdabo/fixtures/datasheet_347.yaml.bz2
web/hdabo/fixtures/datasheet_all.yaml.bz2
web/hdabo/management/commands/import_tag_popularity.py
Binary file web/hdabo/fixtures/datasheet_10.yaml.bz2 has changed
Binary file web/hdabo/fixtures/datasheet_347.yaml.bz2 has changed
Binary file web/hdabo/fixtures/datasheet_all.yaml.bz2 has changed
--- a/web/hdabo/management/commands/import_tag_popularity.py	Fri Jul 08 18:13:54 2011 +0200
+++ b/web/hdabo/management/commands/import_tag_popularity.py	Fri Jul 08 21:22:10 2011 +0200
@@ -130,8 +130,9 @@
                 row = dict([(safe_decode(key, self.encoding), safe_decode(value, self.encoding)) for key, value in row.items()])
                 
                 label = normalize(row['label'].strip())
+                popularity_str = row['popularity']
                 
-                if not label:
+                if not label or not popularity_str:
                     continue
                 for tag in Tag.objects.filter(normalized_label__icontains=label):
                     tag.popularity = int(row['popularity'])