Ian Booth has proposed merging lp:~wallyworld/launchpad/duplicate-picker-info
into lp:launchpad with lp:~wallyworld/launchpad/lazr-js-tests as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #806785 in Launchpad itself: "Person picker displays duplicate info when
selecting recipe owner"
https://bugs.launchpad.net/launchpad/+bug/806785
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/duplicate-picker-info/+merge/67119
When using a picker with a UserTeamsParticipationVocabulary (or derivative),
the launchpad id was displayed twice for each picker entry.
eg Fred Smith (fsmith) (fsmith)
== Implementation ==
The UserTeamsParticipationVocabulary overrode toTerm() to use
person.unique_displayname for the term summary value. This override was simply
deleted to restore the default behaviour.
Also performed some drive-by lint fixes.
== Tests ==
There were no existing tests that I could find specifically for the original
subclassed behaviour. This branch simply deletes the method override to restore
the default term generation strategy for the vocab. So no new tests are
warranted.
lp was run up locally the correct behaviour verified.
== Lint ==
Linting changed files:
lib/lp/code/browser/branch.py
lib/lp/registry/vocabularies.py
./lib/lp/code/browser/branch.py
843: E261 at least two spaces before inline comment
./lib/lp/registry/vocabularies.py
639: E261 at least two spaces before inline comment
835: E261 at least two spaces before inline comment
--
https://code.launchpad.net/~wallyworld/launchpad/duplicate-picker-info/+merge/67119
Your team Launchpad code reviewers is requested to review the proposed merge of
lp:~wallyworld/launchpad/duplicate-picker-info into lp:launchpad.
=== modified file 'lib/lp/code/browser/branch.py'
--- lib/lp/code/browser/branch.py 2011-06-17 09:56:57 +0000
+++ lib/lp/code/browser/branch.py 2011-07-07 06:41:40 +0000
@@ -108,7 +108,6 @@
)
from lp.app.browser.lazrjs import (
EnumChoiceWidget,
- vocabulary_to_choice_edit_items,
)
from lp.app.errors import NotFoundError
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
@@ -118,7 +117,6 @@
from lp.bugs.interfaces.bug import IBugSet
from lp.bugs.interfaces.bugbranch import IBugBranch
from lp.bugs.interfaces.bugtask import UNRESOLVED_BUGTASK_STATUSES
-from lp.buildmaster.interfaces.buildfarmjob import IBuildFarmJobSet
from lp.code.browser.branchmergeproposal import (
latest_proposals_for_each_branch,
)
@@ -126,7 +124,6 @@
from lp.code.browser.decorations import DecoratedBranch
from lp.code.browser.sourcepackagerecipelisting import HasRecipesMenuMixin
from lp.code.enums import (
- BranchLifecycleStatus,
BranchType,
CodeImportResultStatus,
CodeImportReviewStatus,
@@ -1039,7 +1036,7 @@
owner_field = self.schema['owner']
any_owner_choice = Choice(
__name__='owner', title=owner_field.title,
- description = _("As an administrator you are able to reassign"
+ description=_("As an administrator you are able to reassign"
" this branch to any person or team."),
required=True, vocabulary='ValidPersonOrTeam')
any_owner_field = form.Fields(
@@ -1056,12 +1053,12 @@
vocab = UserTeamsParticipationPlusSelfVocabulary()
owner = self.context.owner
terms = [SimpleTerm(
- owner, owner.name, owner.unique_displayname)]
+ owner, owner.name, owner.displayname)]
terms.extend([term for term in vocab])
owner_field = self.schema['owner']
owner_choice = Choice(
__name__='owner', title=owner_field.title,
- description = owner_field.description,
+ description=owner_field.description,
required=True, vocabulary=SimpleVocabulary(terms))
new_owner_field = form.Fields(
owner_choice, render_context=self.render_context)
@@ -1480,7 +1477,8 @@
def _commitCounts(self):
"""Return a dict of commit counts for rendering."""
epoch = (
- datetime.now(tz=pytz.UTC) - timedelta(days=(self.COMMIT_DAYS-1)))
+ datetime.now(
+ tz=pytz.UTC) - timedelta(days=(self.COMMIT_DAYS - 1)))
# Make a datetime for that date, but midnight.
epoch = epoch.replace(hour=0, minute=0, second=0, microsecond=0)
commits = dict(self.context.commitsForDays(epoch))
=== modified file 'lib/lp/registry/vocabularies.py'
--- lib/lp/registry/vocabularies.py 2011-06-29 15:02:28 +0000
+++ lib/lp/registry/vocabularies.py 2011-07-07 06:41:40 +0000
@@ -168,9 +168,6 @@
from lp.registry.interfaces.projectgroup import IProjectGroup
from lp.registry.interfaces.sourcepackage import ISourcePackage
from lp.registry.model.distribution import Distribution
-from lp.registry.model.distributionsourcepackage import (
- DistributionSourcePackage,
- )
from lp.registry.model.distroseries import DistroSeries
from lp.registry.model.distroseriesparent import DistroSeriesParent
from lp.registry.model.featuredproject import FeaturedProject
@@ -200,7 +197,6 @@
from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
from lp.soyuz.model.distroarchseries import DistroArchSeries
from lp.soyuz.model.publishing import (
- BinaryPackagePublishingHistory,
SourcePackagePublishingHistory,
)
from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
@@ -375,10 +371,6 @@
_table = Person
_orderBy = 'displayname'
- def toTerm(self, obj):
- """See `IVocabulary`."""
- return SimpleTerm(obj, obj.name, obj.unique_displayname)
-
def __iter__(self):
kw = {}
if self._orderBy:
@@ -1962,7 +1954,7 @@
# package names are always lowercase.
return super(SourcePackageNameVocabulary, self).getTermByToken(
token.lower())
-
+
class DistributionSourcePackageVocabulary:
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp