~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/browser/tales.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-14 18:16:47 UTC
  • mfrom: (14515 devel)
  • mto: This revision was merged to the branch mainline in revision 14593.
  • Revision ID: launchpad@pqm.canonical.com-20111214181647-jh80eps1ndcy6hns
[rs=buildbot-poller] automatic merge from stable. Revisions: 14510,
        14511, 14512, 14513, 14514, 14515 included.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1266
1266
                self.hidden)
1267
1267
        return super(TeamFormatterAPI, self).link(view_name, rootsite)
1268
1268
 
 
1269
    def icon(self, view_name):
 
1270
        team = self._context
 
1271
        if not check_permission('launchpad.LimitedView', team):
 
1272
            css_class = ObjectImageDisplayAPI(team).sprite_css()
 
1273
            return '<span class="' + css_class + '"></span>'
 
1274
        else:
 
1275
            return super(TeamFormatterAPI, self).icon(view_name)
 
1276
 
1269
1277
    def displayname(self, view_name, rootsite=None):
1270
1278
        """See `PersonFormatterAPI`."""
1271
1279
        person = self._context
2233
2241
            return self.exactduration()
2234
2242
        elif name == 'approximateduration':
2235
2243
            return self.approximateduration()
 
2244
        elif name == 'millisecondduration':
 
2245
            return self.millisecondduration()
2236
2246
        else:
2237
2247
            raise TraversalError(name)
2238
2248
 
2378
2388
        weeks = int(round(seconds / (7 * 24 * 3600.0)))
2379
2389
        return "%d weeks" % weeks
2380
2390
 
 
2391
    def millisecondduration(self):
 
2392
        return str(
 
2393
            (self._duration.days * 24 * 3600
 
2394
             + self._duration.seconds * 1000
 
2395
             + self._duration.microseconds // 1000)) + 'ms'
 
2396
 
2381
2397
 
2382
2398
class LinkFormatterAPI(ObjectFormatterAPI):
2383
2399
    """Adapter from Link objects to a formatted anchor."""