← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Paul Hummer has proposed merging lp:~rockstar/launchpad/junk-recipe-listings into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #610230 Rescore build uses a text area
  https://bugs.launchpad.net/bugs/610230


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.
-- 
https://code.launchpad.net/~rockstar/launchpad/junk-recipe-listings/+merge/30990
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rockstar/launchpad/junk-recipe-listings into lp:launchpad/devel.
=== modified file 'lib/lp/code/browser/sourcepackagerecipebuild.py'
--- lib/lp/code/browser/sourcepackagerecipebuild.py	2010-07-24 14:27:15 +0000
+++ lib/lp/code/browser/sourcepackagerecipebuild.py	2010-07-26 21:19:47 +0000
@@ -14,7 +14,7 @@
     ]
 
 from zope.interface import Interface
-from zope.schema import Text
+from zope.schema import Int
 
 from canonical.launchpad.browser.librarian import FileNavigationMixin
 from canonical.launchpad.webapp import (
@@ -146,7 +146,7 @@
 
     class schema(Interface):
         """Schema for deleting a build."""
-        score = Text(
+        score = Int(
             title=u'Score', required=True,
             description=u'The score of the recipe.')
 
@@ -157,15 +157,6 @@
         return canonical_url(self.context)
     next_url = cancel_url
 
-    def validate(self, data):
-        try:
-            score = int(data['score'])
-        except ValueError:
-            self.setFieldError(
-                'score',
-                'You have specified an invalid value for score. '
-                'Please specify an integer')
-
     @action('Rescore build', name='rescore')
     def request_action(self, action, data):
         """Rescore the build."""

=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py	2010-07-24 14:15:27 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py	2010-07-26 21:19:47 +0000
@@ -162,8 +162,7 @@
 
         self.assertEqual(
             extract_text(find_tags_by_class(browser.contents, 'message')[1]),
-            'You have specified an invalid value for score. '
-            'Please specify an integer')
+            'Invalid integer data')
 
     def test_rescore_build_not_admin(self):
         """No one but admins can rescore a build."""

=== modified file 'lib/lp/code/templates/sourcepackagerecipe-listing.pt'
--- lib/lp/code/templates/sourcepackagerecipe-listing.pt	2010-06-15 18:24:04 +0000
+++ lib/lp/code/templates/sourcepackagerecipe-listing.pt	2010-07-26 21:19:47 +0000
@@ -33,7 +33,7 @@
             </td>
             <td tal:condition="view/branch_enabled">
               <a tal:replace="structure recipe/base_branch/fmt:link">
-                Owner
+                Branch
               </a>
             </td>
             <td tal:content="recipe/date_created/fmt:datetime" />