launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06386
[Merge] lp:~stevenk/launchpad/better-name-field into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/better-name-field into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #494801 in Launchpad itself: "Error for name field on team/project creation is vague"
https://bugs.launchpad.net/launchpad/+bug/494801
Bug #932192 in Launchpad itself: "team visibility field changes the name, but I cannot see that"
https://bugs.launchpad.net/launchpad/+bug/932192
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/better-name-field/+merge/93317
Firstly, slightly change the blacklisted message, and remove some duplication.
Also re-order the visibility field after we re-add it to the form if the user is permitted to set it.
Remove the JS that was adding private- to the name field when the visibility was changed.
--
https://code.launchpad.net/~stevenk/launchpad/better-name-field/+merge/93317
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/better-name-field into lp:launchpad.
=== modified file 'lib/lp/registry/browser/team.py'
--- lib/lp/registry/browser/team.py 2012-02-13 23:02:42 +0000
+++ lib/lp/registry/browser/team.py 2012-02-15 23:02:22 +0000
@@ -278,6 +278,9 @@
if self.user and self.user.checkAllowVisibility():
visibility = copy_field(ITeam['visibility'], readonly=False)
self.form_fields += Fields(visibility)
+ # We'd like visibility near the top. Eyes closed, please.
+ field = self.form_fields.__FormFields_seq__.pop()
+ self.form_fields.__FormFields_seq__.insert(2, field)
class TeamEditView(TeamFormMixin, PersonRenameFormMixin,
=== modified file 'lib/lp/registry/browser/tests/private-team-creation-views.txt'
--- lib/lp/registry/browser/tests/private-team-creation-views.txt 2010-10-19 18:44:31 +0000
+++ lib/lp/registry/browser/tests/private-team-creation-views.txt 2012-02-15 23:02:22 +0000
@@ -172,6 +172,7 @@
>>> for error in view.errors:
... print view.getFieldError(error.field_name)
The name 'secret-team' has been blocked by the Launchpad administrators.
+ Please contact Launchpad Support.
= Private Team Editing =
@@ -422,4 +423,4 @@
>>> for error in view.errors:
... print view.getFieldError(error.field_name)
The name 'private-top-secret' has been blocked by the Launchpad
- administrators.
+ administrators. Please contact Launchpad Support.
=== modified file 'lib/lp/registry/interfaces/person.py'
--- lib/lp/registry/interfaces/person.py 2012-02-15 02:24:38 +0000
+++ lib/lp/registry/interfaces/person.py 2012-02-15 23:02:22 +0000
@@ -524,9 +524,6 @@
"""
errormessage = _("%s is already in use by another person or team.")
- blacklistmessage = _("The name '%s' has been blocked by the Launchpad "
- "administrators.")
-
@property
def _content_iface(self):
"""Return the interface this field belongs to."""
=== modified file 'lib/lp/registry/templates/people-newteam.pt'
--- lib/lp/registry/templates/people-newteam.pt 2009-08-31 17:46:33 +0000
+++ lib/lp/registry/templates/people-newteam.pt 2012-02-15 23:02:22 +0000
@@ -16,7 +16,6 @@
language.
</p>
</div>
- <metal:js use-macro="context/@@+person-macros/private-team-js" />
</div>
</body>
</html>
=== modified file 'lib/lp/registry/templates/person-macros.pt'
--- lib/lp/registry/templates/person-macros.pt 2012-02-01 15:31:32 +0000
+++ lib/lp/registry/templates/person-macros.pt 2012-02-15 23:02:22 +0000
@@ -242,40 +242,4 @@
</tr>
</metal:macro>
-
-<metal:macro define-macro="private-team-js">
- <tal:comment replace="nothing">
- This macro inserts the javascript necessary to automatically insert the
- private team prefix into a name field. It is here since it is shared in
- multiple templates.
- </tal:comment>
- <tal:script define="private_prefix view/private_prefix|nothing"
- condition="private_prefix">
- <script type="text/javascript"
- tal:content="string:
- LPJS.use('node', 'event', function(Y) {
- // Prepend/remove 'private-' from team name based on visibility
- // setting. User can choose to edit it back out, if they wish.
- function visibility_on_change(e) {
- var visibility = e.target;
- var prefix = (visibility.get('value') == 'PRIVATE')
- ? '$private_prefix' : '';
- // XXX: Brad Crittenden 2009-01-30
- // bug=http://yuilibrary.com/projects/yui3/ticket/2423101
- // Dotted CSS selectors not parsed correctly. Therefore not
- // using Y.one().
- var name = document.getElementById('field.name');
- name.value = prefix + name.value.replace(/^$private_prefix/, '');
-
- };
- // Attach the function to the onchange event.
- // XXX: Brad Crittenden 2009-01-30
- // bug=http://yuilibrary.com/projects/yui3/ticket/2423101
- // Dotted CSS selectors not parsed correctly.
- Y.on('change', visibility_on_change, document.getElementById('field.visibility'));
- });">
- </script>
- </tal:script>
-</metal:macro>
-
</tal:root>
=== modified file 'lib/lp/registry/templates/team-edit.pt'
--- lib/lp/registry/templates/team-edit.pt 2009-08-17 02:34:16 +0000
+++ lib/lp/registry/templates/team-edit.pt 2012-02-15 23:02:22 +0000
@@ -12,13 +12,8 @@
<body>
<div metal:fill-slot="main">
-
<div metal:use-macro="context/@@launchpad_form/form" />
-
- <metal:js use-macro="context/@@+person-macros/private-team-js" />
-
<tal:menu replace="structure view/@@+related-pages" />
-
</div>
</body>
</html>
=== modified file 'lib/lp/services/fields/__init__.py'
--- lib/lp/services/fields/__init__.py 2012-01-18 22:32:10 +0000
+++ lib/lp/services/fields/__init__.py 2012-02-15 23:02:22 +0000
@@ -490,6 +490,9 @@
class BlacklistableContentNameField(ContentNameField):
"""ContentNameField that also checks that a name is not blacklisted"""
+ blacklistmessage = _("The name '%s' has been blocked by the Launchpad "
+ "administrators. Please contact Launchpad Support.")
+
def _validate(self, input):
"""Check that the given name is valid, unique and not blacklisted."""
super(BlacklistableContentNameField, self)._validate(input)
@@ -505,9 +508,7 @@
from lp.registry.interfaces.person import IPersonSet
user = getUtility(ILaunchBag).user
if getUtility(IPersonSet).isNameBlacklisted(input, user):
- raise LaunchpadValidationError(
- "The name '%s' has been blocked by the Launchpad "
- "administrators." % input)
+ raise LaunchpadValidationError(self.blacklistmessage % input)
class PillarAliases(TextLine):