Merge lp:~gmb/launchpad/launchpadformify-subscribe-view-bug-651240 into lp:launchpad
Proposed by
Graham Binns
Status: | Merged |
---|---|
Approved by: | Gavin Panella |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11724 |
Proposed branch: | lp:~gmb/launchpad/launchpadformify-subscribe-view-bug-651240 |
Merge into: | lp:launchpad |
Prerequisite: | lp:~gmb/launchpad/extract-subscription-view-bug-651240 |
Diff against target: |
255 lines (+53/-88) 3 files modified
lib/lp/bugs/browser/bugsubscription.py (+48/-58) lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt (+1/-1) lib/lp/bugs/templates/bug-subscription.pt (+4/-29) |
To merge this branch: | bzr merge lp:~gmb/launchpad/launchpadformify-subscribe-view-bug-651240 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Review via email: mp+37850@code.launchpad.net |
Commit message
BugSubscription
Description of the change
This branch fixes bug 651240 by turning BugSubscription
To post a comment you must log in.
Looks good. Took me a while before I realised that it's mostly moved
code. Because of that, this is landable as-is, though my comments
below still apply.
[1]
+ if referer and referer not in ('localhost', self.request. getURL( )):
Implicit booleanism. You could express this in another way:
if referer in (None, '', 'localhost', self.request. getURL( )):
next_ url = canonical_ url(self. context)
next_ url = referer
else:
[2]
+ persons_for_user = {} ersForPerson( self.user) : for_user[ person. id] = person r_count_ for_current_ user = person_count for_user. values( )
+ person_count = 0
+ bug = self.context.bug
+ for person in bug.getSubscrib
+ if person.id not in persons_for_user:
+ persons_
+ person_count += 1
+
+ self._subscribe
+ return persons_
I think that person_count is equivalent to len(persons_ for_user) .
Having said that, _subscriber_ count_for_ current_ user doesn't appear to
be used anywhere.
Also, based on how it's used, _subscribers_ for_current_ user could be
simplified to:
@cachedproperty for_current_ user(self) : getSubscribersF orPerson( self.user) )
def _subscribers_
"""Return a dict of the subscribers for the current user."""
return set(bug.
[3]
+ 'Unsubscribe <a href="%s">%s</a> from this bug' % ( url(person) ,
+ canonical_
The canonical_ url(person) may need to be cgi.escape()d too.
[4]
+ def _isSubscription Request( self): unsubscribe input.""" 'subscription' ].hasValidInput ())
+ """Return True if the form contains subscribe/
+ return (
+ self.user and
+ self.request.method == 'POST' and
+ 'cancel' not in self.request.form and
+ self.widgets[
Could this be replaced by referring to action. submitted( )?
self.subscribe_
Actually, it doesn't seem to be used anymore.
Okay, I'll stop going through this stuff so finely as I now see that
it's mostly moved code.