~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/blueprints/model/specification.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-21 23:51:38 UTC
  • mfrom: (13147.2.7 spec-sub-sort)
  • Revision ID: launchpad@pqm.canonical.com-20110721235138-l6mgvfsiarrzvq3k
[r=allenap, lifeless, mbp,
        wallyworld][bug=792129] Display specification subscribers sorted with
        person_sort_key, which is not case-sensitive among other things.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
    )
97
97
 
98
98
 
 
99
 
99
100
def recursive_blocked_query(spec):
100
101
    return """
101
102
        RECURSIVE blocked(id) AS (
221
222
    @cachedproperty
222
223
    def subscriptions(self):
223
224
        """Sort the subscriptions"""
 
225
        from lp.registry.model.person import person_sort_key
224
226
        return sorted(
225
 
            self._subscriptions, key=lambda sub: sub.person.displayname)
 
227
            self._subscriptions, key=lambda sub: person_sort_key(sub.person))
226
228
 
227
229
    @property
228
230
    def target(self):
561
563
            person=person, essential=essential)
562
564
        property_cache = get_property_cache(self)
563
565
        if 'subscription' in property_cache:
 
566
            from lp.registry.model.person import person_sort_key
564
567
            property_cache.subscriptions.append(sub)
565
568
            property_cache.subscriptions.sort(
566
 
                key=lambda sub: sub.person.displayname)
 
569
                key=lambda sub: person_sort_key(sub.person))
567
570
        notify(ObjectCreatedEvent(sub, user=subscribed_by))
568
571
        return sub
569
572