Merge lp:~jcsackett/launchpad/projectgroup-branches-652156 into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | j.c.sackett on 2010-10-19 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 11771 |
| Proposed branch: | lp:~jcsackett/launchpad/projectgroup-branches-652156 |
| Merge into: | lp:launchpad |
| Diff against target: |
204 lines (+116/-4) 6 files modified
lib/lp/code/browser/tests/test_branchlisting.py (+33/-0) lib/lp/code/stories/branches/xx-project-branches.txt (+4/-2) lib/lp/code/templates/project-branches.pt (+27/-2) lib/lp/code/tests/test_project.py (+36/-0) lib/lp/registry/interfaces/projectgroup.py (+7/-0) lib/lp/registry/model/projectgroup.py (+9/-0) |
| To merge this branch: | bzr merge lp:~jcsackett/launchpad/projectgroup-branches-652156 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Curtis Hovey (community) | ui | Approve on 2010-10-19 | |
| Guilherme Salgado (community) | ui* | 2010-10-13 | Approve on 2010-10-15 |
| Edwin Grubbs (community) | code | 2010-10-13 | Approve on 2010-10-14 |
|
Review via email:
|
|||
Commit Message
Updates the projectgroup branches page to show a message consistent with the other codehosting_usage messages when there are no branches, instead of an empty table.
Description of the Change
Summary
=======
Updates the projectgroup branch listing page to display a message similar to other codehosting usage messages for other pillars (e.g. "<Product> does not use Launchpad for codehosting.")
Right now if no products are configured to have branches on Launchpad (the condition to set codehosting_usage to LAUNCHPAD), the project group simply shows an empty table with a message about using bazaar; in line with the bridging the gap tasks, it should simply state the the project group isn't using launchpad for codehosting, and be done with it.
Proposed fix
============
Detect when there are no branches and display the appropriate message instead of using the branch-listing portlet.
Preimplementation talk
=======
Spoke with Edwin Grubbs. We brought up the possiblity of linking out to all the products for the group so someone could configure the products, but to do so sanely (i.e. only show the links for products the viewer can configure) requires doing database checks for every product; this could lead to death by SQL timeouts.
Implementation details
=======
Largely as in proposed. A new property, has_branches, was added to projectgroups to check if there are any branches for the projectgroup's products. If this returns false, the message is shown.
Tests
=====
bin/test -vvct TestProjectBranches
bin/test -vvct TestProjectBran
Screenshots
===========
The old appearance is available at:
http://
The new appearance is available at:
http://
The appearance with any branches (in either case) is available at:
http://
Lint
====
make lint output:
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
| j.c.sackett (jcsackett) wrote : | # |
On Oct 14, 2010, at 11:07 AM, Edwin Grubbs wrote:
> Review: Approve code
> Hi JC,
>
> This branch looks good. I just have one comment below.
>
> -Edwin
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -421,5 +421,33 @@
>> self.assertIs(None, branches)
>>
>>
>> +class TestProjectBran
>> +
>> + layer = DatabaseFunctio
>> +
>> + def setUp(self):
>> + super(TestProje
>> + self.project = self.factory.
>> + self.product = self.factory.
>> +
>> + def test_no_
>> + # If there are no product branches on the project's products, then
>> + # the view shows the no code hosting message instead of a listing.
>> + browser = self.getUserBro
>> + canonical_
>> + expected_text = ("None of %s's projects are using Launchpad to host "
>> + "code." % self.project.
>> + no_branch_div = find_tag_
>> + text = extract_
>>
>>
>> You're missing an assertEqual or assertIn here.
Why yes. Yes I am. I'm not sure how that got deleted, but the fix is committed.
Thanks, Edwin.
| Guilherme Salgado (salgado) wrote : | # |
Hi Jon,
This looks good to me; I only have a couple comments below.
review approve ui*
On Wed, 2010-10-13 at 18:49 +0000, j.c.sackett wrote:
>
> Preimplementation talk
> =======
>
> Spoke with Edwin Grubbs. We brought up the possiblity of linking out
> to all the products for the group so someone could configure the
> products, but to do so sanely (i.e. only show the links for products
> the viewer can configure) requires doing database checks for every
> product; this could lead to death by SQL timeouts.
I think that a project group that doesn't have a single project using LP
for hosting code is unlikely to have more than a handful projects, so I
think we could afford these extra SQL queries in the name of a better
user experience.
That said, it's fine if you want to implement that in a separate branch,
as I might be wrong.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -17,8 +17,17 @@
> tal:condition=
> tal:content=
> </div>
> -
> - <tal:branchlisting content="structure branches/
> + <tal:no-branches
> + condition=
> + <div id="no-
> + <strong>None of <tal:project replace=
I've read somewhere
(<http://
to form the possessive we should add an 's regardless of the final
consonant, and your change is in line with that, but I'm not sure that's
the preferred style in Launchpad (in case we have one), so I'd like to
know what Curtis thinks.
> + projects are using Launchpad to host their code.</strong>
> + </div>
> + </tal:no-branches>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -222,6 +222,10 @@
> """See `IProjectGroup`."""
> return self.translatab
>
> + def has_branches(self):
> + """ See `IProjectGroup`."""
> + return self.getBranche
Can you use .is_empty() instead of .count() here? It is faster and we
don't really need the count here.
(I know this was supposed to be a UI review, but I thought it was worth
mentioning)
> +
> def _getBaseQueryAn
> query = """
> Product.project = %s
>
--
Guilherme Salgado <https:/
| j.c.sackett (jcsackett) wrote : | # |
> I think that a project group that doesn't have a single project using LP
> for hosting code is unlikely to have more than a handful projects, so I
> think we could afford these extra SQL queries in the name of a better
> user experience.
>
> That said, it's fine if you want to implement that in a separate branch,
> as I might be wrong.
I can buy your justification; I've added in that feature and attached an incremental.
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -222,6 +222,10 @@
>> """See `IProjectGroup`."""
>> return self.translatab
>>
>> + def has_branches(self):
>> + """ See `IProjectGroup`."""
>> + return self.getBranche
>
> Can you use .is_empty() instead of .count() here? It is faster and we
> don't really need the count here.
> (I know this was supposed to be a UI review, but I thought it was worth
> mentioning)
Taken care of.
| Guilherme Salgado (salgado) wrote : | # |
Thanks for implementing my suggestion, Jon. I think there's just one extra trivial change we can do to make for an even nicer user experience: link straight to the page where code hosting is configured rather than to the project's home page. You can easily do that with the following snippet, which has even been tested. ;)
<a tal:attributes=
| Curtis Hovey (sinzui) wrote : | # |
I think this message is inaccurate.
"None of <Project Groups>"'s are using Launchpad to host their code
Lots of contributors set the branch of project to be an import. The project is not using Launchpad to host code in the common meaning of "host". The user reading the message needs to know that none of the sub project's have register branches. Maybe I mean "told Launchpad where code is hosted" The main issue here is if I am an Ubuntu Contributor looking for the upstream branches, I do not expect Launchpad to host them, and as the group owner I should not think the projects must use Launchpad to enable the view. Using the project unknown code hosting message as a guide:
"Launchpad does not know where any of <Project Groups>"'s projects host their code.
| j.c.sackett (jcsackett) wrote : | # |
> Thanks for implementing my suggestion, Jon. I think there's just one extra
> trivial change we can do to make for an even nicer user experience: link
> straight to the page where code hosting is configured rather than to the
> project's home page. You can easily do that with the following snippet, which
> has even been tested. ;)
>
> <a tal:attributes=
> tal:content=
Sounds good; I've made that change.
| j.c.sackett (jcsackett) wrote : | # |
> "Launchpad does not know where any of <Project Groups>"'s projects host
> their code.
I buy this, and have pushed up changes.

Hi JC,
This branch looks good. I just have one comment below.
-Edwin
>=== modified file 'lib/lp/ code/browser/ tests/test_ branchlisting. py' code/browser/ tests/test_ branchlisting. py 2010-08-24 02:21:50 +0000 code/browser/ tests/test_ branchlisting. py 2010-10-14 14:37:22 +0000 chListing( TestCaseWithFac tory): nalLayer ctBranchListing , self).setUp() makeProject( ) makeProduct( project= self.project) branches_ gets_message_ not_listing( self): wser( url(self. project, rootsite='code')) displayname) by_id(browser. contents, "no-branchtable") text(no_ branch_ div) get_listing( self): makeProductBran ch(product= self.product) wser( url(self. project, rootsite='code')) by_id(browser. contents, "branchtable") t(None, table) TestLoader( ).loadTestsFrom Name(__ name__)
>--- lib/lp/
>+++ lib/lp/
>@@ -421,5 +421,33 @@
> self.assertIs(None, branches)
>
>
>+class TestProjectBran
>+
>+ layer = DatabaseFunctio
>+
>+ def setUp(self):
>+ super(TestProje
>+ self.project = self.factory.
>+ self.product = self.factory.
>+
>+ def test_no_
>+ # If there are no product branches on the project's products, then
>+ # the view shows the no code hosting message instead of a listing.
>+ browser = self.getUserBro
>+ canonical_
>+ expected_text = ("None of %s's projects are using Launchpad to host "
>+ "code." % self.project.
>+ no_branch_div = find_tag_
>+ text = extract_
>
>
>You're missing an assertEqual or assertIn here.
>
>
>+
>+ def test_branches_
>+ # If a product has a branch, then the project view has a branch
>+ # listing.
>+ branch = self.factory.
>+ browser = self.getUserBro
>+ canonical_
>+ table = find_tag_
>+ self.assertIsNo
>+
> def test_suite():
> return unittest.
>