← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~bac/launchpad/bug-662994 into lp:launchpad

 

Brad Crittenden has proposed merging lp:~bac/launchpad/bug-662994 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #662994 ~registry cannot rename a project group
  https://bugs.launchpad.net/bugs/662994


= Summary =

Registry admins should be able to change a project group's name.

== Proposed fix ==

Move the name attribute to launchpad.Moderate.  This change means that
project group owners will no longer be able to change the name.

== Pre-implementation notes ==

Long chat with Curtis.
See bug 633926 for a fuller discussion of the problem.

== Implementation details ==

As above.

== Tests ==

bin/test -vvm lp.registry -t xx-project-edit.txt

== Demo and Q/A ==

As a registry expert 'Review' a project and verify the name can be changed.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/stories/project/xx-project-edit.txt
  lib/lp/registry/interfaces/projectgroup.py
  lib/lp/registry/browser/project.py
-- 
https://code.launchpad.net/~bac/launchpad/bug-662994/+merge/43299
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/launchpad/bug-662994 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/project.py'
--- lib/lp/registry/browser/project.py	2010-12-01 04:27:44 +0000
+++ lib/lp/registry/browser/project.py	2010-12-09 21:26:57 +0000
@@ -354,7 +354,7 @@
     label = "Change project group details"
     schema = IProjectGroup
     field_names = [
-        'name', 'displayname', 'title', 'summary', 'description',
+        'displayname', 'title', 'summary', 'description',
         'bug_reporting_guidelines', 'bug_reported_acknowledgement',
         'homepageurl', 'bugtracker', 'sourceforgeproject',
         'freshmeatproject', 'wikiurl']
@@ -388,8 +388,10 @@
         self.field_names = self.default_field_names[:]
         admin = check_permission('launchpad.Admin', self.context)
         if not admin:
+            self.field_names.remove('owner')
+        moderator = check_permission('launchpad.Moderate', self.context)
+        if not moderator:
             self.field_names.remove('name')
-            self.field_names.remove('owner')
         super(ProjectReviewView, self).setUpFields()
         self.form_fields = self._createAliasesField() + self.form_fields
         if admin:

=== modified file 'lib/lp/registry/interfaces/projectgroup.py'
--- lib/lp/registry/interfaces/projectgroup.py	2010-12-01 20:53:19 +0000
+++ lib/lp/registry/interfaces/projectgroup.py	2010-12-09 21:26:57 +0000
@@ -104,6 +104,15 @@
             title=_('Reviewed'), required=False,
             description=_("Whether or not this project group has been "
                           "reviewed.")))
+    name = exported(
+        ProjectNameField(
+            title=_('Name'),
+            required=True,
+            description=_(
+                "A unique name, used in URLs, identifying the project "
+                "group.  All lowercase, no special characters. "
+                "Examples: apache, mozilla, gimp."),
+            constraint=name_validator))
 
 
 class IProjectGroupPublic(
@@ -133,16 +142,6 @@
             description=_("Project group registrant. Must be a valid "
                           "Launchpad Person.")))
 
-    name = exported(
-        ProjectNameField(
-            title=_('Name'),
-            required=True,
-            description=_(
-                "A unique name, used in URLs, identifying the project "
-                "group.  All lowercase, no special characters. "
-                "Examples: apache, mozilla, gimp."),
-            constraint=name_validator))
-
     displayname = exported(
         TextLine(
             title=_('Display Name'),

=== modified file 'lib/lp/registry/stories/project/xx-project-edit.txt'
--- lib/lp/registry/stories/project/xx-project-edit.txt	2010-08-20 18:13:20 +0000
+++ lib/lp/registry/stories/project/xx-project-edit.txt	2010-12-09 21:26:57 +0000
@@ -10,7 +10,6 @@
     Change project group details...
 
     >>> soup = find_main_content(browser.contents)
-    >>> browser.getControl(name='field.name').value = 'new-name'
     >>> browser.getControl('Display Name').value = 'New Name'
     >>> browser.getControl('Title').value = 'New Title'
     >>> browser.getControl('Project Group Summary').value = 'New Summary.'
@@ -20,7 +19,7 @@
     >>> browser.getControl('Change Details').click()
 
     >>> print browser.url
-    http://launchpad.dev/new-name
+    http://launchpad.dev/gnome
 
 Regular users can't access the +review page.
 
@@ -31,18 +30,19 @@
 
 But administrators can access the page:
 
-    >>> admin_browser.open('http://launchpad.dev/new-name')
+    >>> admin_browser.open('http://launchpad.dev/gnome')
     >>> admin_browser.getLink('Administer').click()
 
     >>> print admin_browser.url
-    http://launchpad.dev/new-name/+review
+    http://launchpad.dev/gnome/+review
 
     >>> print admin_browser.title
     Review upstream project group...
 
-Mark the project as reviewed.
+Mark the project as reviewed and change the name.
 
     >>> admin_browser.getControl('Reviewed').selected = True
+    >>> admin_browser.getControl(name='field.name').value = 'new-name'
     >>> admin_browser.getControl('Change').click()
 
     >>> print admin_browser.url
@@ -148,17 +148,14 @@
     Traceback (most recent call last):
     ...
     LookupError: label 'Registrant'
-    >>> expert_browser.getControl('Name')
-    Traceback (most recent call last):
-    ...
-    LookupError: label 'Name'
 
+    >>> expert_browser.getControl('Name').value = 'newer-name'
     >>> expert_browser.getControl('Aliases').value = 'sleepy'
     >>> expert_browser.getControl('Active').selected = False
     >>> expert_browser.getControl('Reviewed').selected = False
     >>> expert_browser.getControl('Change').click()
 
-    >>> expert_browser.open('http://launchpad.dev/new-name')
+    >>> expert_browser.open('http://launchpad.dev/newer-name')
     >>> expert_browser.getLink('Administer').click()
     >>> print expert_browser.getControl('Aliases').value
     sleepy