Merge lp:~allenap/launchpad/subscribe-to-tag-bug-151129-6 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Данило Шеган | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 12307 | ||||
Proposed branch: | lp:~allenap/launchpad/subscribe-to-tag-bug-151129-6 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
500 lines (+181/-74) 7 files modified
lib/lp/bugs/browser/bug.py (+11/-23) lib/lp/bugs/configure.zcml (+26/-0) lib/lp/bugs/doc/bugsubscription.txt (+5/-5) lib/lp/bugs/interfaces/bug.py (+6/-0) lib/lp/bugs/model/bug.py (+61/-34) lib/lp/bugs/model/tests/test_bug.py (+20/-12) lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py (+52/-0) |
||||
To merge this branch: | bzr merge lp:~allenap/launchpad/subscribe-to-tag-bug-151129-6 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Данило Шеган (community) | Approve | ||
Review via email: mp+48295@code.launchpad.net |
Commit message
[r=danilo]
Description of the change
Some more work on infiltrating BugSubscriptionInfo into the position
of knowing all about subscriptions, and some other bits:
lib/lp/
Use the new Bug.getSubscrip
lib/lp/
Security declaration for BugSubscriptionInfo and
Bug.getSubscr
lib/lp/
BugSubscripti
so there are tuples here where there were once lists.
lib/lp/
Interface declaration for the new getSubscription
lib/lp/
Implementation of getSubscription
getDirectSubs
getSubscriber
BugSubscripti
also means that a security adapter can be selected for it. See the
changes in test_bugsubscri
I've put a lot of the design goals I had in mind for
BugSubscripti
that it's a good idea to use :)
Implementation of the duplicate_
lib/lp/
Test for getSubscription
lib/lp/
Test for the new duplicate_
Test for BugSubscriptionInfo permissions.
Hi Gavin,
This looks like a very nice refactoring branch. A few questions inline.
> === modified file 'lib/lp/ bugs/browser/ bug.py' bugs/browser/ bug.py 2011-01-18 20:49:35 +0000 bugs/browser/ bug.py 2011-02-02 11:14:58 +0000 info(self) : context) .getSubscriptio nInfo() subscribers( self):
> --- lib/lp/
> +++ lib/lp/
> @@ -414,39 +414,28 @@
> """Mix-in class to share methods between bug and portlet views."""
>
> @cachedproperty
> + def subscription_
> + return IBug(self.
> +
> + @property
> def direct_
Is the change here from @cachedproperty to @property for
direct_subscribers intentional?
> """Return the list of direct subscribers.""" (self.context) : context. getDirectSubscr ibers() ) providedBy( self.context) : context. bug.getDirectSu bscribers( )) rror( on_info. direct_ subscriptions. subscribers
> - if IBug.providedBy
> - return set(self.
> - elif IBugTask.
> - return set(self.
> - else:
> - raise NotImplementedE
> - 'direct_subscribers is not provided by %s' % self)
> + return self.subscripti
IOW, it still includes a few indirections, and subscriptions. subscribers might be expensive to evaluate.
direct_
Perhaps the code below will answer my question :)
> subscribers( self):
> - @cachedproperty
> + @property
> def duplicate_
This tells me that these are indeed intentional.
> === modified file 'lib/lp/ bugs/model/ bug.py' subscribers = ( ifiedSubscriber s(recipients, level) + subscribers = chain( ifiedSubscriber s(recipients, level), bersFromDuplica tes(recipients, level))
...
> @@ -851,8 +856,8 @@
> """
> # "Also notified" and duplicate subscribers are mutually
> # exclusive, so return both lists.
> - indirect_
> - self.getAlsoNot
> + indirect_
> + self.getAlsoNot
> self.getSubscri
I didn't know about itertools.chain, nice :)
> @@ -887,37 +892,16 @@ ibers for a description of the Level.NOTHING self).find( .person == Person.id, .bug_id == Bug.id, .bug_notificati on_level >= notification_level, getDirectSubscr ibers() ) getAlsoNotified Subscribers( )) ptionInfo( )
> See the comment in getDirectSubscr
> recipients argument.
> """
> - if self.private:
> - return []
> -
> - if level is None:
> - notification_level = BugNotification
> - else:
> - notification_level = level
> -
> - dupe_details = dict(
> - Store.of(
> - (Person, Bug),
> - BugSubscription
> - BugSubscription
> - BugSubscription
> - Bug.duplicateof == self.id))
> -
> - dupe_subscribers = set(dupe_details)
> -
> - # Direct and "also notified" subscribers take precedence over
> - # subscribers from dupes. Note that we don't supply recipients
> - # here because we are doing this to /remove/ subscribers.
> - dupe_subscribers -= set(self.
> - dupe_subscribers -= set(self.
> + info = self.getSubscri
>
> if recipients is not None:
> - for subscriber in dupe_subscribers:
> + # ...