Merge lp:~bac/launchpad/bug-674897 into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 12003
Proposed branch: lp:~bac/launchpad/bug-674897
Merge into: lp:launchpad
Diff against target: 199 lines (+59/-42)
4 files modified
lib/canonical/launchpad/pagetests/REFERENCE.txt (+33/-27)
lib/lp/registry/browser/configure.zcml (+0/-4)
lib/lp/registry/browser/nameblacklist.py (+0/-11)
lib/lp/registry/browser/tests/test_breadcrumbs.py (+26/-0)
To merge this branch: bzr merge lp:~bac/launchpad/bug-674897
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+42238@code.launchpad.net

Commit message

[r=gmb][ui=none][bug=674897] Remove intermediate breadcrumb from name blacklist edit page as it is not traversable.

Description of the change

= 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

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 15:31:40 +0000
@@ -1,4 +1,5 @@
1= Kiko's wonderfully incomplete testbrowser reference manual for dummies =1Kiko's wonderfully incomplete testbrowser reference manual for dummies
2======================================================================
23
3Opening pages:4Opening pages:
45
@@ -31,7 +32,8 @@
31 True32 True
3233
3334
34== Debugging ==35Debugging
36---------
3537
36If you need to debug a pagetest, you can use the convenient 'stop()' method38If you need to debug a pagetest, you can use the convenient 'stop()' method
37exported into pagetest globals. This is essentially the same as importing pdb39exported into pagetest globals. This is essentially the same as importing pdb
@@ -49,7 +51,8 @@
49appserver will be unhappy.51appserver will be unhappy.
5052
5153
52== Parsing content ==54Parsing content
55---------------
5356
54Parsing specific sections of pages:57Parsing specific sections of pages:
5558
@@ -73,7 +76,7 @@
73 >>> print extract_text(html_string, extract_image_text=True)76 >>> print extract_text(html_string, extract_image_text=True)
74 Here's some text with an image.77 Here's some text with an image.
7578
76 >>> html_string = "<img src="/@@/bar" alt="Alt text works too." />"79 >>> html_string = """<img src="/@@/bar" alt="Alt text works too." />"""
77 >>> print extract_text(html_string, extract_image_text=True)80 >>> print extract_text(html_string, extract_image_text=True)
78 Alt text works too.81 Alt text works too.
7982
@@ -110,21 +113,22 @@
110113
111Using BeautifulSoup in all its glory:114Using BeautifulSoup in all its glory:
112115
113 >>> from BeautifulSoup import BeautifulSoup, SoupStrainer116 >>> from BeautifulSoup import BeautifulSoup, SoupStrainer
114 >>> anon_browser.open("http://launchpad.dev/~name16")117 >>> anon_browser.open("http://launchpad.dev/~name16")
115 >>> strainer = SoupStrainer(['link'], {'type': ['application/rdf+xml']})118 >>> strainer = SoupStrainer(['link'], {'type': ['application/rdf+xml']})
116 >>> soup = BeautifulSoup(anon_browser.contents, parseOnlyThese=strainer)119 >>> soup = BeautifulSoup(anon_browser.contents, parseOnlyThese=strainer)
117 >>> print soup.renderContents()120 >>> print soup.renderContents()
118 <link rel="meta" type="application/rdf+xml" title="FOAF" href="+rdf" />121 <link rel="meta" type="application/rdf+xml" title="FOAF" href="+rdf" />
119122
120 >>> strainer = SoupStrainer({'class': ['error']})123 >>> strainer = SoupStrainer({'class': ['error']})
121 >>> soup = BeautifulSoup(anon_browser.contents, parseOnlyThese=strainer)124 >>> soup = BeautifulSoup(anon_browser.contents, parseOnlyThese=strainer)
122 >>> for tag in soup:125 >>> for tag in soup:
123 ... print extract_text(tag)126 ... print extract_text(tag)
124 Quantities must be greater than or equal 0.127 Quantities must be greater than or equal 0.
125128
126129
127== Links ==130Links
131-----
128132
129Manipulating links:133Manipulating links:
130134
@@ -163,7 +167,8 @@
163 u'http://launchpad.dev/foo'167 u'http://launchpad.dev/foo'
164168
165169
166== Form Controls ==170Form Controls
171-------------
167172
168Basics:173Basics:
169174
@@ -202,7 +207,8 @@
202 'http://where-you-went-after-posting/'207 'http://where-you-went-after-posting/'
203208
204209
205== Committing transactions ==210Committing transactions
211-----------------------
206212
207The transaction module is already imported into your pagetest's globals, so213The transaction module is already imported into your pagetest's globals, so
208just do:214just do:
@@ -213,24 +219,24 @@
213You do not need to be logged in to do this.219You do not need to be logged in to do this.
214220
215221
216== Gotchas ==222Gotchas
223-------
217224
218If you get:225If you get:
219226
220 AttributeError: 'zope.thread.local' object has no attribute 'interaction'227 AttributeError: 'thread._local' object has no attribute 'interaction'
221228
222This means you are trying to getUtility() and aren't logged in.229This means you are trying to getUtility() and aren't logged in.
223Use something like this:230Use something like this:
224231
225If you get:
226
227 >>> from canonical.launchpad.ftests import ANONYMOUS, login, logout232 >>> from canonical.launchpad.ftests import ANONYMOUS, login, logout
228 >>> login(ANONYMOUS)233 >>> login(ANONYMOUS)
229234
235If you get:
236
230 AssertionError: newInteraction called while another interaction is237 AssertionError: newInteraction called while another interaction is
231 active.238 active.
232239
233This means you forgot to log out:240This means you forgot to log out:
234241
235 >>> logout()242 >>> logout()
236
237243
=== 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 15:31:40 +0000
@@ -1607,10 +1607,6 @@
1607 <adapter1607 <adapter
1608 factory="lp.registry.browser.nameblacklist.NameBlacklistSetBreadcrumb"1608 factory="lp.registry.browser.nameblacklist.NameBlacklistSetBreadcrumb"
1609 />1609 />
1610 <adapter
1611 factory="lp.registry.browser.nameblacklist.NameBlacklistBreadcrumb"
1612 />
1613
1614 <browser:page1610 <browser:page
1615 name="+addseries"1611 name="+addseries"
1616 for="lp.registry.interfaces.product.IProduct"1612 for="lp.registry.interfaces.product.IProduct"
16171613
=== 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 15:31:40 +0000
@@ -162,14 +162,3 @@
162 implements(IBreadcrumb)162 implements(IBreadcrumb)
163163
164 text = "Name Blacklist"164 text = "Name Blacklist"
165
166
167@adapter(INameBlacklist)
168class NameBlacklistBreadcrumb(Breadcrumb):
169 """Return a breadcrumb for an `INameBlackList`."""
170
171 implements(IBreadcrumb)
172
173 @property
174 def text(self):
175 return self.context.regexp
176165
=== 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 15:31:40 +0000
@@ -125,6 +125,32 @@
125 last_crumb = crumbs[-1]125 last_crumb = crumbs[-1]
126 self.assertEqual(self.poll.title, last_crumb.text)126 self.assertEqual(self.poll.title, last_crumb.text)
127127
128from lp.registry.interfaces.nameblacklist import INameBlacklistSet
129
130
131class TestNameblacklistBreadcrumb(BaseBreadcrumbTestCase):
132 """Test breadcrumbs for +nameblacklist."""
133
134 def setUp(self):
135 super(TestNameblacklistBreadcrumb, self).setUp()
136 self.name_blacklist_set = getUtility(INameBlacklistSet)
137 self.registry_expert = self.factory.makeRegistryExpert()
138 login_person(self.registry_expert)
139
140 def test_nameblacklist(self):
141 expected = [('Name Blacklist', 'http://launchpad.dev/+nameblacklist')]
142 self.assertBreadcrumbs(expected, self.name_blacklist_set)
143
144 def test_nameblacklist_edit(self):
145 blacklist = self.name_blacklist_set.getByRegExp(u'blacklist')
146 expected = [
147 ('Name Blacklist',
148 'http://launchpad.dev/+nameblacklist'),
149 ('Edit a blacklist expression',
150 'http://launchpad.dev/+nameblacklist/1/+edit'),
151 ]
152 self.assertBreadcrumbs(expected, blacklist, view_name='+edit')
153
128154
129def test_suite():155def test_suite():
130 return unittest.TestLoader().loadTestsFromName(__name__)156 return unittest.TestLoader().loadTestsFromName(__name__)