launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15310
[Merge] lp:~allenap/maas/accounts-view-patterns into lp:maas
Gavin Panella has proposed merging lp:~allenap/maas/accounts-view-patterns into lp:maas.
Commit message:
Ensure that all account views are routable by a full range of possible usernames.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1151969 in MAAS: "URL pattern for accounts-view does not allow hyphens"
https://bugs.launchpad.net/maas/+bug/1151969
For more details, see:
https://code.launchpad.net/~allenap/maas/accounts-view-patterns/+merge/152185
--
https://code.launchpad.net/~allenap/maas/accounts-view-patterns/+merge/152185
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/accounts-view-patterns into lp:maas.
=== modified file 'src/maasserver/tests/test_views_settings.py'
--- src/maasserver/tests/test_views_settings.py 2012-11-13 10:44:22 +0000
+++ src/maasserver/tests/test_views_settings.py 2013-03-07 15:00:54 +0000
@@ -374,3 +374,10 @@
content_text = doc.cssselect('#content')[0].text_content()
self.assertIn(user.username, content_text)
self.assertIn(user.email, content_text)
+
+ def test_account_views_are_routable_for_full_range_of_usernames(self):
+ # Usernames can include charaters in the regex [\w.@+-].
+ user = factory.make_user(username="abc-123@xxxxxxxxxxx")
+ for view in "edit", "view", "del":
+ path = reverse("accounts-%s" % view, args=[user.username])
+ self.assertIsInstance(path, (str, unicode))
=== modified file 'src/maasserver/urls.py'
--- src/maasserver/urls.py 2013-02-08 18:26:41 +0000
+++ src/maasserver/urls.py 2013-03-07 15:00:54 +0000
@@ -162,13 +162,13 @@
adminurl(r'^settings/$', settings, name='settings'),
adminurl(r'^accounts/add/$', AccountsAdd.as_view(), name='accounts-add'),
adminurl(
- r'^accounts/(?P<username>\w+)/edit/$', AccountsEdit.as_view(),
+ r'^accounts/(?P<username>[^/]+)/edit/$', AccountsEdit.as_view(),
name='accounts-edit'),
adminurl(
- r'^accounts/(?P<username>\w+)/view/$', AccountsView.as_view(),
+ r'^accounts/(?P<username>[^/]+)/view/$', AccountsView.as_view(),
name='accounts-view'),
adminurl(
- r'^accounts/(?P<username>\w+)/del/$', AccountsDelete.as_view(),
+ r'^accounts/(?P<username>[^/]+)/del/$', AccountsDelete.as_view(),
name='accounts-del'),
adminurl(
r'^commissioning-scripts/(?P<id>[\w\-]+)/delete/$',