← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/fix-missing-add-distro-link into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/fix-missing-add-distro-link into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #728553 Distributions page should have a link to create a new distribution.
  https://bugs.launchpad.net/bugs/728553

For more details, see:
https://code.launchpad.net/~rvb/launchpad/fix-missing-add-distro-link/+merge/52104

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added a link to create a new distribution to the distributions page
(shown only to admin users).

The permission check will probably need to be against another permission
than 'launchpad.Admin' once the permission model for creating
distributions is in place.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/soyuz/stories/soyuz/xx-distribution-add.txt
  lib/lp/registry/browser/menu.py
  lib/lp/registry/browser/distribution.py

./lib/lp/soyuz/stories/soyuz/xx-distribution-add.txt
       1: narrative uses a moin header.
       3: narrative has trailing whitespace.
       6: source has bad indentation.
      14: source has bad indentation.
      20: source has bad indentation.
      27: source has bad indentation.
      31: source has bad indentation.
      35: source exceeds 78 characters.
      39: source has bad indentation.
      43: source has bad indentation.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJNb853AAoJEMC8revFINFckd0P/1p5rcdp1TXvUNOUAoHO5fMD
n5sP05zCUC/2hVCu1d0OOJTFWD9f0XIemKx2g9dIlb9/umqsn4smJ//o2N2Ldfvk
2+6gIc35r7/QfHLMxDhnhm15IV9Ln1XE118OCjj1k5Aclbgnh3PFNMUPTtW5vhHu
BMw19mZaMZMZpnOapOrYR876QNCyh1yn7VzuBwDL+IKn0tcYSKDjy9yvZOAIvLUm
tvp1mVIbWLvnssjqpz0UtWXlwkaeZQf3zPLRdwncW7WJanAgNYourxjCxHXxPGhX
uCD1ap8ufLwUTE8DdlJknYOrtjM2+lUuM96yur4hfsI2otlpGj7TSuKut8lzLkMp
fcJzMECvkEDvodqeAIq+9L95iWT27981NlPV4dNXtAG1w4SIKw+KK2XlvDvjwklR
3zXQ9I6i85UcZAQmEiJwDv+GQMoMJd9Rrze6QiBpewZq+nXQ6RYnGkp5FWPBSmrI
pkBPEi9FhIsVDQtfIUB18OWZSaoBRZuE60noGgbYuz55vHL4cGngcXSZnbOVaxsI
BOEngVMMaJTMhA8BEkBVVcBDAi8msSmWQHSWG+U6lUKXIgtYVgZLC8+c1/poOGo2
JGYaeEn6sDdcFOtEz5vEwXi+30EOl1RtpeyBRmdNrLAC5Kf7iffuNMDYwGCDO/Xw
xRHdSkx+0oPrpdYbI57m
=6flm
-----END PGP SIGNATURE-----
-- 
https://code.launchpad.net/~rvb/launchpad/fix-missing-add-distro-link/+merge/52104
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/fix-missing-add-distro-link into lp:launchpad.
=== modified file 'lib/lp/registry/browser/distribution.py'
--- lib/lp/registry/browser/distribution.py	2011-02-03 10:35:36 +0000
+++ lib/lp/registry/browser/distribution.py	2011-03-03 17:49:43 +0000
@@ -714,7 +714,8 @@
     """Action menu for `DistributionSetView`."""
 
     usedfor = IDistributionSet
-    links = ['register_team', 'register_project', 'create_account']
+    links = ['register_team', 'register_project', 'register_distribution',
+        'create_account']
 
 
 class DistributionSetView(LaunchpadView):

=== modified file 'lib/lp/registry/browser/menu.py'
--- lib/lp/registry/browser/menu.py	2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/menu.py	2011-03-03 17:49:43 +0000
@@ -47,6 +47,14 @@
         text = 'Register a team'
         return Link('/people/+newteam', text, icon='add')
 
+    # TODO: rvb 20110103 DISTRO.PERMISSIONS
+    # this should be checked against the right permission once
+    # the permission model for distributions is in place
+    @enabled_with_permission('launchpad.Admin')
+    def register_distribution(self):
+        text = 'Register a distribution'
+        return Link('/distros/+add', text, icon='add')
+
     def create_account(self):
         text = 'Create an account'
         # Only enable this link for anonymous users.

=== modified file 'lib/lp/soyuz/stories/soyuz/xx-distribution-add.txt'
--- lib/lp/soyuz/stories/soyuz/xx-distribution-add.txt	2009-08-13 15:12:16 +0000
+++ lib/lp/soyuz/stories/soyuz/xx-distribution-add.txt	2011-03-03 17:49:43 +0000
@@ -1,6 +1,21 @@
 = Creating new distributions =
 
-This can be done only by launchpad admins.
+A non launchpad admin doesn't see the link to create a new distribution on 
+the distributions page:
+
+  >>> user_browser.open("http://launchpad.dev/distros";)
+  >>> user_browser.getLink("Register a distribution")
+  Traceback (most recent call last):
+  ...
+  LinkNotFoundError
+
+A launchpad admin sees the link to create a new distribution:
+
+  >>> admin_browser.open("http://launchpad.dev/distros";)
+  >>> admin_browser.getLink("Register a distribution").url
+  'http://launchpad.dev/distros/+add'
+
+A launchpad admin can create a new distribution:
 
   >>> user_browser.open("http://launchpad.dev/distros/+add";)
   Traceback (most recent call last):


References