Nigel Babu has proposed merging lp:~nigelbabu/launchpad/90628-spec-sub into
lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~nigelbabu/launchpad/90628-spec-sub/+merge/62003
Updated subscriptions to specifications to be sorted by name and cached.
--
https://code.launchpad.net/~nigelbabu/launchpad/90628-spec-sub/+merge/62003
Your team Launchpad code reviewers is requested to review the proposed merge of
lp:~nigelbabu/launchpad/90628-spec-sub into lp:launchpad.
=== modified file 'lib/lp/blueprints/doc/specification-notifications.txt'
--- lib/lp/blueprints/doc/specification-notifications.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/blueprints/doc/specification-notifications.txt 2011-05-23 17:32:27 +0000
@@ -63,11 +63,11 @@
>>> for subscription in svg_support.subscriptions:
... print subscription.person.preferredemail.email
+ [email protected]
+ [email protected]
[email protected]
[email protected]
- [email protected]
[email protected]
- [email protected]
Let's set a different approver and add a subscriber.
@@ -107,7 +107,6 @@
['[email protected]']
['[email protected]']
['[email protected]']
- ['[email protected]']
Now let's take a look at what the notification looks like:
=== modified file 'lib/lp/blueprints/model/specification.py'
--- lib/lp/blueprints/model/specification.py 2011-03-16 08:41:17 +0000
+++ lib/lp/blueprints/model/specification.py 2011-05-23 17:32:27 +0000
@@ -52,6 +52,7 @@
from canonical.launchpad.helpers import (
get_contact_email_addresses,
)
+from lp.services.propertycache import cachedproperty, get_property_cache
from lp.blueprints.adapters import SpecificationDelta
from lp.blueprints.enums import (
NewSpecificationDefinitionStatus,
@@ -182,7 +183,7 @@
date_started = UtcDateTimeCol(notNull=False, default=None)
# useful joins
- subscriptions = SQLMultipleJoin('SpecificationSubscription',
+ _subscriptions = SQLMultipleJoin('SpecificationSubscription',
joinColumn='specification', orderBy='id')
subscribers = SQLRelatedJoin('Person',
joinColumn='specification', otherColumn='person',
@@ -213,6 +214,11 @@
otherColumn='specification', orderBy='title',
intermediateTable='SpecificationDependency')
+ @cachedproperty
+ def subscriptions(self):
+ """Sort the subscriptions"""
+ return sorted(self._subscriptions, key=lambda sub: sub.person.displayname)
+
@property
def target(self):
"""See ISpecification."""
@@ -553,6 +559,7 @@
# see if a relevant subscription exists, and if so, delete it
for sub in self.subscriptions:
if sub.person.id == person.id:
+ get_property_cache(self).subscriptions.remove(sub)
SpecificationSubscription.delete(sub.id)
return
=== modified file 'lib/lp/blueprints/stories/standalone/subscribing.txt'
--- lib/lp/blueprints/stories/standalone/subscribing.txt 2010-12-07 01:03:17 +0000
+++ lib/lp/blueprints/stories/standalone/subscribing.txt 2011-05-23 17:32:27 +0000
@@ -273,10 +273,9 @@
... img = a_tags[0].first('img')
... print img['src'],
... print a_tags[1].string
+ /@@/subscriber-essential Andrew Bennetts
+ /@@/subscriber-inessential Dafydd Harries
/@@/subscriber-inessential Foo Bar
/@@/subscriber-essential Robert Collins
- /@@/subscriber-essential Andrew Bennetts
/@@/subscriber-inessential Stuart Bishop
- /@@/subscriber-inessential Dafydd Harries
-
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp