← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/megalint-7 into lp:launchpad

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/megalint-7 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/launchpad/megalint-7/+merge/86506

= Summary =

Fixing a few more bits of the reams of lint that we have allowed to persist in files that we edited.

These are all files that we have touched in the past few months, so they _should_ have been more or less lint-free: engineers run "make lint" after editing (or rely on "bzr lp-propose," the command to start a merge proposal, to do it for them), and where possible, fix the warnings that come up.


= Remaining lint =

Not all lint was easily fixed.  Many warnings remain in the files I cleaned up.  Some of the warnings I found (including some of the ones I fixed) were disturbing and quite possibly indicative of bugs.


./lib/lp/app/widgets/doc/location-widget.txt
     197: want exceeds 78 characters.
./lib/lp/app/javascript/inlineedit/assets/editor-core.css
       9: I014: Rule declarations should end indented on a single new line.
      20: I014: Rule declarations should end indented on a single new line.
      24: I014: Rule declarations should end indented on a single new line.
      26: I004: Selector must be on a new line.
      45: I014: Rule declarations should end indented on a single new line.
./lib/lp/app/javascript/inlineedit/editor.js
      70: 'InlineEditor' has not been fully defined yet.
     912: 'EditableText' has not been fully defined yet.
./lib/lp/app/javascript/picker/picker_patcher.js
     212: Expected an identifier and instead saw 'private' (a reserved word).
     213: Expected an identifier and instead saw 'private' (a reserved word).
./lib/lp/app/javascript/formwidgets/resizing_textarea.js
      22: 'ResizingTextarea' has not been fully defined yet.
-- 
https://code.launchpad.net/~jtv/launchpad/megalint-7/+merge/86506
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/megalint-7 into lp:launchpad.
=== modified file 'lib/lp/answers/tests/test_question_webservice.py'
--- lib/lp/answers/tests/test_question_webservice.py	2011-12-19 23:38:16 +0000
+++ lib/lp/answers/tests/test_question_webservice.py	2011-12-21 08:01:48 +0000
@@ -27,7 +27,6 @@
     QuestionTargetError,
     )
 from lp.registry.interfaces.person import IPersonSet
-from lp.services.worlddata.interfaces.language import ILanguageSet
 from lp.testing import (
     celebrity_logged_in,
     launchpadlib_for,

=== modified file 'lib/lp/app/browser/tests/test_stringformatter.py'
--- lib/lp/app/browser/tests/test_stringformatter.py	2011-12-19 23:38:16 +0000
+++ lib/lp/app/browser/tests/test_stringformatter.py	2011-12-21 08:01:48 +0000
@@ -435,7 +435,8 @@
 class TestMarkdown(TestCase):
     """Test for Markdown integration within Launchpad.
 
-    Not an exhaustive test, more of a check for our integration and configuration.
+    Not an exhaustive test, more of a check for our integration and
+    configuration.
     """
 
     layer = DatabaseFunctionalLayer  # Fixtures need the database for now

=== modified file 'lib/lp/app/doc/badges.txt'
--- lib/lp/app/doc/badges.txt	2011-12-18 15:13:07 +0000
+++ lib/lp/app/doc/badges.txt	2011-12-21 08:01:48 +0000
@@ -1,4 +1,5 @@
-= Badges =
+Badges
+======
 
 Badges are nifty user interface elements that are used to indicate to
 the user that there are interesting features about the thing that the
@@ -35,7 +36,8 @@
     security
 
 
-== The Badge class ==
+The Badge class
+---------------
 
 The badge class has two methods of interest:
   * renderIconImage - the HTML for the icon sized image
@@ -72,7 +74,8 @@
     ''
 
 
-== IHasBadges ==
+IHasBadges
+----------
 
 How to determine which badges to show for a given object is defined by
 the IHasBadges interface.
@@ -137,11 +140,13 @@
     ...     print badge.alt
     Traceback (most recent call last):
     ...
-    AttributeError: 'SimpleBadger' object has no attribute 'isBlueprintBadgeVisible'
-
-
-
-== Preferred badging methodology ==
+    AttributeError:
+    'SimpleBadger' object has no attribute 'isBlueprintBadgeVisible'
+
+
+
+Preferred badging methodology
+-----------------------------
 
 Under normal circumstances the badges for a given content object require
 the accessing or counting of attributes and this almost always requires
@@ -217,7 +222,8 @@
     ...     print badge.renderIconImage()
     Foo.bugs
     Foo.blueprints
-    <img alt="bug" width="14" height="14" src="/@@/bug" title="Linked to a bug"/>
+    <img alt="bug" width="14" height="14" src="/@@/bug"
+    title="Linked to a bug"/>
 
 When showing listings of Foos, you often want to use
 `lazr.delegates.delegates`. By having the DelegatingFoo inherit from the
@@ -259,10 +265,12 @@
 
     >>> for badge in badger.getVisibleBadges():
     ...     print badge.renderIconImage()
-    <img alt="bug" width="14" height="14" src="/@@/bug" title="Linked to a bug"/>
-
-
-== Tales expressions ==
+    <img alt="bug" width="14" height="14" src="/@@/bug"
+    title="Linked to a bug"/>
+
+
+Tales expressions
+-----------------
 
 There is a tales formatter defined for badges.  These can be shown
 as either small or large.

=== modified file 'lib/lp/app/doc/batch-navigation.txt'
--- lib/lp/app/doc/batch-navigation.txt	2011-12-20 18:13:09 +0000
+++ lib/lp/app/doc/batch-navigation.txt	2011-12-21 08:01:48 +0000
@@ -24,27 +24,28 @@
 
 Imports:
 
-  >>> from canonical.launchpad.webapp.batching import BatchNavigator
-  >>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest
+    >>> from canonical.launchpad.webapp.batching import BatchNavigator
+    >>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest
 
-  >>> def build_request(query_string_args=None, method='GET'):
-  ...   if query_string_args is None:
-  ...       query_string = ''
-  ...   else:
-  ...       query_string = "&".join(
-  ...           ["%s=%s" % (k,v) for k,v in query_string_args.items()])
-  ...   request = LaunchpadTestRequest(SERVER_URL='http://www.example.com/foo',
-  ...                                  method=method,
-  ...                                  environ={'QUERY_STRING': query_string})
-  ...   request.processInputs()
-  ...   return request
+    >>> def build_request(query_string_args=None, method='GET'):
+    ...   if query_string_args is None:
+    ...       query_string_args = {}
+    ...   query_string = "&".join(
+    ...       "%s=%s" % (k,v) for k,v in query_string_args.items())
+    ...   request = LaunchpadTestRequest(
+    ...       SERVER_URL='http://www.example.com/foo', method=method,
+    ...       environ={'QUERY_STRING': query_string})
+    ...   request.processInputs()
+    ...   return request
 
 A dummy request object:
 
 Some sample data.
 
-  >>> reindeer = ['Dasher', 'Dancer', 'Prancer', 'Vixen', 'Comet',
-  ...     'Cupid', 'Donner', 'Blitzen', 'Rudolph']
+    >>> reindeer = [
+    ...     'Dasher', 'Dancer', 'Prancer', 'Vixen', 'Comet',
+    ...     'Cupid', 'Donner', 'Blitzen', 'Rudolph',
+    ...     ]
 
 
 Multiple pages
@@ -58,7 +59,8 @@
     >>> batch_nav.has_multiple_pages
     True
 
-    >>> one_page_nav = BatchNavigator(select_results, build_request(), size=200)
+    >>> one_page_nav = BatchNavigator(
+    ...     select_results, build_request(), size=200)
     >>> one_page_nav.has_multiple_pages
     False
 

=== modified file 'lib/lp/app/doc/object-privacy.txt'
--- lib/lp/app/doc/object-privacy.txt	2011-12-18 17:23:40 +0000
+++ lib/lp/app/doc/object-privacy.txt	2011-12-21 08:01:48 +0000
@@ -1,4 +1,5 @@
-= Object privacy =
+Object privacy
+==============
 
 Some of our content objects can be flagged as private so that they are
 invisible to most users while still being there and visible to certain

=== modified file 'lib/lp/app/javascript/formwidgets/resizing_textarea.js'
--- lib/lp/app/javascript/formwidgets/resizing_textarea.js	2011-12-08 18:07:03 +0000
+++ lib/lp/app/javascript/formwidgets/resizing_textarea.js	2011-12-21 08:01:48 +0000
@@ -71,8 +71,9 @@
     },
 
     /**
-     * single_line says that at the minimum, it should show up as a single line
-     * textarea. This is used by tools such as the inline edit widget.
+     * single_line says that at the minimum, it should show up as a
+     * single-line textarea. This is used by tools such as the inline edit
+     * widget.
      *
      * @property single_line
      */

=== modified file 'lib/lp/app/javascript/inlineedit/assets/editor-core.css'
--- lib/lp/app/javascript/inlineedit/assets/editor-core.css	2011-12-09 13:48:59 +0000
+++ lib/lp/app/javascript/inlineedit/assets/editor-core.css	2011-12-21 08:01:48 +0000
@@ -4,8 +4,9 @@
 .yui3-ieditor-errors-hidden,
 .yui3-editable_text-hidden,
 .yui3-editable_text-edit_mode .yui3-editable_text-trigger,
-.yui3-editable_text-edit_mode .yui3-editable_text-text
-{ display: none; }
+.yui3-editable_text-edit_mode .yui3-editable_text-text {
+    display: none;
+}
 
 /* By default, input elements don't inherit these properties, but
  * in an inline editing context, it makes sense to do so.
@@ -29,7 +30,7 @@
  *
  * Browsers should ignore the content attribute for :link and :visited
  * pseudo-classes, but Konqueror doesn't.  Setting non-empty text
- * content here tricks it into rendering the button.  
+ * content here tricks it into rendering the button.
  *
  * Other things we tried instead of this hack:
  *  - Insert an HTML comment in the <a>.  No effect.

=== modified file 'lib/lp/app/javascript/inlineedit/editor.js'
--- lib/lp/app/javascript/inlineedit/editor.js	2011-12-08 20:31:53 +0000
+++ lib/lp/app/javascript/inlineedit/editor.js	2011-12-21 08:01:48 +0000
@@ -716,7 +716,7 @@
 
         // hook up the resizing textarea to handle those changes
         var cfg = this.cfg;
-        var input = this.get(INPUT_EL)
+        var input = this.get(INPUT_EL);
         var that = this;
 
         if (!this.get(MULTILINE)) {
@@ -744,7 +744,7 @@
         // we also need to make sure we update the ResizingTextarea as we
         // show/hide so bind to the show event (changes to the visible ATTR)
         this.after('visibleChange', function (e) {
-            var input_node = e.target.get(INPUT_EL)
+            var input_node = e.target.get(INPUT_EL);
 
             if (that.get(MULTILINE)) {
                 // The multi-line editor has to dynamically resize,

=== modified file 'lib/lp/app/javascript/inlineedit/tests/test_inline_edit.js'
--- lib/lp/app/javascript/inlineedit/tests/test_inline_edit.js	2011-12-07 19:37:13 +0000
+++ lib/lp/app/javascript/inlineedit/tests/test_inline_edit.js	2011-12-21 08:01:48 +0000
@@ -19,7 +19,7 @@
     '  Edit this</button>',
     ' <span id="multi_text" class="yui3-editable_text-text">',
     ' <p>Some editable multi-line text.</p></span>',
-    ' </div>',
+    ' </div>'
 ].join('');
 
 var Assert = Y.Assert;  // For easy access to isTrue(), etc.

=== modified file 'lib/lp/app/javascript/picker/picker_patcher.js'
--- lib/lp/app/javascript/picker/picker_patcher.js	2011-12-15 18:57:05 +0000
+++ lib/lp/app/javascript/picker/picker_patcher.js	2011-12-21 08:01:48 +0000
@@ -215,11 +215,11 @@
 
                 if (private_person && public_context) {
                     var yesno_content =
-                        '<p>This action will reveal this team\'s name to ' +
-                        'the public.</p>' 
+                        "<p>This action will reveal this team's name to " +
+                        "the public.</p>";
                     Y.lp.app.picker.yesno_save_confirmation(
-                            picker, yesno_content, 'Continue', 'Choose Again',
-                            do_save, do_cancel);
+                        picker, yesno_content, 'Continue', 'Choose Again',
+                        do_save, do_cancel);
                 } else {
                     do_save();
                 }

=== modified file 'lib/lp/app/stories/basics/demo-and-lpnet.txt'
--- lib/lp/app/stories/basics/demo-and-lpnet.txt	2011-12-19 13:20:13 +0000
+++ lib/lp/app/stories/basics/demo-and-lpnet.txt	2011-12-21 08:01:48 +0000
@@ -1,6 +1,5 @@
-= Demo and launchpad.net =
-
-== Demo sites ==
+Demo and launchpad.net
+======================
 
 Launchpad can brand instances as 'demo' instances to make it obvious to
 users that they are working in a playpen and changes they make do not

=== modified file 'lib/lp/app/templates/base-layout-macros.pt'
--- lib/lp/app/templates/base-layout-macros.pt	2011-12-15 15:46:57 +0000
+++ lib/lp/app/templates/base-layout-macros.pt	2011-12-21 08:01:48 +0000
@@ -288,11 +288,11 @@
 
 
 <metal:debug-timeline define-macro="debug-timeline">
-  <a name="debug_timeline" 
+  <a name="debug_timeline"
     id="debug_timeline"
     class="hidden"
     >
-    <table 
+    <table
       tal:condition="request/features/visible_render_time"
       tal:define="timeline_actions modules/canonical.launchpad.webapp.adapter/get_timeline_actions"
       class="debug-timeline listing"
@@ -302,7 +302,7 @@
 	<th>Action</th>
       </thead>
       <tr tal:repeat="action timeline_actions">
-	<td class="amount" tal:content="action/duration/fmt:millisecondduration"/>	  
+	<td class="amount" tal:content="action/duration/fmt:millisecondduration"/>
 	<td style="font-family: monospace; text-align: left;">
           <pre class="wrap"><span class="action-category" tal:content="action/category"/>: <span class="action-details" tal:content="action/detail"/></pre>
 	</td>

=== modified file 'lib/lp/app/templates/launchpad-loginstatus.pt'
--- lib/lp/app/templates/launchpad-loginstatus.pt	2011-12-08 02:23:15 +0000
+++ lib/lp/app/templates/launchpad-loginstatus.pt	2011-12-21 08:01:48 +0000
@@ -9,7 +9,7 @@
 <div id="logincontrol" tal:condition="view/logged_in">
   <form action="/+logout" method="post">
     <input type="hidden" name="loggingout" value="1" />
-    <a 
+    <a
       href="javascript:removeElementClass(document.getElementById('debug_timeline'),'hidden')"
       tal:condition="request/features/visible_render_time"
       >

=== modified file 'lib/lp/app/tests/test_validation.py'
--- lib/lp/app/tests/test_validation.py	2011-12-20 08:59:14 +0000
+++ lib/lp/app/tests/test_validation.py	2011-12-21 08:01:48 +0000
@@ -39,4 +39,3 @@
     DEFAULT = test_suite()
     import unittest
     unittest.main('DEFAULT')
-

=== modified file 'lib/lp/app/validators/tests/validation.txt'
--- lib/lp/app/validators/tests/validation.txt	2011-12-20 04:02:33 +0000
+++ lib/lp/app/validators/tests/validation.txt	2011-12-21 08:01:48 +0000
@@ -1,4 +1,5 @@
-= Launchpad field validators =
+Launchpad field validators
+==========================
 
     >>> from zope.security.proxy import removeSecurityProxy
     >>> from zope.component import getUtility
@@ -12,7 +13,8 @@
     >>> firefox = removeSecurityProxy(firefox)
     >>> firefox.bug_supervisor = no_priv
 
-== can_be_nominated_for_series ==
+can_be_nominated_for_series
+---------------------------
 
 This validator is used to check if the bug in the launchbag can be
 nominated for the given series.
@@ -79,7 +81,8 @@
     >>> can_be_nominated_for_series([firefox.series[1]])
     True
 
-== PersonNameField ==
+PersonNameField
+---------------
 
 The PersonNameField class, which is only used for extra validation on a
 person's/team's name.

=== modified file 'lib/lp/app/widgets/doc/location-widget.txt'
--- lib/lp/app/widgets/doc/location-widget.txt	2011-12-09 05:08:09 +0000
+++ lib/lp/app/widgets/doc/location-widget.txt	2011-12-21 08:01:48 +0000
@@ -1,4 +1,5 @@
-= Location widget =
+Location widget
+===============
 
 A widget used when setting the geographic location of a given person.
 
@@ -128,7 +129,8 @@
     longitude...
 
 
-== The widget's HTML ==
+The widget's HTML
+-----------------
 
 The widget's HTML will include <input> elements for the latitude,
 longitude and time zone fields.  The values of these elements will be
@@ -146,7 +148,8 @@
     <select...name="field.location.time_zone"...
 
 
-== The widget's script ==
+The widget's script
+-------------------
 
 The widget initializes the mapping.renderPersonMap() JavaScript methods
 with its map_javascript property. The widget uses the
@@ -179,7 +182,8 @@
     >>> config_data = config.pop('geoname_data')
 
 
-== XSS ==
+XSS
+---
 
 The widget must escape and JS encode the person's displayname to prevent
 XSS attacks and to make sure the generated javascript can be parsed.

=== modified file 'lib/lp/app/widgets/exception.py'
--- lib/lp/app/widgets/exception.py	2011-12-19 23:38:16 +0000
+++ lib/lp/app/widgets/exception.py	2011-12-21 08:01:48 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 from z3c.ptcompat import ViewPageTemplateFile
@@ -44,4 +44,3 @@
         self.request = request
 
     snippet = ViewPageTemplateFile('templates/error.pt')
-

=== modified file 'lib/lp/app/widgets/owner.py'
--- lib/lp/app/widgets/owner.py	2011-12-19 23:38:16 +0000
+++ lib/lp/app/widgets/owner.py	2011-12-21 08:01:48 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -43,7 +43,7 @@
 
     def getInputValue(self):
         '''See zope.app.form.interfaces.IInpputWidget'''
-        raise NotImplementedError, 'getInputValue'
+        raise NotImplementedError('getInputValue')
 
     def applyChanges(self, content):
         '''See zope.app.form.interfaces.IInputWidget'''
@@ -85,6 +85,7 @@
 
 class HiddenUserWidget(RequestWidget):
     implements(IUserWidget)
+
     def __init__(self, context, vocabulary, request=None):
         '''Construct the HiddenUserWidget.
 

=== modified file 'lib/lp/app/widgets/password.py'
--- lib/lp/app/widgets/password.py	2011-12-19 23:38:16 +0000
+++ lib/lp/app/widgets/password.py	2011-12-21 08:01:48 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """
@@ -77,7 +77,9 @@
         contain the same value. It returns the value encrypted.
 
         >>> request = LaunchpadTestRequest(form={
-        ...     'field.foo': u'My Password', 'field.foo_dupe': u'My Password'})
+        ...     'field.foo': u'My Password',
+        ...     'field.foo_dupe': u'My Password',
+        ...     })
         >>> widget = PasswordChangeWidget(field, request)
         >>> crypted_pw = widget.getInputValue()
         >>> encryptor = getUtility(IPasswordEncryptor)
@@ -123,4 +125,3 @@
         # If we have matching plaintext, encrypt it and return the password
         encryptor = getUtility(IPasswordEncryptor)
         return encryptor.encrypt(value)
-

=== modified file 'lib/lp/archivepublisher/tests/publisher-config.txt'
--- lib/lp/archivepublisher/tests/publisher-config.txt	2011-12-04 15:12:45 +0000
+++ lib/lp/archivepublisher/tests/publisher-config.txt	2011-12-21 08:01:48 +0000
@@ -1,4 +1,5 @@
-= Publisher Configuration Provider =
+Publisher Configuration Provider
+================================
 
 The config module has a function to provide a modified publisher configuration
 that provides the right paths for its publication according to the given
@@ -23,7 +24,8 @@
     ...         print '%s: %s' % (attr_name, getattr(config, attr_name))
 
 
-== Primary ==
+Primary
+-------
 
     >>> from lp.registry.interfaces.distribution import IDistributionSet
     >>> ubuntutest = getUtility(IDistributionSet)['ubuntutest']
@@ -43,7 +45,8 @@
     temproot:        /var/tmp/archive/ubuntutest-temp
 
 
-== PPAs ==
+PPAs
+----
 
 Adjust Celso's PPA to point to a configured distribution and built its
 publisher configuration.
@@ -115,7 +118,8 @@
     temproot:        /var/tmp/archive/ubuntutest-temp
 
 
-== Partner ==
+Partner
+-------
 
 The publisher config for PARTNER contains only 'partner' in its
 components.  This prevents non-partner being published in the partner
@@ -139,7 +143,8 @@
     temproot:        /var/tmp/archive/ubuntutest-temp
 
 
-== DEBUG ==
+DEBUG
+-----
 
 The publisher configuration for DEBUG archives points to directories
 besides PRIMARY repository ones, but the distribution part is
@@ -164,7 +169,8 @@
     temproot:        /var/tmp/archive/ubuntutest-temp
 
 
-== COPY ==
+COPY
+----
 
 In the case of copy archives (used for rebuild testing) the archiveroot
 is of the form distroroot/distroname-archivename/distroname
@@ -176,12 +182,14 @@
     >>> copy_config = getPubConfig(copy_archive)
 
     >>> dump_config(copy_config)
-    distroroot:      /var/tmp/archive
-    archiveroot:     /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest
-    poolroot:        /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest/pool
-    distsroot:       /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest/dists
-    overrideroot:    /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-overrides
-    cacheroot:       /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-cache
-    miscroot:        /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-misc
-    germinateroot:   /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-germinate
-    temproot:        /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-temp
+    distroroot:    /var/tmp/archive
+    archiveroot:   /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest
+    poolroot:      /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest/pool
+    distsroot:     /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest/dists
+    overrideroot:
+        /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-overrides
+    cacheroot:     /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-cache
+    miscroot:      /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-misc
+    germinateroot:
+        /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-germinate
+    temproot:      /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-temp

=== modified file 'lib/lp/archivepublisher/tests/test_publisherconfig.py'
--- lib/lp/archivepublisher/tests/test_publisherconfig.py	2011-12-19 23:38:16 +0000
+++ lib/lp/archivepublisher/tests/test_publisherconfig.py	2011-12-21 08:01:48 +0000
@@ -7,12 +7,12 @@
 
 
 from storm.exceptions import IntegrityError
-from storm.store import Store
 from zope.component import getUtility
 from zope.interface.verify import verifyObject
 from zope.security.interfaces import Unauthorized
 
 from canonical.launchpad.ftests import login
+from canonical.launchpad.interfaces.lpstorm import IStore
 from canonical.testing.layers import (
     DatabaseFunctionalLayer,
     ZopelessDatabaseLayer,
@@ -21,6 +21,7 @@
     IPublisherConfig,
     IPublisherConfigSet,
     )
+from lp.archivepublisher.model.publisherconfig import PublisherConfig
 from lp.testing import (
     ANONYMOUS,
     TestCaseWithFactory,
@@ -61,10 +62,13 @@
 
     def test_one_config_per_distro(self):
         # Only one config for each distro is allowed.
-        pubconf = self.factory.makePublisherConfig(self.distribution)
-        pubconf2 = self.factory.makePublisherConfig(self.distribution)
-        store = Store.of(pubconf)
-        self.assertRaises(IntegrityError, store.flush)
+
+        def make_conflicting_configs():
+            for counter in range(2):
+                self.factory.makePublisherConfig(self.distribution)
+            IStore(PublisherConfig).flush()
+
+        self.assertRaises(IntegrityError, make_conflicting_configs)
 
     def test_getByDistribution(self):
         # Test that IPublisherConfigSet.getByDistribution works.

=== modified file 'lib/lp/archiveuploader/dscfile.py'
--- lib/lp/archiveuploader/dscfile.py	2011-12-09 00:20:44 +0000
+++ lib/lp/archiveuploader/dscfile.py	2011-12-21 08:01:48 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """ DSCFile and related.
@@ -288,7 +288,6 @@
             raise EarlyReturnUploadError(
                 "Unsupported source format: %s" % self._dict['Format'])
 
-
     #
     # Useful properties.
     #

=== modified file 'lib/lp/archiveuploader/tests/nascentuploadfile.txt'
--- lib/lp/archiveuploader/tests/nascentuploadfile.txt	2011-12-18 13:45:20 +0000
+++ lib/lp/archiveuploader/tests/nascentuploadfile.txt	2011-12-21 08:01:48 +0000
@@ -1,4 +1,5 @@
-= NascentUploadFiles =
+NascentUploadFiles
+==================
 
 Files related with an Soyuz upload are modelled as:
 
@@ -22,11 +23,13 @@
     >>> from lp.archiveuploader.tests import datadir, getPolicy
 
 
-== NascentUploadFile base class ==
+NascentUploadFile base class
+----------------------------
 
 (This base class has many checks in it that are not yet documented here.)
 
-=== Forbidden character check ===
+Forbidden character check
+.........................
 Some characters are forbidden in filenames as per Debian packaging policy, and
 this check is performed by the checkNameIsTaintFree() method.  It raises an
 UploadError if there is an invalid character found.
@@ -55,7 +58,8 @@
     >>> upload_file.checkNameIsTaintFree()
 
 
-== ChangesFile  ==
+ChangesFile
+-----------
 
 A changesfile contains manifest of what is included (ou should be
 considered) for the upload in question.
@@ -159,7 +163,8 @@
     >>> os.unlink(copyp)
 
 
-=== CustomUploadFile identification ===
+CustomUploadFile identification
+...............................
 
 A custom upload is essentially a tarball, so it matches the is_source
 regexp, even though it isn't actually a source file:
@@ -212,7 +217,8 @@
 uploads.
 
 
-=== ChangesFile Parsing Addresses ===
+ChangesFile Parsing Addresses
+.............................
 
 Address parsing is implemented by the SignableTagFile class, which
 is base for ChangesFile and DSCFile.
@@ -264,9 +270,9 @@
     >>> addr['person'].creation_comment
     u'when the some-source_6.6.6 package was uploaded to hoary/RELEASE'
 
-If the email address is registered but not associated with a person it will be 
-associated with a new Person. This involves updating the email address, something 
-for which the uploader must have explicit permissions (bug 589073).
+If the email address is registered but not associated with a person it will be
+associated with a new Person. This involves updating the email address,
+something for which the uploader must have explicit permissions (bug 589073).
 
     >>> sig_file.policy.create_people
     True
@@ -280,9 +286,9 @@
     ...          "fo", "secr1t")
     >>> person = getUtility(IPersonSet).createPersonWithoutEmail("fo",
     ...          rationale=PersonCreationRationale.UNKNOWN)
-	>>> person.account = acct
+    >>> person.account = acct
 
-    Commit the changes so the emailaddress will have to be updated later 
+    Commit the changes so the emailaddress will have to be updated later
     rather than inserted.
 
     >>> commit()
@@ -335,7 +341,8 @@
     <Person ...>
 
 
-=== Signature Traces ===
+Signature Traces
+................
 
 Changes file can be optionally GPG-signed, so ChangesFile has
 infrastructure to record this information for later checks with policy
@@ -353,7 +360,8 @@
     u'1024D/5D147547'
 
 
-== DSCFile ==
+DSCFile
+-------
 
 DSCFile class models the operations and checks needed for processing
 and storing a DSC file in the LP system.
@@ -430,7 +438,8 @@
 
     >>> errors = ed_broken_dsc.verify()
     >>> [str(err) for err in errors]
-    ['File ed_0.2-20.dsc mentioned in the changes has a checksum mismatch. de8b206f8fc57bd931f6226feac6644a != e31eeb0b6b3b87e1ea79378df864ffff']
+    ['File ed_0.2-20.dsc mentioned in the changes has a checksum mismatch.
+    de8b206f8fc57bd931f6226feac6644a != e31eeb0b6b3b87e1ea79378df864ffff']
 
 It also verifies the file size when the checksum matches.
 
@@ -442,10 +451,12 @@
 
     >>> errors = ed_broken_dsc.verify()
     >>> [str(err) for err in errors]
-    ['File ed_0.2-20.dsc mentioned in the changes has a size mismatch. 578 != 500']
-
-
-=== Sub-DSC files or DSCUploadedFiles ===
+    ['File ed_0.2-20.dsc mentioned in the changes has a size mismatch.
+    578 != 500']
+
+
+Sub-DSC files or DSCUploadedFiles
+.................................
 
 Sub-DSCFiles are DSCUploadedFile objects.
 
@@ -467,93 +478,79 @@
     ...     modified_insecure_policy, DevNullLogger())
     >>> errors = ed_broken_dsc_file.verify()
     >>> [str(err) for err in errors]
-    ['File ed_0.2-20.diff.gz mentioned in the changes has a checksum mismatch. 8343836094fb01ee9b9a1067b23365f1 != f9e1e5f13725f581919e9bfd6227ffff']
-
-
-=== Sub-DSC file lookup ===
-
-
-== SourceUploadFile ==
-
-
-== DebBinaryUploadFile ==
-
-DebBinaryUploadFile models a binary .deb file. 
-
-   >>> from lp.archiveuploader.nascentuploadfile import (
-   ...    DebBinaryUploadFile)
-   >>> ed_deb_path = datadir('ed_0.2-20_i386.deb')
-   >>> ed_binary_deb = DebBinaryUploadFile(ed_deb_path,
-   ...                     'e31eeb0b6b3b87e1ea79378df864ffff',
-   ...                     15, 'main/editors', 'important', 'foo', '1.2',
-   ...                     ed_binary_changes, modified_insecure_policy,
-   ...                     DevNullLogger())
+    ['File ed_0.2-20.diff.gz mentioned in the changes has a checksum mismatch.
+    8343836094fb01ee9b9a1067b23365f1 != f9e1e5f13725f581919e9bfd6227ffff']
+
+
+DebBinaryUploadFile
+-------------------
+
+DebBinaryUploadFile models a binary .deb file.
+
+    >>> from lp.archiveuploader.nascentuploadfile import (
+    ...    DebBinaryUploadFile)
+    >>> ed_deb_path = datadir('ed_0.2-20_i386.deb')
+    >>> ed_binary_deb = DebBinaryUploadFile(
+    ...     ed_deb_path, 'e31eeb0b6b3b87e1ea79378df864ffff', 15,
+    ...     'main/editors', 'important', 'foo', '1.2', ed_binary_changes,
+    ...     modified_insecure_policy, DevNullLogger())
 
 Like the other files it can be verified:
 
-   >>> list(ed_binary_deb.verify())
-   []
+    >>> list(ed_binary_deb.verify())
+    []
 
 Verification checks that the specified section matches the section in the
 changes file:
 
-   >>> ed_binary_deb = DebBinaryUploadFile(ed_deb_path,
-   ...                     'e31eeb0b6b3b87e1ea79378df864ffff',
-   ...                     15, 'main/net', 'important', 'foo', '1.2',
-   ...                     ed_binary_changes, modified_insecure_policy,
-   ...                     DevNullLogger())
-   >>> list(ed_binary_deb.verify())
-   [UploadError('ed_0.2-20_i386.deb control file lists section as 
-                main/editors but changes file has main/net.',)]
+    >>> ed_binary_deb = DebBinaryUploadFile(
+    ...     ed_deb_path, 'e31eeb0b6b3b87e1ea79378df864ffff', 15, 'main/net',
+    ...     'important', 'foo', '1.2', ed_binary_changes,
+    ...     modified_insecure_policy, DevNullLogger())
+    >>> list(ed_binary_deb.verify())
+    [UploadError('ed_0.2-20_i386.deb
+    control file lists section as main/editors but changes file has
+    main/net.',)]
 
 It also checks the priority against the changes file:
 
-   >>> ed_binary_deb = DebBinaryUploadFile(ed_deb_path,
-   ...                     'e31eeb0b6b3b87e1ea79378df864ffff',
-   ...                     15, 'main/editors', 'extra', 'foo', '1.2',
-   ...                     ed_binary_changes, modified_insecure_policy,
-   ...                     DevNullLogger())
-   >>> list(ed_binary_deb.verify())
-   [UploadError('ed_0.2-20_i386.deb control file lists priority as important 
-                 but changes file has extra.',)]
-
-The timestamp of the files in the .deb are tested against the policy for being 
-too new:
-
-   >>> from lp.archiveuploader.uploadpolicy import ArchiveUploadType
-   >>> old_only_policy = getPolicy(
-   ...     name='insecure', distro='ubuntu', distroseries='hoary')
-   >>> old_only_policy.accepted_type = ArchiveUploadType.BINARY_ONLY
-   >>> old_only_policy.future_time_grace = -5 * 365 * 24 * 60 * 60
-
-   >>> ed_binary_deb = DebBinaryUploadFile(ed_deb_path,
-   ...                     'e31eeb0b6b3b87e1ea79378df864ffff',
-   ...                     15, 'main/editors', 'important', 'foo', '1.2',
-   ...                     ed_binary_changes, old_only_policy,
-   ...                     DevNullLogger())
-   >>> list(ed_binary_deb.verifyDebTimestamp())
-   [UploadError('ed_0.2-20_i386.deb: has 26 file(s) with a time stamp too 
-        far into the future (e.g. control [Thu Jan  3 19:29:01 2008]).',)]
+    >>> ed_binary_deb = DebBinaryUploadFile(
+    ...     ed_deb_path, 'e31eeb0b6b3b87e1ea79378df864ffff', 15,
+    ...     'main/editors', 'extra', 'foo', '1.2', ed_binary_changes,
+    ...     modified_insecure_policy, DevNullLogger())
+    >>> list(ed_binary_deb.verify())
+    [UploadError('ed_0.2-20_i386.deb
+    control file lists priority as important but changes file has extra.',)]
+
+The timestamp of the files in the .deb are tested against the policy for
+being too new:
+
+    >>> from lp.archiveuploader.uploadpolicy import ArchiveUploadType
+    >>> old_only_policy = getPolicy(
+    ...     name='insecure', distro='ubuntu', distroseries='hoary')
+    >>> old_only_policy.accepted_type = ArchiveUploadType.BINARY_ONLY
+    >>> old_only_policy.future_time_grace = -5 * 365 * 24 * 60 * 60
+
+    >>> ed_binary_deb = DebBinaryUploadFile(
+    ...     ed_deb_path, 'e31eeb0b6b3b87e1ea79378df864ffff', 15,
+    ...     'main/editors', 'important', 'foo', '1.2', ed_binary_changes,
+    ...     old_only_policy, DevNullLogger())
+    >>> list(ed_binary_deb.verifyDebTimestamp())
+    [UploadError('ed_0.2-20_i386.deb:
+    has 26 file(s) with a time stamp too far into the future
+    (e.g. control [Thu Jan  3 19:29:01 2008]).',)]
 
 ... as well as for being too old:
 
-   >>> new_only_policy = getPolicy(
-   ...     name='insecure', distro='ubuntu', distroseries='hoary')
-   >>> new_only_policy.accepted_type = ArchiveUploadType.BINARY_ONLY
-   >>> new_only_policy.earliest_year = 2010
-   >>> ed_binary_deb = DebBinaryUploadFile(ed_deb_path,
-   ...                     'e31eeb0b6b3b87e1ea79378df864ffff',
-   ...                     15, 'main/editors', 'important', 'foo', '1.2',
-   ...                     ed_binary_changes, new_only_policy,
-   ...                     DevNullLogger())
-   >>> list(ed_binary_deb.verify())
-   [UploadError('ed_0.2-20_i386.deb: has 26 file(s) with a time stamp too
-                 far in the past (e.g. control [Thu Jan  3 19:29:01 2008]).',)]
-
-
-== UDebBinaryUploadFile ==
-
-
-== CustomUploadFile ==
-
-
+    >>> new_only_policy = getPolicy(
+    ...     name='insecure', distro='ubuntu', distroseries='hoary')
+    >>> new_only_policy.accepted_type = ArchiveUploadType.BINARY_ONLY
+    >>> new_only_policy.earliest_year = 2010
+    >>> ed_binary_deb = DebBinaryUploadFile(
+    ...     ed_deb_path, 'e31eeb0b6b3b87e1ea79378df864ffff', 15,
+    ...     'main/editors', 'important', 'foo', '1.2', ed_binary_changes,
+    ...     new_only_policy, DevNullLogger())
+    >>> list(ed_binary_deb.verify())
+    [UploadError('ed_0.2-20_i386.deb:
+    has 26 file(s) with a time stamp too far in the past
+    (e.g. control [Thu Jan  3 19:29:01 2008]).',)]

=== modified file 'lib/lp/archiveuploader/tests/test_buildduploads.py'
--- lib/lp/archiveuploader/tests/test_buildduploads.py	2011-12-09 01:21:32 +0000
+++ lib/lp/archiveuploader/tests/test_buildduploads.py	2011-12-21 08:01:48 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test buildd uploads use-cases."""
@@ -22,6 +22,10 @@
     )
 from lp.soyuz.interfaces.publishing import IPublishingSet
 from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
+from lp.soyuz.model.processor import (
+    Processor,
+    ProcessorFamily,
+    )
 from lp.testing.gpgkeys import import_public_test_keys
 
 
@@ -176,14 +180,12 @@
     def setupBreezy(self):
         """Extend breezy setup to enable uploads to powerpc architecture."""
         TestStagedBinaryUploadBase.setupBreezy(self)
-        from lp.soyuz.model.processor import (
-            Processor, ProcessorFamily)
         self.switchToAdmin()
         ppc_family = ProcessorFamily.selectOneBy(name='powerpc')
-        ppc_proc = Processor(
+        Processor(
             name='powerpc', title='PowerPC', description='not yet',
             family=ppc_family)
-        breezy_ppc = self.breezy.newArch(
+        self.breezy.newArch(
             'powerpc', ppc_family, True, self.breezy.owner)
         self.switchToUploader()
 

=== modified file 'lib/lp/archiveuploader/tests/test_changesfile.py'
--- lib/lp/archiveuploader/tests/test_changesfile.py	2011-12-09 01:21:32 +0000
+++ lib/lp/archiveuploader/tests/test_changesfile.py	2011-12-21 08:01:48 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test ChangesFile functionality."""
@@ -123,7 +123,8 @@
         contents = self.getBaseChanges()
         contents["Binary"] = "binary1\n binary2 \n binary3"
         changes = self.createChangesFile("mypkg_0.1_i386.changes", contents)
-        self.assertEquals(set(["binary1", "binary2", "binary3"]), changes.binaries)
+        self.assertEqual(
+            set(["binary1", "binary2", "binary3"]), changes.binaries)
 
     def test_checkFileName(self):
         # checkFileName() yields an UploadError if the filename is invalid.

=== modified file 'lib/lp/archiveuploader/tests/test_dscfile.py'
--- lib/lp/archiveuploader/tests/test_dscfile.py	2011-12-19 23:38:16 +0000
+++ lib/lp/archiveuploader/tests/test_dscfile.py	2011-12-21 08:01:48 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test dscfile.py"""
@@ -100,7 +100,7 @@
         which is incredibly unlikely to be hit by normal files in the
         archive"""
         dev_zero = open("/dev/zero", "r")
-        ten_MiB = 2**20 * 10
+        ten_MiB = 10 * (2 ** 20)
         empty_file = dev_zero.read(ten_MiB + 1)
         dev_zero.close()
 
@@ -179,7 +179,8 @@
         :param bzip2_count: number of files using bzip2 compression.
         :param xz_count: number of files using xz compression.
         """
-        self.assertErrorsForFiles([], files, components, bzip2_count, xz_count)
+        self.assertErrorsForFiles(
+            [], files, components, bzip2_count, xz_count)
 
 
 class Test10SourceFormatVerification(BaseTestSourceFileVerification):