utils.calculate_cloud() can leave font_size unset for most frequent tag

Bug #367214 reported by Rob van der Linde
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-django-tagging (Ubuntu)
Fix Released
Low
Krzysztof Klimonda
Jaunty
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: python-django-tagging

Current version of package ``python-django-tagging'' has a long standing bug in a _calculate_tag_weight() method.

When a programmer creates tag cloud using method util.calculate_cloud() or Tag.objects.cloud_for_model() and sets distribution argument to ``LOGARITHMIC'' (or leave it empty as it is default value) _calculate_tag_weight() in some cases may return result which is greater than max_weight - because of that Tag object (the one most frequently used in model) will be missing argument ``font_size'' and throw AttributeError exception. It happens because of the way a floating point division is done in Python.

The proposed patch address this issue by returning ``max_weight'' in case when result of computation is greater than it.

I'm attaching a testcase in a form of a django project. To use it you must install python-django-tagging and then from project root execute ``./manage.py test''. AssertionError will be thrown. After fixing this issue test passes.

A link to upstream bugreport: http://code.google.com/p/django-tagging/issues/detail?id=91

Revision history for this message
Rob van der Linde (robvdl) wrote :
Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :

I'll ask MOTU if this bug qualifies for a SRU. In the meantime could You provide a test case that illustrates it?

Changed in python-django-tagging (Ubuntu):
assignee: nobody → kklimonda
Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :
description: updated
summary: - utils.calculate_cloud can leave font_size unset for most frequent tag
+ utils.calculate_cloud() can leave font_size unset for most frequent tag
Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :
Revision history for this message
John Dong (jdong) wrote :

ACK from MOTU-SRU.

Changed in python-django-tagging (Ubuntu Jaunty):
status: New → Confirmed
Revision history for this message
Scott Kitterman (kitterman) wrote :

Accepted into jaunty-proposed, the package will build now and be available in a few hours.Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in python-django-tagging (Ubuntu Jaunty):
status: Confirmed → Fix Committed
tags: added: verification-needed
Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :

I've tested updated package using my testcase in clean jaunty environment and it fixes the issue. More feedback would be great. :)

Changed in python-django-tagging (Ubuntu):
assignee: Krzysztof Klimonda (kklimonda) → nobody
C de-Avillez (hggdh2)
Changed in python-django-tagging (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :

This bug will be fixed in KK when sync (LP #373845) is done.

Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :

As sync is impossible I'm attaching a debdiff against python-django-tagging_0.2.1+svn154-0ubuntu2 for KK (It's the same as previous with changed release name.

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-django-tagging - 0.2.1+svn154-0ubuntu2.1

---------------
python-django-tagging (0.2.1+svn154-0ubuntu2.1) jaunty-proposed; urgency=low

  * debian/patches/02_fix_calculate_tag_weight.patch: Fix error in
    _calculate_tag_weight which in some cases may lead to font_size
    attribute of most frequent used tag set to None. (LP: #367214)

 -- Krzysztof Klimonda <email address hidden> Sun, 26 Apr 2009 23:39:17 +0200

Changed in python-django-tagging (Ubuntu Jaunty):
status: Fix Committed → Fix Released
Martin Pitt (pitti)
Changed in python-django-tagging (Ubuntu):
assignee: nobody → Krzysztof Klimonda (kklimonda)
status: Triaged → Fix Committed
Revision history for this message
Daniel Holbach (dholbach) wrote :

Uploaded. Maybe you can make use of https://wiki.ubuntu.com/UbuntuDevelopment/PatchTaggingGuidelines the next time? :-)

Changed in python-django-tagging (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.