Merge lp:~sinzui/launchpad/oil-and-pigment into lp:launchpad
Status: | Merged | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||||||||||||||
Proposed branch: | lp:~sinzui/launchpad/oil-and-pigment | ||||||||||||||||||||
Merge into: | lp:launchpad | ||||||||||||||||||||
Diff against target: |
505 lines (+174/-64) 11 files modified
lib/lp/app/stories/launchpad-root/site-search.txt (+1/-2) lib/lp/app/templates/base-layout-macros.pt (+2/-4) lib/lp/app/templates/launchpad-search.pt (+7/-2) lib/lp/blueprints/templates/person-specworkload.pt (+1/-1) lib/lp/registry/doc/person-karma.txt (+0/-8) lib/lp/registry/model/mailinglist.py (+3/-1) lib/lp/registry/model/person.py (+12/-5) lib/lp/registry/stories/team/xx-team-home.txt (+1/-1) lib/lp/registry/stories/teammembership/xx-private-membership.txt (+1/-1) lib/lp/registry/templates/team-portlet-membership.pt (+24/-18) lib/lp/registry/tests/test_person.py (+122/-21) |
||||||||||||||||||||
To merge this branch: | bzr merge lp:~sinzui/launchpad/oil-and-pigment | ||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | code | Approve | |
Review via email: mp+23952@code.launchpad.net |
Description of the change
This is my branch to fix from trivial issues while my brain is stuck in
first gear.
lp:~sinzui/launchpad/oil-and-pigment
Diff size: 489
Launchpad bug: https:/
https:/
https:/
https:/
Test command: ./bin/test -vv lp.registry.
./bin/test -t site-search -t xx-team-home -t xx-private-
-t person-karma
Pre-
Target release: 10.04
Fix from trivial issues while my brain is stuck in first gear
-------
Bug #436299 [Search results give wrong "Registered by" information]
The maintainer is listed as the registrant. This is wrong. The
problem is that distributions do not have a registrant.
Bug #568336 [Typo on profile workload page]
There is a double 'or'
Bug #130285 [Disregard deleted projects from Most active in]
Deactivated projects are listed in "Most active in" in the profile page
and the links are a 404.
Bug #557544 [Bad plural on team page ("1 active members")]
What: "1 active members" can appear on team page. This is incorrect use
of a plural.
Rules
-----
Bug #436299 [Search results give wrong "Registered by" information]
Verify there is a registrant using tales before appending the clause.
tal:
tal:
Bug #568336 [Typo on profile workload page]
Remove the second 'or'.
Bug #130285 [Disregard deleted projects from lists]
This issue in on the cusp of *not* trivial because a good understanding
of pillar name behaviour and karma testing is needed. The fix can be
easily placed into an existing doc test, but that is not the correct
location.
* pillar names (used by karma cache) have no concept of active/inactive.
The method must filter deactivate pillars /after/ the query to get the
names. The callsite must request more than is needed because of the
filtering.
* Generate the karma for a unit test of the method *and* the private
methods that were never directly tested.
* Test that deactivated pillars are not included.
* ADDENDUM: While I knew how to generate the karma, the reason why
the karma looks like it is inserted twice was not obvious from existing
tests. I took an extra hour learning this and adding comments for
future developers.
Bug #557544 [Bad plural on team page ("1 active members")]
* Use the plural-message macro to switch between member and members
QA
--
Bug #436299 [Search results give wrong "Registered by" information]
* Visit https:/
* Verify that Karianne Fog Heen is listed as the registrant
* Visit https:/
* Verify that no registrant is listed:
Registered on <date>
Bug #568336 [Typo on profile workload page]
* Visit https:/
* Verify text:
Benjamin Humphrey is expected to work on, or is its creator
Bug #130285 [Disregard deleted projects from lists]
* Visit https:/
* Verify that PHProute is not in "Most active in"
Bug #557544 [Bad plural on team page ("1 active members")]
* Visit https:/
* Verify the page says 1 active member
Lint
----
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
Test
----
* lib/lp/
* Verified that distributions do not get a "registered by" line.
* lib/lp/
* Moved test from doctest to unittest.
* lib/lp/
* Verified singural and plural cases.
* lib/lp/
* Verified singural and plural cases.
* lib/lp/
* Lint hated this file. I removed a lot of unused imports and vars.
* I switched the tests to run on the faster DatabaseFunctio
* Added a test for Person.
and its private helpers. This also tests the new rule to not include
deactivate projects.
Implementation
--------------
* lib/lp/
* Discovered that the macro generated white-space that is inappropirate
for anchors and punctuation.
* lib/lp/
* Updated the template to use registrant, not owner, and only print
the "registered by" line if the pillar has a registrant.
* lib/lp/
* Removed redundant "or".
* lib/lp/
* Request 5 extra pillar names and built a list of 5 active pillars.
* lib/lp/
* Fixed plural rule for active, proposed, and pending membership.
Sorry that this makes the template hard to read.
Hi Curtis,
overall, a nice branch. I have though a few qestions regarding the
filtering of inactive projects for the karma display, so I'm marking
the MP as "needs information".
> === modified file 'lib/lp/ registry/ model/person. py' registry/ model/person. py 2010-04-19 21:16:12 +0000 registry/ model/person. py 2010-04-22 18:05:27 +0000 ategoriesContri butedTo( self, limit=5): tsWithTheMostKa rma(limit= limit) tsWithTheMostKa rma(limit= extra_limit)
> --- lib/lp/
> +++ lib/lp/
> @@ -850,12 +850,16 @@
> def getProjectsAndC
> """See `IPerson`."""
> contributions = []
> - results = self._getProjec
> - for pillar_name, karma in results:
> + # Pillars names have no concept of active. Extra pillars names are
> + # requested because deactivated pillars will be filtered out.
> + extra_limit = limit + 5
> + results = self._getProjec
> + for pillar_name, karma in results[:limit]:
While you retrieve 5 extra items calling _getProjectsWit hTheMostKarma( ),
you remove these extra items here ;)
> pillar = getUtility( IPillarNameSet) .getByName( pillar_ name) append( butedCategories (pillar) }) append( butedCategories (pillar) })
> - contributions.
> - {'project': pillar,
> - 'categories': self._getContri
> + if pillar.active:
> + contributions.
> + {'project': pillar,
> + 'categories': self._getContri
> return contributions
I think that should be
return contributions[ :limit]
combined with a loop over the full result set.
But: Did you consider to change the SQL query in the method hTheMostKarma( ) itself so that only activ projects only=False" )?
_getProjectsWit
are returned (if necessary, using an optional method parameter
"active_
While adding five extra items to the result set looks reasonable,
there is the (admittedly largely theoretical) situation that
the result set contains more than five inactive projects, so that
the length of the "effective" list is shorter than expected.
And I would prefer it anyway to do the filtering in hTheMostKarma( ), even if it would be too cumbersome
_getProjectsWit
to implement in SQL.
[...]
> === modified file 'lib/lp/ registry/ tests/test_ person. py' registry/ tests/test_ person. py 2010-02-11 19:26:26 +0000 registry/ tests/test_ person. py 2010-04-22 18:05:27 +0000
> --- lib/lp/
> +++ lib/lp/
[...]
> @@ -597,5 +601,103 @@ (TestCaseWithFa ctory): nalLayer nKarma, self).setUp() makePerson( ) makeProduct( name='aa' ) makeProduct( name='bb' ) makeProduct( name='cc' ) IKarmaCacheMana ger) Cache( Cache( Cache(
> assignee=self.user)
>
>
> +class TestPersonKarma
> +
> + layer = DatabaseFunctio
> +
> + def setUp(self):
> + super(TestPerso
> + self.person = self.factory.
> + a_product = self.factory.
> + b_product = self.factory.
> + self.c_product = self.factory.
> + self.cache_manager = getUtility(
> + self._makeKarma
> + self.person, a_product, [('bugs', 10)])
> + self._makeKarma
> + self.person, b_product, [('answers', 50)])
> + self._makeKarma
> + self....