~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/bugtarget.py

  • Committer: Curtis Hovey
  • Date: 2011-06-08 13:53:29 UTC
  • mfrom: (13176 devel)
  • mto: This revision was merged to the branch mainline in revision 13177.
  • Revision ID: curtis.hovey@canonical.com-20110608135329-5bd42r7afgzcl3lt
Merged devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1405
1405
    def tags_cloud_data(self):
1406
1406
        """The data for rendering a tags cloud"""
1407
1407
        official_tags = self.context.official_bug_tags
1408
 
 
1409
 
        # Construct a dict of official and top 10 tags.
1410
 
        # getUsedBugTagsWithOpenCounts is expensive, so do the union in
1411
 
        # SQL. Also preseed with 0 for all the official tags, as gUBTWOC
1412
 
        # won't return unused ones.
1413
 
        top_ten = removeSecurityProxy(
1414
 
            self.context.getUsedBugTagsWithOpenCounts(self.user)[:10])
1415
 
        official = removeSecurityProxy(
1416
 
            self.context.getUsedBugTagsWithOpenCounts(
1417
 
                self.user, official_tags))
1418
 
        tags = dict((tag, 0) for tag in official_tags)
1419
 
        tags.update(dict(top_ten.union(official)))
1420
 
 
 
1408
        tags = self.context.getUsedBugTagsWithOpenCounts(
 
1409
            self.user, 10, official_tags)
1421
1410
        max_count = float(max([1] + tags.values()))
1422
1411
 
1423
1412
        return sorted(
1462
1451
    @property
1463
1452
    def tags_js_data(self):
1464
1453
        """Return the JSON representation of the bug tags."""
1465
 
        used_tags = dict(self.context.getUsedBugTagsWithOpenCounts(self.user))
1466
 
        official_tags = list(self.context.official_bug_tags)
 
1454
        # The model returns dict and list respectively but dumps blows up on
 
1455
        # security proxied objects.
 
1456
        used_tags = removeSecurityProxy(
 
1457
            self.context.getUsedBugTagsWithOpenCounts(self.user))
 
1458
        official_tags = removeSecurityProxy(self.context.official_bug_tags)
1467
1459
        return """<script type="text/javascript">
1468
1460
                      var used_bug_tags = %s;
1469
1461
                      var official_bug_tags = %s;