launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01751
[Merge] lp:~lifeless/launchpad/mentoring into lp:launchpad/devel
Robert Collins has proposed merging lp:~lifeless/launchpad/mentoring into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Delete unused code (it may have test fallout, but I don't think so). Two possibly unused methods have been retained because they need some careful analysis to see if they are actually unused- but I explained that in their docstrings.
--
https://code.launchpad.net/~lifeless/launchpad/mentoring/+merge/39721
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/launchpad/mentoring into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/browser/__init__.py'
--- lib/canonical/launchpad/browser/__init__.py 2010-10-13 06:00:09 +0000
+++ lib/canonical/launchpad/browser/__init__.py 2010-10-31 22:33:49 +0000
@@ -46,7 +46,6 @@
from lp.registry.browser.featuredproject import *
from lp.registry.browser.karma import *
from lp.registry.browser.mailinglists import *
-from lp.registry.browser.mentoringoffer import *
from lp.registry.browser.objectreassignment import *
from lp.registry.browser.peoplemerge import *
from lp.registry.browser.poll import *
=== modified file 'lib/canonical/launchpad/browser/launchpad.py'
--- lib/canonical/launchpad/browser/launchpad.py 2010-10-29 03:10:42 +0000
+++ lib/canonical/launchpad/browser/launchpad.py 2010-10-31 22:33:49 +0000
@@ -131,7 +131,6 @@
from lp.registry.interfaces.codeofconduct import ICodeOfConductSet
from lp.registry.interfaces.distribution import IDistributionSet
from lp.registry.interfaces.karma import IKarmaActionSet
-from lp.registry.interfaces.mentoringoffer import IMentoringOfferSet
from lp.registry.interfaces.person import IPersonSet
from lp.registry.interfaces.pillar import IPillarNameSet
from lp.registry.interfaces.product import (
@@ -584,7 +583,6 @@
'karmaaction': IKarmaActionSet,
'+imports': ITranslationImportQueue,
'+languages': ILanguageSet,
- '+mentoring': IMentoringOfferSet,
'package-sets': IPackagesetSet,
'people': IPersonSet,
'pillars': IPillarNameSet,
=== modified file 'lib/canonical/launchpad/doc/badges.txt'
--- lib/canonical/launchpad/doc/badges.txt 2010-10-03 15:30:06 +0000
+++ lib/canonical/launchpad/doc/badges.txt 2010-10-31 22:33:49 +0000
@@ -11,7 +11,7 @@
In the object listing views, badges are used to show links between
objects, such as bug-branch links or bug-spec links, and object
-attribute values such as privacy or mentoring availability.
+attribute values such as privacy.
Listings use small icon sized images, and object details pages use
larger logo sized images.
@@ -29,7 +29,6 @@
blueprint
branch
bug
- mentoring
mergeproposal
patch
private
=== modified file 'lib/canonical/launchpad/doc/sample-data-assertions.txt'
--- lib/canonical/launchpad/doc/sample-data-assertions.txt 2010-10-10 15:39:28 +0000
+++ lib/canonical/launchpad/doc/sample-data-assertions.txt 2010-10-31 22:33:49 +0000
@@ -31,44 +31,3 @@
>>> one_membership = personset.getByName('one-membership')
>>> for t in one_membership.team_memberships: print t.team.displayname
Simple Team
-
-
-== Mentorship Page Tests ==
-
-We will use bugs #2 and #8 and a specific blueprint as the test vehicles
-for the mentoring set of pagetests. Bug #2 should be incomplete, and bug #8
-complete. The specification should be incomplete too. Finally, Bug #6
-should be a duplicate, and should be incomplete.
-
- >>> from zope.component import getUtility
- >>> from lp.bugs.interfaces.bug import IBugSet
- >>> from lp.registry.interfaces.distribution import IDistributionSet
- >>> bugset = getUtility(IBugSet)
- >>> distroset = getUtility(IDistributionSet)
- >>> from canonical.launchpad.ftests import login
- >>> login('no-priv@xxxxxxxxxxxxx')
- >>> b2 = bugset.get(2)
- >>> b2.is_complete
- False
- >>> b8 = bugset.get(8)
- >>> b8.is_complete
- True
- >>> b6 = bugset.get(6)
- >>> b6.is_complete
- False
- >>> b6.duplicateof is not None
- True
- >>> kubuntu = distroset.getByName('kubuntu')
- >>> cluster_blueprint = kubuntu.getSpecification('cluster-installation')
- >>> cluster_blueprint.is_complete
- False
-
-There should be no mentorships on any of these.
-
- >>> b2.mentoring_offers.count()
- 0
- >>> b8.mentoring_offers.count()
- 0
- >>> cluster_blueprint.mentoring_offers.count()
- 0
-
=== modified file 'lib/canonical/launchpad/icing/icon-sprites.positioning'
--- lib/canonical/launchpad/icing/icon-sprites.positioning 2010-06-11 18:39:35 +0000
+++ lib/canonical/launchpad/icing/icon-sprites.positioning 2010-10-31 22:33:49 +0000
@@ -245,10 +245,6 @@
0,
-6228
],
- "../images/mentoring.png": [
- 0,
- -7048
- ],
"../images/flame-large.png": [
0,
-16976
@@ -453,10 +449,6 @@
0,
-1968
],
- "../images/mentoring-large.png": [
- 0,
- -17704
- ],
"../images/bug.png": [
0,
-4260
@@ -477,4 +469,4 @@
0,
-1148
]
-}
\ No newline at end of file
+}
=== modified file 'lib/canonical/launchpad/icing/style-3-0.css.in'
--- lib/canonical/launchpad/icing/style-3-0.css.in 2010-10-19 03:26:47 +0000
+++ lib/canonical/launchpad/icing/style-3-0.css.in 2010-10-31 22:33:49 +0000
@@ -2062,10 +2062,6 @@
background-image: url(/@@/person-inactive-badge.png); /* sprite-ref: icon-sprites */
background-repeat: no-repeat;
}
-.mentoring {
- background-image: url(/@@/mentoring.png); /* sprite-ref: icon-sprites */
- background-repeat: no-repeat;
- }
.undecided {
background-image: url(/@@/maybe.png); /* sprite-ref: icon-sprites */
background-repeat: no-repeat;
@@ -2324,10 +2320,6 @@
background-image: url(/@@/launchpad-large.png); /* sprite-ref: icon-sprites */
background-repeat: no-repeat;
}
-.large-mentoring {
- background-image: url(/@@/mentoring-large.png); /* sprite-ref: icon-sprites */
- background-repeat: no-repeat;
- }
.large-proposal {
background-image: url(/@@/merge-proposal-large.png); /* sprite-ref: icon-sprites */
background-repeat: no-repeat;
=== modified file 'lib/canonical/launchpad/interfaces/__init__.py'
--- lib/canonical/launchpad/interfaces/__init__.py 2010-10-19 03:26:47 +0000
+++ lib/canonical/launchpad/interfaces/__init__.py 2010-10-31 22:33:49 +0000
@@ -90,7 +90,6 @@
from canonical.launchpad.interfaces.mailbox import *
from lp.registry.interfaces.mailinglist import *
from lp.registry.interfaces.mailinglistsubscription import *
-from lp.registry.interfaces.mentoringoffer import *
from canonical.launchpad.interfaces.message import *
from lp.registry.interfaces.milestone import *
from canonical.launchpad.interfaces.oauth import *
=== modified file 'lib/canonical/launchpad/templates/launchpad-graphics.pt'
--- lib/canonical/launchpad/templates/launchpad-graphics.pt 2010-05-22 02:59:19 +0000
+++ lib/canonical/launchpad/templates/launchpad-graphics.pt 2010-10-31 22:33:49 +0000
@@ -473,17 +473,6 @@
<td><img alt="" src="/@@/meeting-mugshot" /></td>
</tr>
<tr>
- <td>mentoring</td>
- <td><img alt="" src="/@@/mentoring" /></td>
- <td rowspan="2">A bug or blueprint for which mentoring has been
- offered.
- </td>
- </tr>
- <tr>
- <td>mentoring-large</td>
- <td><img alt="" src="/@@/mentoring-large" /></td>
- </tr>
- <tr>
<td>milestone</td>
<td><img alt="" src="/@@/milestone" /></td>
<td>A "target". This indicates a development milestone to which a
=== modified file 'lib/canonical/launchpad/webapp/badge.py'
--- lib/canonical/launchpad/webapp/badge.py 2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/webapp/badge.py 2010-10-31 22:33:49 +0000
@@ -79,9 +79,6 @@
'security': Badge('/@@/security', '/@@/security-large',
'(Security vulnerability)', 'Security vulnerability',
'securitybadge'),
- 'mentoring': Badge('/@@/mentoring', '/@@/mentoring-large',
- '(Mentoring available)', 'Mentoring available',
- 'mentoringbadge'),
'mergeproposal': Badge('/@@/merge-proposal-icon',
'/@@/merge-proposal-large',
'(Has a merge proposal)', 'Has a merge proposal',
=== modified file 'lib/lp/app/browser/tales.py'
--- lib/lp/app/browser/tales.py 2010-10-03 15:30:06 +0000
+++ lib/lp/app/browser/tales.py 2010-10-31 22:33:49 +0000
@@ -832,10 +832,6 @@
return self.icon_template % (alt, title, css)
- def _hasMentoringOffer(self):
- """Return whether the bug has a mentoring offer."""
- return self._context.bug.mentoring_offers.count() > 0
-
def _hasBugBranch(self):
"""Return whether the bug has a branch linked to it."""
return self._context.bug.linked_branches.count() > 0
@@ -854,10 +850,6 @@
badges.append(self.icon_template % (
"private", "Private", "sprite private"))
- if self._hasMentoringOffer():
- badges.append(self.icon_template % (
- "mentoring", "Mentoring offered", "sprite mentoring"))
-
if self._hasBugBranch():
badges.append(self.icon_template % (
"branch", "Branch exists", "sprite branch"))
@@ -890,10 +882,6 @@
accessed.
"""
- def _hasMentoringOffer(self):
- """See `BugTaskImageDisplayAPI`"""
- return self._context.has_mentoring_offer
-
def _hasBugBranch(self):
"""See `BugTaskImageDisplayAPI`"""
return self._context.has_bug_branch
@@ -936,9 +924,6 @@
def badges(self):
badges = ''
- if self._context.mentoring_offers.count() > 0:
- badges += self.icon_template % (
- "mentoring", "Mentoring offered", "sprite mentoring")
if self._context.linked_branches.count() > 0:
badges += self.icon_template % (
=== modified file 'lib/lp/blueprints/interfaces/specification.py'
--- lib/lp/blueprints/interfaces/specification.py 2010-10-03 15:30:06 +0000
+++ lib/lp/blueprints/interfaces/specification.py 2010-10-31 22:33:49 +0000
@@ -53,7 +53,6 @@
from lp.blueprints.interfaces.specificationtarget import IHasSpecifications
from lp.blueprints.interfaces.sprint import ISprint
from lp.code.interfaces.branchlink import IHasLinkedBranches
-from lp.registry.interfaces.mentoringoffer import ICanBeMentored
from lp.registry.interfaces.projectgroup import IProjectGroup
from lp.registry.interfaces.role import IHasOwner
from lp.services.fields import (
@@ -655,7 +654,7 @@
class ISpecification(INewSpecification, INewSpecificationTarget, IHasOwner,
- ICanBeMentored, IHasLinkedBranches):
+ IHasLinkedBranches):
"""A Specification."""
export_as_webservice_entry()
=== modified file 'lib/lp/blueprints/model/specification.py'
--- lib/lp/blueprints/model/specification.py 2010-10-03 15:30:06 +0000
+++ lib/lp/blueprints/model/specification.py 2010-10-31 22:33:49 +0000
@@ -83,7 +83,6 @@
from lp.registry.interfaces.distroseries import IDistroSeries
from lp.registry.interfaces.person import validate_public_person
from lp.registry.interfaces.productseries import IProductSeries
-from lp.registry.model.mentoringoffer import MentoringOffer
class Specification(SQLBase, BugLinkTargetMixin):
@@ -155,8 +154,6 @@
date_started = UtcDateTimeCol(notNull=False, default=None)
# useful joins
- mentoring_offers = SQLMultipleJoin(
- 'MentoringOffer', joinColumn='specification', orderBy='id')
subscriptions = SQLMultipleJoin('SpecificationSubscription',
joinColumn='specification', orderBy='id')
subscribers = SQLRelatedJoin('Person',
@@ -291,45 +288,6 @@
specification=self, reviewer=person)
return fb.prejoin(['requester'])
- def canMentor(self, user):
- """See ICanBeMentored."""
- if user is None:
- return False
- if self.is_complete:
- return False
- if bool(self.isMentor(user)):
- return False
- if not user.teams_participated_in:
- return False
- return True
-
- def isMentor(self, user):
- """See ICanBeMentored."""
- return MentoringOffer.selectOneBy(
- specification=self, owner=user) is not None
-
- def offerMentoring(self, user, team):
- """See ICanBeMentored."""
- # if an offer exists, then update the team
- mentoringoffer = MentoringOffer.selectOneBy(
- specification=self, owner=user)
- if mentoringoffer is not None:
- mentoringoffer.team = team
- return mentoringoffer
- # if no offer exists, create one from scratch
- mentoringoffer = MentoringOffer(owner=user, team=team,
- specification=self)
- notify(ObjectCreatedEvent(mentoringoffer, user=user))
- return mentoringoffer
-
- def retractMentoring(self, user):
- """See ICanBeMentored."""
- mentoringoffer = MentoringOffer.selectOneBy(
- specification=self, owner=user)
- if mentoringoffer is not None:
- notify(ObjectDeletedEvent(mentoringoffer, user=user))
- MentoringOffer.delete(mentoringoffer.id)
-
def notificationRecipientAddresses(self):
"""See ISpecification."""
related_people = [
=== modified file 'lib/lp/bugs/browser/bug.py'
--- lib/lp/bugs/browser/bug.py 2010-10-20 16:30:03 +0000
+++ lib/lp/bugs/browser/bug.py 2010-10-31 22:33:49 +0000
@@ -209,8 +209,7 @@
links = ['editdescription', 'markduplicate', 'visibility', 'addupstream',
'adddistro', 'subscription', 'addsubscriber', 'addcomment',
'nominate', 'addbranch', 'linktocve', 'unlinkcve',
- 'offermentoring', 'retractmentoring', 'createquestion',
- 'removequestion', 'activitylog', 'affectsmetoo']
+ 'createquestion', 'removequestion', 'activitylog', 'affectsmetoo']
def __init__(self, context):
# Always force the context to be the current bugtask, so that we don't
@@ -306,20 +305,6 @@
text = 'Remove CVE link'
return Link('+unlinkcve', text, icon='remove', enabled=enabled)
- def offermentoring(self):
- """Return the 'Offer mentorship' Link."""
- text = 'Offer mentorship'
- user = getUtility(ILaunchBag).user
- enabled = False
- return Link('+mentor', text, icon='add', enabled=enabled)
-
- def retractmentoring(self):
- """Return the 'Retract mentorship' Link."""
- text = 'Retract mentorship'
- user = getUtility(ILaunchBag).user
- enabled = False
- return Link('+retractmentoring', text, icon='remove', enabled=enabled)
-
@property
def _bug_question(self):
return self.context.bug.getQuestionCreatedFromBug()
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-10-18 01:06:18 +0000
+++ lib/lp/bugs/browser/bugtask.py 2010-10-31 22:33:49 +0000
@@ -240,7 +240,6 @@
from lp.bugs.interfaces.bugwatch import BugWatchActivityStatus
from lp.bugs.interfaces.cve import ICveSet
from lp.bugs.interfaces.malone import IMaloneApplication
-from lp.registry.browser.mentoringoffer import CanBeMentoredView
from lp.registry.interfaces.distribution import IDistribution
from lp.registry.interfaces.distributionsourcepackage import (
IDistributionSourcePackage,
@@ -620,8 +619,7 @@
return view.render()
-class BugTaskView(LaunchpadView, BugViewMixin, CanBeMentoredView,
- FeedsMixin):
+class BugTaskView(LaunchpadView, BugViewMixin, FeedsMixin):
"""View class for presenting information about an `IBugTask`."""
override_title_breadcrumbs = True
@@ -2086,12 +2084,11 @@
"""
delegates(IBugTask, 'bugtask')
- def __init__(self, bugtask, has_mentoring_offer, has_bug_branch,
+ def __init__(self, bugtask, has_bug_branch,
has_specification, has_patch, request=None,
target_context=None):
self.bugtask = bugtask
self.review_action_widget = None
- self.has_mentoring_offer = has_mentoring_offer
self.has_bug_branch = has_bug_branch
self.has_specification = has_specification
self.has_patch = has_patch
@@ -2141,7 +2138,6 @@
target_context = self.target_context
return BugTaskListingItem(
bugtask,
- badge_property['has_mentoring_offer'],
badge_property['has_branch'],
badge_property['has_specification'],
badge_property['has_patch'],
=== modified file 'lib/lp/bugs/browser/cvereport.py'
--- lib/lp/bugs/browser/cvereport.py 2010-08-24 10:45:57 +0000
+++ lib/lp/bugs/browser/cvereport.py 2010-10-31 22:33:49 +0000
@@ -79,7 +79,6 @@
# queries being issues when trying to render the badges.
bugtask = BugTaskListingItem(
bugtask,
- has_mentoring_offer=badges['has_mentoring_offer'],
has_bug_branch=badges['has_branch'],
has_specification=badges['has_specification'],
has_patch=badges['has_patch'])
=== modified file 'lib/lp/bugs/configure.zcml'
--- lib/lp/bugs/configure.zcml 2010-10-25 13:02:15 +0000
+++ lib/lp/bugs/configure.zcml 2010-10-31 22:33:49 +0000
@@ -196,8 +196,6 @@
bug_subscribers
is_complete
canTransitionToStatus
- isMentor
- canMentor
isSubscribed
getPackageComponent
userCanEditImportance
@@ -257,11 +255,6 @@
<require
permission="launchpad.Edit"
set_attributes="product productseries sourcepackagename distribution distroseries milestone statusexplanation importance bugwatch datecreated age owner targetname title related_tasks statusdisplayhtml statuselsewhere setStatusFromDebbugs setImportanceFromDebbugs"/>
- <require
- permission="launchpad.AnyPerson"
- attributes="
- offerMentoring
- retractMentoring"/>
</class>
<adapter
provides="canonical.lazr.interfaces.IObjectPrivacy"
@@ -646,9 +639,6 @@
getDirectSubscribers
getDirectSubscriptions
getIndirectSubscribers
- mentoring_offers
- canMentor
- isMentor
getNullBugTask
is_complete
official_tags
@@ -779,11 +769,6 @@
title description
who_made_private"/>
<require
- permission="launchpad.AnyPerson"
- attributes="
- offerMentoring
- retractMentoring"/>
- <require
permission="launchpad.Admin"
attributes="
setCommentVisibility
=== modified file 'lib/lp/bugs/doc/bugtask.txt'
--- lib/lp/bugs/doc/bugtask.txt 2010-10-22 19:23:14 +0000
+++ lib/lp/bugs/doc/bugtask.txt 2010-10-31 22:33:49 +0000
@@ -1236,22 +1236,13 @@
>>> print_badge_properties(badge_properties)
Properties for bug 2:
has_branch: False
- has_mentoring_offer: False
has_patch: False
has_specification: False
Properties for bug 3:
has_branch: False
- has_mentoring_offer: False
has_patch: False
has_specification: False
-If a mentoring offer gets made...
-
- >>> no_priv = getUtility(IPersonSet).getByName('no-priv')
- >>> ubuntu_team = getUtility(IPersonSet).getByName('ubuntu-team')
- >>> bug_two.offerMentoring(no_priv, ubuntu_team)
- <MentoringOffer at ...>
-
..., a specification gets linked...
>>> from lp.blueprints.interfaces.specification import ISpecificationSet
@@ -1272,12 +1263,10 @@
>>> print_badge_properties(badge_properties)
Properties for bug 2:
has_branch: False
- has_mentoring_offer: True
has_patch: False
has_specification: True
Properties for bug 3:
has_branch: True
- has_mentoring_offer: False
has_patch: False
has_specification: False
=== modified file 'lib/lp/bugs/interfaces/bug.py'
--- lib/lp/bugs/interfaces/bug.py 2010-10-25 13:46:12 +0000
+++ lib/lp/bugs/interfaces/bug.py 2010-10-31 22:33:49 +0000
@@ -81,7 +81,6 @@
from lp.bugs.interfaces.bugwatch import IBugWatch
from lp.bugs.interfaces.cve import ICve
from lp.code.interfaces.branchlink import IHasLinkedBranches
-from lp.registry.interfaces.mentoringoffer import ICanBeMentored
from lp.registry.interfaces.person import IPerson
from lp.services.fields import (
BugField,
@@ -191,7 +190,7 @@
return subject_field
-class IBug(ICanBeMentored, IPrivacy, IHasLinkedBranches):
+class IBug(IPrivacy, IHasLinkedBranches):
"""The core bug entry."""
export_as_webservice_entry()
=== modified file 'lib/lp/bugs/interfaces/bugtask.py'
--- lib/lp/bugs/interfaces/bugtask.py 2010-10-25 13:03:02 +0000
+++ lib/lp/bugs/interfaces/bugtask.py 2010-10-31 22:33:49 +0000
@@ -112,7 +112,6 @@
NoBugTrackerFound,
UnrecognizedBugTrackerURL,
)
-from lp.registry.interfaces.mentoringoffer import ICanBeMentored
from lp.services.fields import (
BugField,
PersonChoice,
@@ -443,7 +442,7 @@
webservice_error(400) #Bad request.
-class IBugTask(IHasDateCreated, IHasBug, ICanBeMentored):
+class IBugTask(IHasDateCreated, IHasBug):
"""A bug needing fixing in a particular product or package."""
export_as_webservice_entry()
@@ -656,20 +655,22 @@
def subscribe(person, subscribed_by):
"""Subscribe this person to the underlying bug.
- This method is required here so that MentorshipOffers can happen on
- IBugTask. When we move to context-less bug presentation (where the
- bug is at /bugs/n?task=ubuntu) then we can eliminate this if it is
- no longer useful.
+ This method was documented as being required here so that
+ MentorshipOffers could happen on IBugTask. If that was the sole reason
+ this method should be deletable. When we move to context-less bug
+ presentation (where the bug is at /bugs/n?task=ubuntu) then we can
+ eliminate this if it is no longer useful.
"""
def isSubscribed(person):
"""Return True if the person is an explicit subscriber to the
underlying bug for this bugtask.
- This method is required here so that MentorshipOffers can happen on
- IBugTask. When we move to context-less bug presentation (where the
- bug is at /bugs/n?task=ubuntu) then we can eliminate this if it is
- no longer useful.
+ This method was documented as being required here so that
+ MentorshipOffers could happen on IBugTask. If that was the sole reason
+ then this method should be deletable. When we move to context-less bug
+ presentation (where the bug is at /bugs/n?task=ubuntu) then we can
+ eliminate this if it is no longer useful.
"""
@mutator_for(milestone)
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py 2010-10-26 02:02:12 +0000
+++ lib/lp/bugs/model/bug.py 2010-10-31 22:33:49 +0000
@@ -176,7 +176,6 @@
from lp.registry.interfaces.productseries import IProductSeries
from lp.registry.interfaces.series import SeriesStatus
from lp.registry.interfaces.sourcepackage import ISourcePackage
-from lp.registry.model.mentoringoffer import MentoringOffer
from lp.registry.model.person import (
Person,
ValidPersonCache,
@@ -320,8 +319,6 @@
cves = SQLRelatedJoin('Cve', intermediateTable='BugCve',
orderBy='sequence', joinColumn='bug', otherColumn='cve')
cve_links = SQLMultipleJoin('BugCve', joinColumn='bug', orderBy='id')
- mentoring_offers = SQLMultipleJoin(
- 'MentoringOffer', joinColumn='bug', orderBy='id')
duplicates = SQLMultipleJoin(
'Bug', joinColumn='duplicateof', orderBy='id')
specifications = SQLRelatedJoin('Specification', joinColumn='bug',
@@ -1389,42 +1386,6 @@
"""See `IBug`."""
return self._question_from_bug
- def canMentor(self, user):
- """See `ICanBeMentored`."""
- if user is None:
- return False
- if self.duplicateof is not None or self.is_complete:
- return False
- if bool(self.isMentor(user)):
- return False
- if not user.teams_participated_in:
- return False
- return True
-
- def isMentor(self, user):
- """See `ICanBeMentored`."""
- return MentoringOffer.selectOneBy(bug=self, owner=user) is not None
-
- def offerMentoring(self, user, team):
- """See `ICanBeMentored`."""
- # if an offer exists, then update the team
- mentoringoffer = MentoringOffer.selectOneBy(bug=self, owner=user)
- if mentoringoffer is not None:
- mentoringoffer.team = team
- return mentoringoffer
- # if no offer exists, create one from scratch
- mentoringoffer = MentoringOffer(owner=user, team=team,
- bug=self)
- notify(ObjectCreatedEvent(mentoringoffer, user=user))
- return mentoringoffer
-
- def retractMentoring(self, user):
- """See `ICanBeMentored`."""
- mentoringoffer = MentoringOffer.selectOneBy(bug=self, owner=user)
- if mentoringoffer is not None:
- notify(ObjectDeletedEvent(mentoringoffer, user=user))
- MentoringOffer.delete(mentoringoffer.id)
-
def getMessageChunks(self):
"""See `IBug`."""
query = """
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py 2010-10-26 02:02:12 +0000
+++ lib/lp/bugs/model/bugtask.py 2010-10-31 22:33:49 +0000
@@ -359,37 +359,6 @@
result.add(that_pillar)
return sorted(result, key=pillar_sort_key)
- @property
- def mentoring_offers(self):
- """See `IHasMentoringOffers`."""
- # mentoring is on IBug as a whole, not on a specific task, so we
- # pass through to the bug
- return self.bug.mentoring_offers
-
- def canMentor(self, user):
- """See `ICanBeMentored`."""
- # mentoring is on IBug as a whole, not on a specific task, so we
- # pass through to the bug
- return self.bug.canMentor(user)
-
- def isMentor(self, user):
- """See `ICanBeMentored`."""
- # mentoring is on IBug as a whole, not on a specific task, so we
- # pass through to the bug
- return self.bug.isMentor(user)
-
- def offerMentoring(self, user, team):
- """See `ICanBeMentored`."""
- # mentoring is on IBug as a whole, not on a specific task, so we
- # pass through to the bug
- return self.bug.offerMentoring(user, team)
-
- def retractMentoring(self, user):
- """See `ICanBeMentored`."""
- # mentoring is on IBug as a whole, not on a specific task, so we
- # pass through to the bug
- return self.bug.retractMentoring(user)
-
class NullBugTask(BugTaskMixin):
"""A null object for IBugTask.
@@ -1520,11 +1489,8 @@
from lp.blueprints.model.specificationbug import SpecificationBug
from lp.bugs.model.bug import Bug
from lp.bugs.model.bugbranch import BugBranch
- from lp.registry.model.mentoringoffer import MentoringOffer
bug_ids = list(set(bugtask.bugID for bugtask in bugtasks))
- bug_ids_with_mentoring_offers = set(IStore(MentoringOffer).find(
- MentoringOffer.bugID, In(MentoringOffer.bugID, bug_ids)))
bug_ids_with_specifications = set(IStore(SpecificationBug).find(
SpecificationBug.bugID, In(SpecificationBug.bugID, bug_ids)))
bug_ids_with_branches = set(IStore(BugBranch).find(
@@ -1538,8 +1504,6 @@
for bugtask in bugtasks:
bug = bugs[bugtask.bugID]
badge_properties[bugtask] = {
- 'has_mentoring_offer':
- bug.id in bug_ids_with_mentoring_offers,
'has_specification':
bug.id in bug_ids_with_specifications,
'has_branch':
=== modified file 'lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt'
--- lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt 2010-10-31 22:33:49 +0000
@@ -194,8 +194,7 @@
== Bug Badge Decoration ==
-We display bug badges for associated branches, mentorship,
-specifications, patches, etc.
+We display bug badges for associated branches, specifications, patches, etc.
>>> def names_and_branches(contents):
... table = find_tag_by_id(contents, 'buglisting')
=== removed file 'lib/lp/registry/browser/mentoringoffer.py'
--- lib/lp/registry/browser/mentoringoffer.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/mentoringoffer.py 1970-01-01 00:00:00 +0000
@@ -1,200 +0,0 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Mentorship views."""
-
-__metaclass__ = type
-
-__all__ = [
- 'CanBeMentoredView',
- 'HasMentoringOffersView',
- 'MentoringOfferSetFacets',
- 'MentoringOfferSetOverviewMenu',
- 'MentoringOfferSetView',
- 'MentoringOfferAddView',
- 'MentoringOfferRetractView',
- ]
-
-from canonical.launchpad import _
-from canonical.launchpad.webapp import (
- action,
- ApplicationMenu,
- canonical_url,
- LaunchpadFormView,
- LaunchpadView,
- Link,
- StandardLaunchpadFacets,
- )
-from canonical.launchpad.webapp.batching import BatchNavigator
-from lp.blueprints.interfaces.specification import ISpecification
-from lp.bugs.interfaces.bugtask import IBugTask
-from lp.registry.interfaces.distribution import IDistribution
-from lp.registry.interfaces.mentoringoffer import (
- IMentoringOffer,
- IMentoringOfferSet,
- )
-from lp.registry.interfaces.person import IPerson
-from lp.registry.interfaces.product import IProduct
-from lp.registry.interfaces.projectgroup import IProjectGroup
-
-
-class MentoringOfferSetFacets(StandardLaunchpadFacets):
-
- usedfor = IMentoringOfferSet
-
- enable_only = ['overview']
-
-
-class MentoringOfferSetOverviewMenu(ApplicationMenu):
-
- usedfor = IMentoringOfferSet
- facet = 'overview'
- links = ['current', 'successful']
-
- def current(self):
- text = 'Current offers'
- return Link('+mentoring', text, icon='info')
-
- def successful(self):
- text = 'Recent successes'
- return Link('+success', text, icon='info')
-
-
-class CanBeMentoredView:
- """Used as a mixin on any view for something that can be mentored."""
-
- def userCanMentor(self):
- """Is the user able to offer mentorship?"""
- return self.context.canMentor(self.user)
-
- def userIsMentor(self):
- """Is the user offering mentorship on this bug?"""
- return self.context.isMentor(self.user)
-
-
-class MentoringOfferAddView(LaunchpadFormView):
- """This view will be used for objects that can be mentored, that
- includes IBug, IBugTask and ISpecification
- """
-
- schema = IMentoringOffer
- label = "Offer to mentor this work"
- field_names = ['team', 'subscription_request']
- mentoring_offer = None
-
- def validate(self, data):
- team = data.get('team')
- if not self.user.inTeam(team):
- # person must be a participant in team
- self.setFieldError('team',
- 'You can only offer mentorship for teams in which you are '
- 'a member.')
-
- @action(_('Offer Mentoring'), name='add')
- def add_action(self, action, data):
- user = self.user
- team = data.get('team')
- self.mentoring_offer = self.context.offerMentoring(user, team)
- subscribe = data.get('subscription_request')
- if subscribe:
- if not self.context.isSubscribed(user):
- # XXX Tom Berger 2007-07-15: IBugTask
- # and ISpecification (and everything
- # else you can subscribe to) should
- # implement a common interface and
- # have the same signature for their
- # subscribe method.
- if IBugTask.providedBy(self.context):
- self.context.subscribe(user, user)
- elif ISpecification.providedBy(self.context):
- self.context.subscribe(user, user, False)
- else:
- raise AssertionError, (
- '%s does not provide IBugTask or ISpecification' %
- self.context)
- self.request.response.addInfoNotification(
- 'You have subscribed to this item.')
- self.request.response.addInfoNotification(
- 'Thank you for this mentorship offer.')
-
- @property
- def next_url(self):
- assert self.mentoring_offer is not None, 'No mentorship recorded'
- return canonical_url(self.context)
-
-
-class MentoringOfferRetractView(LaunchpadFormView, CanBeMentoredView):
- """This view is used to retract the offer of mentoring."""
-
- schema = IMentoringOffer
- label = "Retract your offer of mentorship"
- field_names = []
-
- @action(_('Retract Mentoring'), name='retract')
- def add_action(self, action, data):
- user = self.user
- if self.context.isMentor(user):
- self.context.retractMentoring(user)
- self.request.response.addInfoNotification(
- 'You are no longer offering mentoring on this work.')
-
- @property
- def next_url(self):
- return canonical_url(self.context)
-
-
-class HasMentoringOffersView(LaunchpadView):
-
- # these flags determine which columns will be displayed. In the
- # initialise() method, some columns may be disabled based on the type of
- # context (person, team, project, mentorship manager)
- show_person = True
- show_team = True
- show_date = True
- show_work = True
-
- # these flags govern some of the content of the spec page, which allows
- # us to vary the text flow slightly without creating large numbers of
- # template fragments
- is_person = False
- is_team = False
- is_pillar = False
- is_manager = False
-
- def initialize(self):
- if IPerson.providedBy(self.context):
- if self.context.teamowner is None:
- self.is_person = True
- self.show_person = False
- else:
- self.is_team = True
- self.show_team = False
- elif (IDistribution.providedBy(self.context) or
- IProduct.providedBy(self.context) or
- IProjectGroup.providedBy(self.context)):
- self.is_pillar = True
- elif IMentoringOfferSet.providedBy(self.context):
- self.is_manager = True
- else:
- raise AssertionError, 'Unknown mentorship listing site'
- mapping = {'name': self.context.displayname}
- if self.is_person:
- self.title = _('Mentoring offered by $name', mapping=mapping)
- else:
- self.title = _('Offers of mentoring for $name', mapping=mapping)
-
- def batched_offers(self):
- if self.is_team:
- resultset = self.context.team_mentorships
- else:
- resultset = self.context.mentoring_offers
- return BatchNavigator(resultset, self.request)
-
-
-class MentoringOfferSetView(HasMentoringOffersView):
-
- def batched_successes(self):
- return BatchNavigator(self.context.recent_completed_mentorships,
- self.request)
-
-
=== modified file 'lib/lp/registry/browser/milestone.py'
--- lib/lp/registry/browser/milestone.py 2010-08-24 10:45:57 +0000
+++ lib/lp/registry/browser/milestone.py 2010-10-31 22:33:49 +0000
@@ -284,7 +284,6 @@
badge_property = self._bug_badge_properties[bugtask]
return BugTaskListingItem(
bugtask,
- badge_property['has_mentoring_offer'],
badge_property['has_branch'],
badge_property['has_specification'],
badge_property['has_patch'])
=== modified file 'lib/lp/registry/browser/tests/milestone-views.txt'
--- lib/lp/registry/browser/tests/milestone-views.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/registry/browser/tests/milestone-views.txt 2010-10-31 22:33:49 +0000
@@ -127,7 +127,6 @@
... print '%s: %s' % (key, badge_dict[key])
<BugTask ...>
has_branch: False
- has_mentoring_offer: False
has_patch: False
has_specification: False
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2010-10-21 03:22:06 +0000
+++ lib/lp/registry/configure.zcml 2010-10-31 22:33:49 +0000
@@ -1814,17 +1814,6 @@
permission="launchpad.Edit"
set_schema="lp.registry.interfaces.distributionmirror.IMirrorProbeRecord" />
</class>
- <class
- class="lp.registry.model.mentoringoffer.MentoringOffer">
- <allow
- interface="lp.registry.interfaces.mentoringoffer.IMentoringOffer"/>
- </class>
- <securedutility
- class="lp.registry.model.mentoringoffer.MentoringOfferSet"
- provides="lp.registry.interfaces.mentoringoffer.IMentoringOfferSet">
- <allow
- interface="lp.registry.interfaces.mentoringoffer.IMentoringOfferSet"/>
- </securedutility>
<!-- Packaging -->
<class
=== removed file 'lib/lp/registry/doc/mentoringoffer.txt'
--- lib/lp/registry/doc/mentoringoffer.txt 2010-10-19 18:44:31 +0000
+++ lib/lp/registry/doc/mentoringoffer.txt 1970-01-01 00:00:00 +0000
@@ -1,292 +0,0 @@
-= The Mentoring System =
-
-== Offers of Mentoring ==
-
-Launchpad allows people to make an offer of mentoring for a bug or
-specification. Here, Foo Bar will make an offer on a spec and a bug:
-
- >>> from lp.bugs.interfaces.bug import IBugSet
- >>> from lp.registry.interfaces.distribution import IDistributionSet
- >>> from lp.registry.interfaces.person import IPersonSet
- >>> from canonical.launchpad.ftests import login, syncUpdate
- >>> distroset = getUtility(IDistributionSet)
- >>> personset = getUtility(IPersonSet)
- >>> bugset = getUtility(IBugSet)
- >>> foo_bar = personset.getByEmail('foo.bar@xxxxxxxxxxxxx')
- >>> mark = personset.getByName('mark')
- >>> lpteam = personset.getByName('launchpad')
- >>> kubuntu = distroset.getByName('kubuntu')
- >>> bug2 = bugset.get(2)
- >>> bug2.is_complete
- False
- >>> spec1 = kubuntu.getSpecification('cluster-installation')
- >>> spec1.is_complete
- False
- >>> login('foo.bar@xxxxxxxxxxxxx')
- >>> offer1 = bug2.offerMentoring(foo_bar, lpteam)
- >>> offer2 = spec1.offerMentoring(foo_bar, lpteam)
-
-Now, it should be possible to see those offers on a variety of lists.
-
-First, we look at foo_bar's offers:
-
- >>> for offer in foo_bar.mentoring_offers:
- ... print offer.target.title
- Facilitate mass installs of Ubuntu using Netboot configuration
- Blackhole Trash folder
-
-Now, let's look at the list of offers associated with lpteam. For this we
-use the team_mentorships attribute, because mentoring_offers would imply
-offers made *by* the team, which we don't do. The team_memberships attribute
-is for mentorships made by people specifically in support of new members
-wanting to join that specific team:
-
- >>> for offer in lpteam.team_mentorships:
- ... print offer.target.title
- Facilitate mass installs of Ubuntu using Netboot configuration
- Blackhole Trash folder
-
-And at the offers related to Bug #2:
-
- >>> for offer in bug2.mentoring_offers:
- ... print offer.target.title
- Blackhole Trash folder
-
-And for the specification concerned:
-
- >>> for offer in spec1.mentoring_offers:
- ... print offer.target.title
- Facilitate mass installs of Ubuntu using Netboot configuration
-
-Now, Bug #2 is associated with both Ubuntu and Debian
-
- >>> ubuntu = distroset.getByName('ubuntu')
- >>> for offer in ubuntu.mentoring_offers:
- ... print offer.target.title
- Blackhole Trash folder
- >>> debian = distroset.getByName('debian')
- >>> for offer in debian.mentoring_offers:
- ... print offer.target.title
- Blackhole Trash folder
-
-It is also associated with the ubuntu *upstream* (this is a weirdness in the
-Launchpad sample data, we have an upstream product called Ubuntu).
-
- >>> from lp.registry.interfaces.product import IProductSet
- >>> productset = getUtility(IProductSet)
- >>> tomcat = productset.getByName('tomcat')
- >>> for offer in tomcat.mentoring_offers:
- ... print offer.target.title
- Blackhole Trash folder
-
-Now, it gets more interesting.
-
-Let us add a INVALID bugtask for Bug #2 on the Firefox product.
-So the offer of mentoring is NOT relevant to Firefox, and should not
-show up there.
-
- >>> firefox = productset.getByName('firefox')
- >>> from lp.bugs.interfaces.bugtask import (
- ... BugTaskImportance,
- ... BugTaskStatus,
- ... IBugTaskSet,
- ... )
- >>> bugtaskset = getUtility(IBugTaskSet)
- >>> ff_task = bugtaskset.createTask(
- ... bug=bug2, product=firefox, owner=mark,
- ... status=BugTaskStatus.INVALID,
- ... importance=BugTaskImportance.MEDIUM)
- >>> syncUpdate(ff_task)
- >>> ff_task.product == firefox
- True
- >>> for task in bug2.bugtasks:
- ... if task.product == firefox:
- ... print 'Found firefox task with status', task.status.name
- Found firefox task with status INVALID
-
- >>> print firefox.mentoring_offers.count()
- 0
-
-We also can get lists of offers of mentoring associated with ProjectGroups.
-Tomcat is part of the Apache project group, so:
-
- >>> from lp.registry.interfaces.projectgroup import IProjectGroupSet
- >>> projectset = getUtility(IProjectGroupSet)
- >>> apache = projectset.getByName('apache')
- >>> for offer in apache.mentoring_offers:
- ... print offer.target.title
- Blackhole Trash folder
-
-
-== The Mentorship Manager ==
-
-There is a utility which we can use to see all current mentorship offers
-across the whole system.
-
- >>> from lp.registry.interfaces.mentoringoffer import IMentoringOfferSet
- >>> mm = getUtility(IMentoringOfferSet)
- >>> print mm.mentoring_offers.count()
- 2
-
-== Mentoring lists do not include private items ==
-
-When a bug is marked private, it drops off the mentoring lists.
-
- >>> bug2.private
- False
- >>> bug2.setPrivate(True, getUtility(ILaunchBag).user)
- True
- >>> syncUpdate(bug2)
- >>> bug2.private
- True
-
-So, now that Bug #2 is private it should no longer appear in the list of
-mentorships offered by foo_bar:
-
- >>> for offer in lpteam.team_mentorships:
- ... print offer.target.title
- Facilitate mass installs of Ubuntu using Netboot configuration
-
-Let's make sure it is off all of the lists:
-
- >>> for offertarget in [foo_bar, apache, tomcat, debian, ubuntu, mm]:
- ... for offer in offertarget.mentoring_offers:
- ... if offer.target.title == 'Blackhole Trash folder':
- ... print 'Failed! Private bug showed in listing.'
-
-
-# NB these comments can be removed when we have private specs, which should
-# drop off the lists too.
-
-#And lets see if we can eliminate the spec by making that complete too.
-#
-# >>> spec1.private
-# False
-# >>> spec1.private = True
-# >>> syncUpdate(spec1)
-# >>> spec1.private
-# True
-# >>> print foo_bar.mentoring_offers.count()
-# 0
-
-#And both offers should have disappeared from ALL the listings we looked at
-#earlier:
-#
-# >>> print lpteam.team_mentorships.count()
-# 0
-# >>> print uproj.mentoring_offers.count()
-# 0
-# >>> print ubuntu_prod.mentoring_offers.count()
-# 0
-# >>> print debian.mentoring_offers.count()
-# 0
-# >>> print ubuntu.mentoring_offers.count()
-# 0
-
-#The mentorship manager should also no longer show those items:
-#
-# >>> print mm.mentoring_offers.count()
-# 0
-
-
-OK, let's mark the bug public again:
-
- >>> bug2.private
- True
- >>> bug2.setPrivate(False, getUtility(ILaunchBag).user)
- True
- >>> syncUpdate(bug2)
- >>> bug2.private
- False
-
-
-== Mentoring lists include only incomplete items ==
-
-When a spec or a bug is completed, it drops off the mentoring lists.
-
- >>> from lp.blueprints.interfaces.specification import SpecificationImplementationStatus
- >>> from lp.bugs.interfaces.bugtask import BugTaskStatus
- >>> bug2.is_complete
- False
- >>> from canonical.database.sqlbase import flush_database_updates
- >>> for task in bug2.bugtasks:
- ... if task.conjoined_master is None:
- ... task.transitionToStatus(
- ... BugTaskStatus.FIXRELEASED, getUtility(ILaunchBag).user)
- >>> flush_database_updates()
- >>> bug2.is_complete
- True
-
-So, now that Bug #2 is "complete" it should no longer appear in the list of
-mentorships offered by foo_bar:
-
- >>> for offer in foo_bar.mentoring_offers:
- ... print offer.target.title
- Facilitate mass installs of Ubuntu using Netboot configuration
-
-And lets see if we can eliminate the spec by making that complete too.
-
- >>> spec1.is_complete
- False
- >>> spec1.implementation_status = SpecificationImplementationStatus.IMPLEMENTED
- >>> newstate = spec1.updateLifecycleStatus(foo_bar)
- >>> syncUpdate(spec1)
- >>> spec1.is_complete
- True
- >>> print foo_bar.mentoring_offers.count()
- 0
-
-And both offers should have disappeared from ALL the listings we looked at
-earlier:
-
- >>> print lpteam.team_mentorships.count()
- 0
- >>> print apache.mentoring_offers.count()
- 0
- >>> print tomcat.mentoring_offers.count()
- 0
- >>> print debian.mentoring_offers.count()
- 0
- >>> print ubuntu.mentoring_offers.count()
- 0
-
-The mentorship manager should also no longer show those items:
-
- >>> print mm.mentoring_offers.count()
- 0
-
-However, the mentorship manager should show these as recent successful
-mentorings:
-
- >>> for offer in mm.recent_completed_mentorships:
- ... print offer.target.title
- Blackhole Trash folder
- Facilitate mass installs of Ubuntu using Netboot configuration
-
-
-== Checking if the person is a Mentor ==
-
-Once an offer has been made, you can test to see if a person is a mentor for
-a bug or a blueprint.
-
- >>> stevea = personset.getByName('stevea')
- >>> bug2.isMentor(stevea)
- False
- >>> bug2.isMentor(foo_bar)
- True
- >>> spec1.isMentor(stevea)
- False
- >>> bug2.isMentor(foo_bar)
- True
-
-== Retracting mentorship offers ==
-
-We can also retract offers of mentoring.
-
- >>> bug2.retractMentoring(foo_bar)
- >>> bug2.isMentor(foo_bar)
- False
- >>> spec1.retractMentoring(foo_bar)
- >>> spec1.isMentor(foo_bar)
- False
-
=== modified file 'lib/lp/registry/interfaces/distribution.py'
--- lib/lp/registry/interfaces/distribution.py 2010-10-14 17:30:10 +0000
+++ lib/lp/registry/interfaces/distribution.py 2010-10-31 22:33:49 +0000
@@ -76,7 +76,6 @@
from lp.registry.interfaces.announcement import IMakesAnnouncements
from lp.registry.interfaces.distributionmirror import IDistributionMirror
from lp.registry.interfaces.karma import IKarmaContext
-from lp.registry.interfaces.mentoringoffer import IHasMentoringOffers
from lp.registry.interfaces.milestone import (
ICanGetMilestonesDirectly,
IHasMilestones,
@@ -127,7 +126,7 @@
class IDistributionPublic(
IBugTarget, ICanGetMilestonesDirectly, IHasAppointedDriver,
- IHasBuildRecords, IHasDrivers, IHasMentoringOffers, IHasMilestones,
+ IHasBuildRecords, IHasDrivers, IHasMilestones,
IHasOwner, IHasSecurityContact, IHasSprints, ITranslationPolicy,
IKarmaContext, ILaunchpadUsage, IMakesAnnouncements,
IOfficialBugTagTargetPublic, IPillar, IServiceUsage,
=== removed file 'lib/lp/registry/interfaces/mentoringoffer.py'
--- lib/lp/registry/interfaces/mentoringoffer.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/interfaces/mentoringoffer.py 1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-# pylint: disable-msg=E0211,E0213
-
-"""MentoringOffer interfaces."""
-
-__metaclass__ = type
-
-__all__ = [
- 'ICanBeMentored',
- 'IHasMentoringOffers',
- 'IMentoringOffer',
- 'IMentoringOfferSet',
- ]
-
-
-from zope.interface import (
- Attribute,
- Interface,
- )
-from zope.schema import (
- Bool,
- Datetime,
- )
-
-from canonical.launchpad import _
-from lp.registry.interfaces.role import IHasOwner
-from lp.services.fields import PublicPersonChoice
-
-
-class IMentoringOffer(IHasOwner):
- """An offer of mentoring help."""
-
- owner = PublicPersonChoice(
- title=_('Owner'), required=True, readonly=True,
- vocabulary='ValidPerson')
- team = PublicPersonChoice(
- title=_('Team'), required=True, vocabulary='UserTeamsParticipation')
- date_created = Datetime(
- title=_('Date Created'), required=True, readonly=True)
- subscription_request = Bool(title=_('Email me about this'),
- required=True, description=_(
- "Subscribe me to this item so that I get emailed whenever "
- "the status changes or somebody comments. If you are already "
- "subscribed, then leaving this box clear will not "
- "unsubscribe you."))
-
-
- # other attributes we don't need to set through a form
- bug = Attribute('A bug, if that is the target, or None')
- specification = Attribute('A blueprint, if that is the target, or None')
- # properties
- target = Attribute("The bug or specification for which mentoring is"
- "offered.")
-
-
-class IHasMentoringOffers(Interface):
- """Used for objects which have mentoring offers."""
-
- mentoring_offers = Attribute(
- "The list of mentoring offers related to this object.")
-
-
-class ICanBeMentored(IHasMentoringOffers):
- """Used for objects which can have mentoring offered or retracted."""
-
- def canMentor(user):
- """True if this user could now offer mentoring on this piece of
- work. Will be negative if the user is already offering mentoring, or
- if the work is complete, for example.
- """
-
- def isMentor(user):
- """True if the user is offering mentoring for this piece of work."""
-
- def offerMentoring(user, team):
- """Record that the user is willing to mentor anyone who is trying to
- do this work.
- """
-
- def retractMentoring(user):
- """Remove the offer of mentoring for this work by this user."""
-
-
-class IMentoringOfferSet(IHasMentoringOffers):
- """An object which gives us an overview of mentorship in Launchpad."""
-
- displayname = Attribute('Display name')
- title = Attribute('Title')
-
- recent_completed_mentorships = Attribute(
- 'Mentorships offered in the past year for which the task (bug or '
- 'blueprint) has since been completed.')
-
=== modified file 'lib/lp/registry/interfaces/person.py'
--- lib/lp/registry/interfaces/person.py 2010-10-28 14:38:22 +0000
+++ lib/lp/registry/interfaces/person.py 2010-10-31 22:33:49 +0000
@@ -129,7 +129,6 @@
from lp.registry.interfaces.mailinglistsubscription import (
MailingListAutoSubscribePolicy,
)
-from lp.registry.interfaces.mentoringoffer import IHasMentoringOffers
from lp.registry.interfaces.ssh import ISSHKey
from lp.registry.interfaces.teammembership import (
ITeamMembership,
@@ -506,7 +505,7 @@
description=_("The reason the person's standing is what it is."))
-class IPersonPublic(IHasBranches, IHasSpecifications, IHasMentoringOffers,
+class IPersonPublic(IHasBranches, IHasSpecifications,
IHasMergeProposals, IHasLogo, IHasMugshot, IHasIcon,
IHasLocation, IHasRequestedReviews, IObjectWithLocation,
IPrivacy, IHasBugs, IHasRecipes):
@@ -720,8 +719,6 @@
assigned_specs_in_progress = Attribute(
"Specifications assigned to this person whose implementation is "
"started but not yet completed, sorted newest first.")
- team_mentorships = Attribute(
- "All the offers of mentoring which are relevant to this team.")
teamowner = exported(
PublicPersonChoice(
title=_('Team Owner'), required=False, readonly=False,
=== modified file 'lib/lp/registry/interfaces/product.py'
--- lib/lp/registry/interfaces/product.py 2010-09-21 09:37:06 +0000
+++ lib/lp/registry/interfaces/product.py 2010-10-31 22:33:49 +0000
@@ -108,7 +108,6 @@
ICommercialSubscription,
)
from lp.registry.interfaces.karma import IKarmaContext
-from lp.registry.interfaces.mentoringoffer import IHasMentoringOffers
from lp.registry.interfaces.milestone import (
ICanGetMilestonesDirectly,
IHasMilestones,
@@ -405,7 +404,7 @@
class IProductPublic(
IBugTarget, ICanGetMilestonesDirectly, IHasAppointedDriver, IHasBranches,
IHasBranchVisibilityPolicy, IHasDrivers, IHasExternalBugTracker, IHasIcon,
- IHasLogo, IHasMentoringOffers, IHasMergeProposals, IHasMilestones,
+ IHasLogo, IHasMergeProposals, IHasMilestones,
IHasMugshot, IHasOwner, IHasSecurityContact, IHasSprints,
ITranslationPolicy, IKarmaContext, ILaunchpadUsage, IMakesAnnouncements,
IOfficialBugTagTargetPublic, IPillar, ISpecificationTarget, IHasRecipes,
=== modified file 'lib/lp/registry/interfaces/projectgroup.py'
--- lib/lp/registry/interfaces/projectgroup.py 2010-10-20 14:05:26 +0000
+++ lib/lp/registry/interfaces/projectgroup.py 2010-10-31 22:33:49 +0000
@@ -68,7 +68,6 @@
)
from lp.registry.interfaces.announcement import IMakesAnnouncements
from lp.registry.interfaces.karma import IKarmaContext
-from lp.registry.interfaces.mentoringoffer import IHasMentoringOffers
from lp.registry.interfaces.milestone import (
ICanGetMilestonesDirectly,
IHasMilestones,
@@ -110,7 +109,7 @@
class IProjectGroupPublic(
ICanGetMilestonesDirectly, IHasAppointedDriver, IHasBranches, IHasBugs,
IHasDrivers, IHasBranchVisibilityPolicy, IHasIcon, IHasLogo,
- IHasMentoringOffers, IHasMergeProposals, IHasMilestones, IHasMugshot,
+ IHasMergeProposals, IHasMilestones, IHasMugshot,
IHasOwner, IHasSpecifications, IHasSprints, IMakesAnnouncements,
IKarmaContext, IRootContext, IHasOfficialBugTags, IServiceUsage):
"""Public IProjectGroup properties."""
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2010-10-24 12:46:23 +0000
+++ lib/lp/registry/model/distribution.py 2010-10-31 22:33:49 +0000
@@ -139,7 +139,6 @@
)
from lp.registry.model.distroseries import DistroSeries
from lp.registry.model.karma import KarmaContextMixin
-from lp.registry.model.mentoringoffer import MentoringOffer
from lp.registry.model.milestone import (
HasMilestonesMixin,
Milestone,
@@ -538,27 +537,6 @@
return architectures
@property
- def mentoring_offers(self):
- """See `IDistribution`"""
- via_specs = MentoringOffer.select("""
- Specification.distribution = %s AND
- Specification.id = MentoringOffer.specification
- """ % sqlvalues(self.id) + """ AND NOT (
- """ + Specification.completeness_clause + ")",
- clauseTables=['Specification'],
- distinct=True)
- via_bugs = MentoringOffer.select("""
- BugTask.distribution = %s AND
- BugTask.bug = MentoringOffer.bug AND
- BugTask.bug = Bug.id AND
- Bug.private IS FALSE
- """ % sqlvalues(self.id) + """ AND NOT (
- """ + BugTask.completeness_clause +")",
- clauseTables=['BugTask', 'Bug'],
- distinct=True)
- return via_specs.union(via_bugs, orderBy=['-date_created', '-id'])
-
- @property
def bugtargetdisplayname(self):
"""See IBugTarget."""
return self.displayname
=== removed file 'lib/lp/registry/model/mentoringoffer.py'
--- lib/lp/registry/model/mentoringoffer.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/model/mentoringoffer.py 1970-01-01 00:00:00 +0000
@@ -1,121 +0,0 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-# pylint: disable-msg=E0611,W0212
-
-__metaclass__ = type
-__all__ = [
- 'MentoringOffer',
- 'MentoringOfferSet',
- ]
-
-from datetime import (
- datetime,
- timedelta,
- )
-
-import pytz
-from sqlobject import ForeignKey
-from zope.interface import implements
-
-from canonical.database.constants import DEFAULT
-from canonical.database.datetimecol import UtcDateTimeCol
-from canonical.database.sqlbase import (
- SQLBase,
- sqlvalues,
- )
-from lp.registry.interfaces.mentoringoffer import (
- IMentoringOffer,
- IMentoringOfferSet,
- )
-from lp.registry.interfaces.person import validate_public_person
-
-
-class MentoringOffer(SQLBase):
- """See IMentoringOffer."""
-
- implements(IMentoringOffer)
-
- _defaultOrder = ['-date_created', '-id']
-
- # db field names
- owner = ForeignKey(
- dbName='owner', foreignKey='Person',
- storm_validator=validate_public_person, notNull=True)
- date_created = UtcDateTimeCol(notNull=True, default=DEFAULT)
- team = ForeignKey(
- dbName='team', foreignKey='Person',
- storm_validator=validate_public_person, notNull=True)
- bug = ForeignKey(dbName='bug', notNull=False,
- foreignKey='Bug', default=None)
- specification = ForeignKey(dbName='specification', notNull=False,
- foreignKey='Specification', default=None)
-
- # attributes
- @property
- def target(self):
- """See IMentoringOffer."""
- if self.bug:
- return self.bug
- return self.specification
-
- @property
- def subscription_request(self):
- """See IMentoringOffer.
-
- In this case, we return the subscription status of the person on the
- underlying target.
- """
- return self.target.isSubscribed(self.owner)
-
-
-class MentoringOfferSet:
- """See IMentoringOfferSet."""
-
- implements(IMentoringOfferSet)
-
- displayname = 'the Launchpad Mentorship Manager'
- title = 'Launchpad Mentorship Manager'
-
- @property
- def mentoring_offers(self):
- """See IHasMentoringOffers."""
- # import here to avoid circular imports
- from lp.blueprints.model.specification import Specification
- from lp.bugs.model.bugtask import BugTask
- via_specs = MentoringOffer.select("""
- Specification.id = MentoringOffer.specification AND NOT
- (""" + Specification.completeness_clause +")",
- clauseTables=['Specification'],
- distinct=True)
- via_bugs = MentoringOffer.select("""
- BugTask.bug = Bug.id AND
- Bug.private IS FALSE AND
- BugTask.bug = MentoringOffer.bug AND NOT (
- """ + BugTask.completeness_clause + ")",
- clauseTables=['BugTask', 'Bug'],
- distinct=True)
- return via_specs.union(via_bugs, orderBy=['-date_created'])
-
- @property
- def recent_completed_mentorships(self):
- """See IHasMentoringOffers."""
- # import here to avoid circular imports
- from lp.blueprints.model.specification import Specification
- from lp.bugs.model.bugtask import BugTask
- now = datetime.now(pytz.timezone('UTC'))
- yearago = now - timedelta(365)
- via_specs = MentoringOffer.select("""
- MentoringOffer.date_created > %s AND
- """ % sqlvalues(yearago) + """
- Specification.id = MentoringOffer.specification AND
- (""" + Specification.completeness_clause +")",
- clauseTables=['Specification'])
- via_bugs = MentoringOffer.select("""
- MentoringOffer.date_created > %s AND
- """ % sqlvalues(yearago) + """
- BugTask.bug = MentoringOffer.bug AND (
- """ + BugTask.completeness_clause + ")",
- clauseTables=['BugTask'])
- return via_specs.union(via_bugs).orderBy("id")
-
=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py 2010-10-29 22:52:42 +0000
+++ lib/lp/registry/model/person.py 2010-10-31 22:33:49 +0000
@@ -251,7 +251,6 @@
KarmaCategory,
KarmaTotalCache,
)
-from lp.registry.model.mentoringoffer import MentoringOffer
from lp.registry.model.personlocation import PersonLocation
from lp.registry.model.pillar import PillarName
from lp.registry.model.structuralsubscription import StructuralSubscription
@@ -666,53 +665,6 @@
""" % replacements
return Specification.select(query, orderBy=['-date_started'], limit=5)
- # mentorship
- @property
- def mentoring_offers(self):
- """See `IPerson`"""
- return MentoringOffer.select("""MentoringOffer.id IN
- (SELECT MentoringOffer.id
- FROM MentoringOffer
- LEFT OUTER JOIN BugTask ON
- MentoringOffer.bug = BugTask.bug
- LEFT OUTER JOIN Bug ON
- BugTask.bug = Bug.id
- LEFT OUTER JOIN Specification ON
- MentoringOffer.specification = Specification.id
- WHERE
- MentoringOffer.owner = %s
- """ % sqlvalues(self.id) + """ AND (
- BugTask.id IS NULL OR NOT
- (Bug.private IS TRUE OR
- (""" + BugTask.completeness_clause +"""))) AND (
- Specification.id IS NULL OR NOT
- (""" + Specification.completeness_clause +")))",
- )
-
- @property
- def team_mentorships(self):
- """See `IPerson`"""
- return MentoringOffer.select("""MentoringOffer.id IN
- (SELECT MentoringOffer.id
- FROM MentoringOffer
- JOIN TeamParticipation ON
- MentoringOffer.team = TeamParticipation.person
- LEFT OUTER JOIN BugTask ON
- MentoringOffer.bug = BugTask.bug
- LEFT OUTER JOIN Bug ON
- BugTask.bug = Bug.id
- LEFT OUTER JOIN Specification ON
- MentoringOffer.specification = Specification.id
- WHERE
- TeamParticipation.team = %s
- """ % sqlvalues(self.id) + """ AND (
- BugTask.id IS NULL OR NOT
- (Bug.private IS TRUE OR
- (""" + BugTask.completeness_clause +"""))) AND (
- Specification.id IS NULL OR NOT
- (""" + Specification.completeness_clause +")))",
- )
-
@property
def unique_displayname(self):
"""See `IPerson`."""
@@ -3546,40 +3498,6 @@
DELETE FROM QuestionSubscription WHERE person=%(from_id)d
''' % vars())
- def _mergeMentoringOffer(self, cur, from_id, to_id):
- # Update only the MentoringOffers that will not conflict.
- cur.execute('''
- UPDATE MentoringOffer
- SET owner=%(to_id)d
- WHERE owner=%(from_id)d
- AND bug NOT IN (
- SELECT bug
- FROM MentoringOffer
- WHERE owner = %(to_id)d)
- AND specification NOT IN (
- SELECT specification
- FROM MentoringOffer
- WHERE owner = %(to_id)d)
- ''' % vars())
- cur.execute('''
- UPDATE MentoringOffer
- SET team=%(to_id)d
- WHERE team=%(from_id)d
- AND bug NOT IN (
- SELECT bug
- FROM MentoringOffer
- WHERE team = %(to_id)d)
- AND specification NOT IN (
- SELECT specification
- FROM MentoringOffer
- WHERE team = %(to_id)d)
- ''' % vars())
- # and delete those left over.
- cur.execute('''
- DELETE FROM MentoringOffer
- WHERE owner=%(from_id)d OR team=%(from_id)d
- ''' % vars())
-
def _mergeBugNotificationRecipient(self, cur, from_id, to_id):
# Update BugNotificationRecipient entries that will not conflict.
cur.execute('''
@@ -3943,10 +3861,6 @@
self._mergeQuestionSubscription(cur, from_id, to_id)
skip.append(('questionsubscription', 'person'))
- self._mergeMentoringOffer(cur, from_id, to_id)
- skip.append(('mentoringoffer', 'owner'))
- skip.append(('mentoringoffer', 'team'))
-
self._mergeBugNotificationRecipient(cur, from_id, to_id)
skip.append(('bugnotificationrecipient', 'person'))
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2010-10-24 13:02:07 +0000
+++ lib/lp/registry/model/product.py 2010-10-31 22:33:49 +0000
@@ -142,7 +142,6 @@
from lp.registry.model.distribution import Distribution
from lp.registry.model.distroseries import DistroSeries
from lp.registry.model.karma import KarmaContextMixin
-from lp.registry.model.mentoringoffer import MentoringOffer
from lp.registry.model.milestone import (
HasMilestonesMixin,
Milestone,
@@ -1020,27 +1019,6 @@
return None
@property
- def mentoring_offers(self):
- """See `IProduct`"""
- via_specs = MentoringOffer.select("""
- Specification.product = %s AND
- Specification.id = MentoringOffer.specification
- """ % sqlvalues(self.id) + """ AND NOT
- (""" + Specification.completeness_clause + ")",
- clauseTables=['Specification'],
- distinct=True)
- via_bugs = MentoringOffer.select("""
- BugTask.product = %s AND
- BugTask.bug = MentoringOffer.bug AND
- BugTask.bug = Bug.id AND
- Bug.private IS FALSE
- """ % sqlvalues(self.id) + """ AND NOT (
- """ + BugTask.completeness_clause + ")",
- clauseTables=['BugTask', 'Bug'],
- distinct=True)
- return via_specs.union(via_bugs, orderBy=['-date_created', '-id'])
-
- @property
def translationgroups(self):
tg = []
if self.translationgroup:
=== modified file 'lib/lp/registry/model/projectgroup.py'
--- lib/lp/registry/model/projectgroup.py 2010-10-18 13:04:50 +0000
+++ lib/lp/registry/model/projectgroup.py 2010-10-31 22:33:49 +0000
@@ -94,7 +94,6 @@
)
from lp.registry.model.announcement import MakesAnnouncements
from lp.registry.model.karma import KarmaContextMixin
-from lp.registry.model.mentoringoffer import MentoringOffer
from lp.registry.model.milestone import (
HasMilestonesMixin,
Milestone,
@@ -186,29 +185,6 @@
return [self.driver]
return []
- @property
- def mentoring_offers(self):
- """See `IProjectGroup`."""
- via_specs = MentoringOffer.select("""
- Product.project = %s AND
- Specification.product = Product.id AND
- Specification.id = MentoringOffer.specification
- """ % sqlvalues(self.id) + """ AND NOT
- (""" + Specification.completeness_clause +")",
- clauseTables=['Product', 'Specification'],
- distinct=True)
- via_bugs = MentoringOffer.select("""
- Product.project = %s AND
- BugTask.product = Product.id AND
- BugTask.bug = MentoringOffer.bug AND
- BugTask.bug = Bug.id AND
- Bug.private IS FALSE
- """ % sqlvalues(self.id) + """ AND NOT (
- """ + BugTask.completeness_clause + ")",
- clauseTables=['Product', 'BugTask', 'Bug'],
- distinct=True)
- return via_specs.union(via_bugs, orderBy=['-date_created', '-id'])
-
def translatables(self):
"""See `IProjectGroup`."""
# XXX j.c.sackett 2010-08-30 bug=627631: Once data migration has
=== modified file 'utilities/migrater/file-ownership.txt'
--- utilities/migrater/file-ownership.txt 2010-10-27 14:25:19 +0000
+++ utilities/migrater/file-ownership.txt 2010-10-31 22:33:49 +0000
@@ -66,7 +66,6 @@
./browser/librarian.py
./browser/logintoken.py
reg ./browser/mailinglists.py
-reg ./browser/mentoringoffer.py
./browser/message.py
reg ./browser/milestone.py
./browser/multistep.py
@@ -251,7 +250,6 @@
./database/librarian.py
./database/logintoken.py
reg ./database/mailinglist.py
-reg ./database/mentoringoffer.py
./database/message.py
reg ./database/milestone.py
./database/oauth.py
@@ -442,7 +440,6 @@
reg ./interfaces/mailinglist.py
reg ./interfaces/mailinglistsubscription.py
bug ./interfaces/malone.py
-reg ./interfaces/mentoringoffer.py
fnd ./interfaces/message.py
reg ./interfaces/milestone.py
fnd ./interfaces/oauth.py
@@ -937,7 +934,6 @@
./zcml/packagebugsupervisor.zcml
./zcml/translationimport.zcml
./zcml/seriessourcepackagebranch.zcml
- ./zcml/mentoringoffer.zcml
./zcml/bugnotification.zcml
./zcml/decoratedresultset.zcml
./zcml/sourcepackagerelease.zcml
@@ -1129,7 +1125,6 @@
./icing/but-sml-helptranslate-down.gif
./icing/navigation-hierarchy-home-bg
./icing/navigation-nw-w-selected.png
- ./icing/but-sml-mentoring-over.gif
./icing/app-answers.gif
./icing/mainarea_bottom.gif
./icing/navigation-tabs-se-blueprints
@@ -1180,7 +1175,6 @@
./icing/app-register-sml.gif
./icing/app-register-sml-down.gif
./icing/app-translations-sml-over.gif
- ./icing/but-sml-mentoring.gif
./icing/navigation-ne-e-normal.png
./icing/appchoose_tab2_a.gif
./icing/but-sml-helptranslate-over.gif
@@ -1210,7 +1204,6 @@
./icing/app-code-sml-down.gif
./icing/navigation-hierarchy-bg
./icing/help-bottom.gif
- ./icing/but-sml-mentoring-off.gif
./icing/launchpad-tour-screenshot1.png
./icing/app-answers-wm.gif
./icing/navigation-hierarchy-chevron-selected
@@ -1242,7 +1235,6 @@
./icing/app-people-sml-over.gif
./icing/navigation-n.png
./icing/app-register-wm.gif
- ./icing/but-sml-mentoring-down.gif
./icing/answers-feature-language.png
./icing/navigation-tabs-se-bugs-active
./icing/code-tour-screenshot3.png
@@ -1373,7 +1365,6 @@
./images/build-needed.png
./images/security.png
./images/security-large.png
- ./images/mentoring.png
./images/bug-remote.png
./images/launchpad-logo.png
./images/edit.png
@@ -1385,7 +1376,6 @@
./images/translate.ubuntu.png
./images/bug.png
./images/crowd.png
- ./images/mentoring-large.png
./images/rss-large.png
./images/file_icon.gif
./images/do-not-disturb.png
@@ -2324,7 +2314,6 @@
reg ./doc/mailinglist-subscriptions.txt
reg ./doc/mailinglist-xmlrpc.txt
reg ./doc/mailinglists.txt
-reg ./doc/mentoringoffer.txt
reg ./doc/message-holds-xmlrpc.txt
reg ./doc/message-holds.txt
reg ./doc/milestone.txt
@@ -2918,8 +2907,6 @@
reg ./pagetests/mailinglists/moderation.txt
reg ./pagetests/mailinglists/subscriptions.txt
reg ./pagetests/mailinglists/welcome-message.txt
-reg ./pagetests/mentoring
-reg ./pagetests/mentoring/mentoring.txt
reg ./pagetests/milestone
reg ./pagetests/milestone/object-milestones.txt
reg ./pagetests/milestone/xx-create-milestone-on-distribution.txt