Merge lp:~rockstar/launchpad/junk-recipe-listings into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 11237
Proposed branch: lp:~rockstar/launchpad/junk-recipe-listings
Merge into: lp:launchpad
Diff against target: 64 lines (+4/-14)
3 files modified
lib/lp/code/browser/sourcepackagerecipebuild.py (+2/-11)
lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py (+1/-2)
lib/lp/code/templates/sourcepackagerecipe-listing.pt (+1/-1)
To merge this branch: bzr merge lp:~rockstar/launchpad/junk-recipe-listings
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+30990@code.launchpad.net

Description of the change

This branch was actually supposed to fix another bug, so the name is misleading. The actual fix in here was intended to be a driveby fix. However, I apparently had already fixed that other bug and never marked it Fix Committed. I figure this branch is still got some good in it, so I'll propose it for merging.

I was using zope.schema.Text for the Rescore field in the rescore builds. Apparently that means "use a TextArea" which is totally braindead. I swapped it to zope.schema.Int, which meant that I could completely remove the validate method from that view, because the type already makes the same check.

No lint.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/sourcepackagerecipebuild.py'
2--- lib/lp/code/browser/sourcepackagerecipebuild.py 2010-07-24 14:27:15 +0000
3+++ lib/lp/code/browser/sourcepackagerecipebuild.py 2010-07-26 21:19:47 +0000
4@@ -14,7 +14,7 @@
5 ]
6
7 from zope.interface import Interface
8-from zope.schema import Text
9+from zope.schema import Int
10
11 from canonical.launchpad.browser.librarian import FileNavigationMixin
12 from canonical.launchpad.webapp import (
13@@ -146,7 +146,7 @@
14
15 class schema(Interface):
16 """Schema for deleting a build."""
17- score = Text(
18+ score = Int(
19 title=u'Score', required=True,
20 description=u'The score of the recipe.')
21
22@@ -157,15 +157,6 @@
23 return canonical_url(self.context)
24 next_url = cancel_url
25
26- def validate(self, data):
27- try:
28- score = int(data['score'])
29- except ValueError:
30- self.setFieldError(
31- 'score',
32- 'You have specified an invalid value for score. '
33- 'Please specify an integer')
34-
35 @action('Rescore build', name='rescore')
36 def request_action(self, action, data):
37 """Rescore the build."""
38
39=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py'
40--- lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py 2010-07-24 14:15:27 +0000
41+++ lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py 2010-07-26 21:19:47 +0000
42@@ -162,8 +162,7 @@
43
44 self.assertEqual(
45 extract_text(find_tags_by_class(browser.contents, 'message')[1]),
46- 'You have specified an invalid value for score. '
47- 'Please specify an integer')
48+ 'Invalid integer data')
49
50 def test_rescore_build_not_admin(self):
51 """No one but admins can rescore a build."""
52
53=== modified file 'lib/lp/code/templates/sourcepackagerecipe-listing.pt'
54--- lib/lp/code/templates/sourcepackagerecipe-listing.pt 2010-06-15 18:24:04 +0000
55+++ lib/lp/code/templates/sourcepackagerecipe-listing.pt 2010-07-26 21:19:47 +0000
56@@ -33,7 +33,7 @@
57 </td>
58 <td tal:condition="view/branch_enabled">
59 <a tal:replace="structure recipe/base_branch/fmt:link">
60- Owner
61+ Branch
62 </a>
63 </td>
64 <td tal:content="recipe/date_created/fmt:datetime" />