launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02067
[Merge] lp:~bac/launchpad/bug-674897 into lp:launchpad
Brad Crittenden has proposed merging lp:~bac/launchpad/bug-674897 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#674897 nameblacklist+edit has broken breadcrumb
https://bugs.launchpad.net/bugs/674897
= Summary =
The breadcrumbs for editing a NameBlackList regex have a link to a
non-traversable element.
== Proposed fix ==
Remove that part of the breadcrumb chain.
== Pre-implementation notes ==
Chat with Curtis.
== Implementation details ==
Easy fix; remove the adapter and the breadcrumb isn't created for that
portion of the traversal.
== Tests ==
bin/test -vvm lp.registry -t test_breadcrumbs
== Demo and Q/A ==
Go to https://launchpad.dev/+nameblacklist, edit an existing one and
verify the breadcrumb does not include the regex.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/registry/browser/configure.zcml
lib/canonical/launchpad/pagetests/REFERENCE.txt
lib/lp/registry/browser/tests/test_breadcrumbs.py
lib/lp/registry/browser/nameblacklist.py
--
https://code.launchpad.net/~bac/launchpad/bug-674897/+merge/42238
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/launchpad/bug-674897 into lp:launchpad.
=== modified file 'lib/canonical/launchpad/pagetests/REFERENCE.txt'
--- lib/canonical/launchpad/pagetests/REFERENCE.txt 2008-09-23 13:02:41 +0000
+++ lib/canonical/launchpad/pagetests/REFERENCE.txt 2010-11-30 13:56:50 +0000
@@ -217,20 +217,19 @@
If you get:
- AttributeError: 'zope.thread.local' object has no attribute 'interaction'
+ AttributeError: 'thread._local' object has no attribute 'interaction'
This means you are trying to getUtility() and aren't logged in.
Use something like this:
-If you get:
-
>>> from canonical.launchpad.ftests import ANONYMOUS, login, logout
>>> login(ANONYMOUS)
+If you get:
+
AssertionError: newInteraction called while another interaction is
active.
This means you forgot to log out:
>>> logout()
-
=== modified file 'lib/lp/registry/browser/configure.zcml'
--- lib/lp/registry/browser/configure.zcml 2010-11-22 23:08:45 +0000
+++ lib/lp/registry/browser/configure.zcml 2010-11-30 13:56:50 +0000
@@ -1607,10 +1607,6 @@
<adapter
factory="lp.registry.browser.nameblacklist.NameBlacklistSetBreadcrumb"
/>
- <adapter
- factory="lp.registry.browser.nameblacklist.NameBlacklistBreadcrumb"
- />
-
<browser:page
name="+addseries"
for="lp.registry.interfaces.product.IProduct"
=== modified file 'lib/lp/registry/browser/nameblacklist.py'
--- lib/lp/registry/browser/nameblacklist.py 2010-11-23 23:22:27 +0000
+++ lib/lp/registry/browser/nameblacklist.py 2010-11-30 13:56:50 +0000
@@ -162,14 +162,3 @@
implements(IBreadcrumb)
text = "Name Blacklist"
-
-
-@adapter(INameBlacklist)
-class NameBlacklistBreadcrumb(Breadcrumb):
- """Return a breadcrumb for an `INameBlackList`."""
-
- implements(IBreadcrumb)
-
- @property
- def text(self):
- return self.context.regexp
=== modified file 'lib/lp/registry/browser/tests/test_breadcrumbs.py'
--- lib/lp/registry/browser/tests/test_breadcrumbs.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/tests/test_breadcrumbs.py 2010-11-30 13:56:50 +0000
@@ -125,6 +125,32 @@
last_crumb = crumbs[-1]
self.assertEqual(self.poll.title, last_crumb.text)
+from lp.registry.interfaces.nameblacklist import INameBlacklistSet
+
+
+class TestNameblacklistBreadcrumb(BaseBreadcrumbTestCase):
+ """Test breadcrumbs for +nameblacklist."""
+
+ def setUp(self):
+ super(TestNameblacklistBreadcrumb, self).setUp()
+ self.name_blacklist_set = getUtility(INameBlacklistSet)
+ self.registry_expert = self.factory.makeRegistryExpert()
+ login_person(self.registry_expert)
+
+ def test_nameblacklist(self):
+ expected = [('Name Blacklist', 'http://launchpad.dev/+nameblacklist')]
+ self.assertBreadcrumbs(expected, self.name_blacklist_set)
+
+ def test_nameblacklist_edit(self):
+ blacklist = self.name_blacklist_set.getByRegExp(u'blacklist')
+ expected = [
+ ('Name Blacklist',
+ 'http://launchpad.dev/+nameblacklist'),
+ ('Edit a blacklist expression',
+ 'http://launchpad.dev/+nameblacklist/1/+edit'),
+ ]
+ self.assertBreadcrumbs(expected, blacklist, view_name='+edit')
+
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)