launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04795
[Merge] lp:~jtv/launchpad/arbitrary-lint into lp:launchpad
Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/arbitrary-lint into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/launchpad/arbitrary-lint/+merge/73161
= Summary =
I'm trying to resolve a merge conflict with devel. Naturally I run "make lint" as a first fast check to see if I've left any obvious mistakes. But this gives me reams and reams of warnings for files that people have touched in the past few days, but either left around for others to enjoy or forgot to run the usual lint check against.
In this branch I clean up _some_ of that lint, and run the usual automated tools that update copyright and reformat imports. I also left some lint in place where it flags potentially serious mistakes, such as JavaScript syntax errors (where code evidently worked on some browsers but probably not on others) and a disabled test.
Come on people, we can do better!
= Launchpad lint =
The one remaining warning is one that I'm loath to touch, because it's in an incredibly long regex.
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/app/browser/stringformatter.py
lib/lp/code/model/codeimport.py
lib/lp/bugs/tests/test_bugs_webservice.py
lib/canonical/launchpad/security.py
lib/lp/app/browser/tests/test_stringformatter.py
lib/lp/app/browser/linkchecker.py
lib/lp/bugs/tests/test_structuralsubscription.py
lib/lp/code/enums.py
lib/lp/app/browser/tests/test_linkchecker.py
lib/canonical/launchpad/utilities/ftests/test_gpghandler.py
lib/launchpad_loggerhead/app.py
lib/lp/blueprints/browser/tests/test_specification.py
lib/lp/app/browser/vocabulary.py
lib/lp/archiveuploader/nascentuploadfile.py
./lib/lp/app/browser/stringformatter.py
559: Line exceeds 78 characters.
559: E501 line too long (86 characters)
--
https://code.launchpad.net/~jtv/launchpad/arbitrary-lint/+merge/73161
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/arbitrary-lint into lp:launchpad.
=== modified file 'lib/canonical/launchpad/security.py'
--- lib/canonical/launchpad/security.py 2011-08-26 09:32:59 +0000
+++ lib/canonical/launchpad/security.py 2011-08-28 07:37:26 +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).
# pylint: disable-msg=F0401
@@ -1278,6 +1278,7 @@
# Template is on a product.
return False
+
class EditPOTemplateDetails(AuthorizationBase):
permission = 'launchpad.TranslationsAdmin'
usedfor = IPOTemplate
=== modified file 'lib/canonical/launchpad/utilities/ftests/test_gpghandler.py'
--- lib/canonical/launchpad/utilities/ftests/test_gpghandler.py 2011-08-22 01:10:49 +0000
+++ lib/canonical/launchpad/utilities/ftests/test_gpghandler.py 2011-08-28 07:37:26 +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 calendar import timegm
@@ -10,7 +10,6 @@
import os
from time import time
-import gpgme
from pytz import UTC
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
=== modified file 'lib/launchpad_loggerhead/app.py'
--- lib/launchpad_loggerhead/app.py 2011-08-23 01:32:01 +0000
+++ lib/launchpad_loggerhead/app.py 2011-08-28 07:37:26 +0000
@@ -1,39 +1,58 @@
-# 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).
import logging
import os
-import sys
import threading
import urllib
import urlparse
import xmlrpclib
-from bzrlib import errors, lru_cache, urlutils
+from bzrlib import (
+ errors,
+ lru_cache,
+ urlutils,
+ )
from bzrlib.transport import get_transport
-from loggerhead.apps import favicon_app, static_app
+from loggerhead.apps import (
+ favicon_app,
+ static_app,
+ )
from loggerhead.apps.branch import BranchWSGIApp
import oops_wsgi
-from openid.consumer.consumer import CANCEL, Consumer, FAILURE, SUCCESS
-from openid.extensions.sreg import SRegRequest, SRegResponse
-from paste import httpserver
+from openid.consumer.consumer import (
+ CANCEL,
+ Consumer,
+ FAILURE,
+ SUCCESS,
+ )
+from openid.extensions.sreg import (
+ SRegRequest,
+ SRegResponse,
+ )
from paste.fileapp import DataApp
from paste.httpexceptions import (
HTTPMovedPermanently,
HTTPNotFound,
HTTPUnauthorized,
)
-from paste.request import construct_url, parse_querystring, path_info_pop
+from paste.request import (
+ construct_url,
+ parse_querystring,
+ path_info_pop,
+ )
from canonical.config import config
+from canonical.launchpad.webapp.errorlog import ErrorReportingUtility
+from canonical.launchpad.webapp.vhosts import allvhosts
from canonical.launchpad.xmlrpc import faults
-from canonical.launchpad.webapp.vhosts import allvhosts
-from canonical.launchpad.webapp.errorlog import (
- ErrorReportingUtility, ScriptRequest)
from lp.code.interfaces.codehosting import (
- BRANCH_TRANSPORT, LAUNCHPAD_ANONYMOUS)
+ BRANCH_TRANSPORT,
+ LAUNCHPAD_ANONYMOUS,
+ )
+from lp.codehosting.safe_open import safe_open
from lp.codehosting.vfs import get_lp_server
-from lp.codehosting.safe_open import safe_open
+
robots_txt = '''\
User-agent: *
@@ -99,7 +118,7 @@
raise HTTPMovedPermanently(openid_request.redirectURL(
config.codehosting.secure_codebrowse_root,
config.codehosting.secure_codebrowse_root + '+login/?'
- + urllib.urlencode({'back_to':back_to})))
+ + urllib.urlencode({'back_to': back_to})))
def _complete_login(self, environ, start_response):
"""Complete the OpenID authentication process.
@@ -227,7 +246,8 @@
try:
view = BranchWSGIApp(
bzr_branch, branch_name, {'cachepath': cachepath},
- self.graph_cache, branch_link=branch_link, served_url=None)
+ self.graph_cache, branch_link=branch_link,
+ served_url=None)
return view.app(environ, start_response)
finally:
bzr_branch.unlock()
@@ -242,10 +262,10 @@
return error_utility
-# XXX: This HTML template should be replaced with the same one that lpnet uses
-# for reporting OOPSes to users, or at least something that looks similar. But
-# even this is better than the "Internal Server Error" you'd get otherwise.
-# - Andrew Bennetts, 2010-07-27.
+# XXX AndrewBennets 2010-07-27: This HTML template should be replaced
+# with the same one that lpnet uses for reporting OOPSes to users, or at
+# least something that looks similar. But even this is better than the
+# "Internal Server Error" you'd get otherwise.
_oops_html_template = '''\
<html>
<head><title>Oops! %(id)s</title></head>
@@ -262,8 +282,9 @@
def oops_middleware(app):
"""Middleware to log an OOPS if the request fails.
- If the request fails before the response body has started then this returns
- a basic HTML error page with the OOPS ID to the user (and status code 500).
+ If the request fails before the response body has started then this
+ returns a basic HTML error page with the OOPS ID to the user (and status
+ code 500).
"""
error_utility = make_error_utility()
return oops_wsgi.make_app(app, error_utility._oops_config,
=== modified file 'lib/lp/app/browser/linkchecker.py'
--- lib/lp/app/browser/linkchecker.py 2011-08-22 04:45:05 +0000
+++ lib/lp/app/browser/linkchecker.py 2011-08-28 07:37:26 +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).
# pylint: disable-msg=E0211,E0213
@@ -13,8 +13,11 @@
from canonical.launchpad.searchbuilder import any
from canonical.launchpad.webapp import LaunchpadView
-
from lp.app.errors import NotFoundError
+from lp.bugs.interfaces.bugtask import (
+ BugTaskSearchParams,
+ IBugTaskSet,
+ )
from lp.code.errors import (
CannotHaveLinkedBranch,
InvalidNamespace,
@@ -22,8 +25,6 @@
NoSuchBranch,
)
from lp.code.interfaces.branchlookup import IBranchLookup
-from lp.bugs.interfaces.bugtask import BugTaskSearchParams, IBugTaskSet
-from lp.registry.interfaces.person import IPerson
from lp.registry.interfaces.product import InvalidProductName
@@ -65,7 +66,7 @@
for link_type in links_to_check:
links = links_to_check[link_type]
invalid_links = self.link_checkers[link_type](links)
- result['invalid_'+link_type] = invalid_links
+ result['invalid_' + link_type] = invalid_links
self.request.response.setHeader('Content-type', 'application/json')
return simplejson.dumps(result)
@@ -96,9 +97,10 @@
bug_ids = getUtility(IBugTaskSet).searchBugIds(params)
invalid = set(bugs) - set(bug_ids)
for bug in invalid:
- invalid_links['/bugs/' + str(bug)] = "Bug %s cannot be found" % bug
+ invalid_links['/bugs/' + str(bug)] = (
+ "Bug %s cannot be found" % bug)
return invalid_links
-
+
def _error_message(self, ex):
if hasattr(ex, 'display_message'):
return ex.display_message
=== modified file 'lib/lp/app/browser/stringformatter.py'
--- lib/lp/app/browser/stringformatter.py 2011-07-31 05:49:33 +0000
+++ lib/lp/app/browser/stringformatter.py 2011-08-28 07:37:26 +0000
@@ -4,6 +4,7 @@
"""TALES formatter for strings."""
from base64 import urlsafe_b64encode
+
__metaclass__ = type
__all__ = [
'add_word_breaks',
@@ -283,7 +284,8 @@
# linkify to the general bug url.
url = '/bugs/%s' % bugnum
# The text will have already been cgi escaped.
- return '<a href="%s" class="bug-link">%s</a>%s' % (url, text, trailers)
+ return '<a href="%s" class="bug-link">%s</a>%s' % (
+ url, text, trailers)
@staticmethod
def _handle_parens_in_trailers(url, trailers):
=== modified file 'lib/lp/app/browser/tests/test_linkchecker.py'
--- lib/lp/app/browser/tests/test_linkchecker.py 2011-08-22 07:06:05 +0000
+++ lib/lp/app/browser/tests/test_linkchecker.py 2011-08-28 07:37:26 +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).
"""Unit tests for the LinkCheckerAPI."""
@@ -10,7 +10,6 @@
import simplejson
from zope.security.proxy import removeSecurityProxy
-from canonical.launchpad.webapp import canonical_url
from canonical.launchpad.webapp.servers import LaunchpadTestRequest
from canonical.testing.layers import DatabaseFunctionalLayer
from lp.app.browser.linkchecker import LinkCheckerAPI
@@ -75,7 +74,7 @@
branch_urls = list(valid_branch_urls)
branch_urls.extend(invalid_branch_urls)
shuffle(branch_urls)
-
+
bug_urls = list(valid_bug_urls)
bug_urls.extend(invalid_bug_urls)
shuffle(bug_urls)
@@ -99,12 +98,14 @@
def test_only_valid_links(self):
branch_urls = self.make_valid_branch_links()
bug_urls = self.make_valid_bug_links()
- self.invoke_link_checker(valid_branch_urls=branch_urls, valid_bug_urls=bug_urls)
+ self.invoke_link_checker(
+ valid_branch_urls=branch_urls, valid_bug_urls=bug_urls)
def test_only_invalid_links(self):
branch_urls = self.make_invalid_branch_links()
bug_urls = self.make_invalid_bug_links()
- self.invoke_link_checker(invalid_branch_urls=branch_urls, invalid_bug_urls=bug_urls)
+ self.invoke_link_checker(
+ invalid_branch_urls=branch_urls, invalid_bug_urls=bug_urls)
def test_valid_and_invald_links(self):
valid_branch_urls = self.make_valid_branch_links()
=== modified file 'lib/lp/app/browser/tests/test_stringformatter.py'
--- lib/lp/app/browser/tests/test_stringformatter.py 2011-08-23 01:10:21 +0000
+++ lib/lp/app/browser/tests/test_stringformatter.py 2011-08-28 07:37:26 +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).
"""Unit tests for the string TALES formatter."""
@@ -110,6 +110,7 @@
<tag>1234567890123456</tag>
"""
+
class TestLinkifyingBugs(TestCase):
def test_regular_bug_case_works(self):
@@ -119,9 +120,12 @@
"bug number 34434",
]
expected_html = [
- '<p><a href="/bugs/34434" class="bug-link">bug 34434</a></p>',
- '<p><a href="/bugs/34434" class="bug-link">bugnumber 34434</a></p>',
- '<p><a href="/bugs/34434" class="bug-link">bug number 34434</a></p>',
+ '<p><a href="/bugs/34434" '
+ 'class="bug-link">bug 34434</a></p>',
+ '<p><a href="/bugs/34434" '
+ 'class="bug-link">bugnumber 34434</a></p>',
+ '<p><a href="/bugs/34434" '
+ 'class="bug-link">bug number 34434</a></p>',
]
self.assertEqual(
expected_html,
@@ -147,7 +151,8 @@
def test_explicit_bug_linkification(self):
text = 'LP: #10'
self.assertEqual(
- 'LP: <a href="/bugs/10" class="bug-link">#10</a>', linkify_bug_numbers(text))
+ 'LP: <a href="/bugs/10" class="bug-link">#10</a>',
+ linkify_bug_numbers(text))
class TestLinkifyingProtocols(TestCase):
=== modified file 'lib/lp/app/browser/vocabulary.py'
--- lib/lp/app/browser/vocabulary.py 2011-08-22 14:33:01 +0000
+++ lib/lp/app/browser/vocabulary.py 2011-08-28 07:37:26 +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).
"""Views which export vocabularies as JSON for widgets."""
@@ -11,10 +11,10 @@
'get_person_picker_entry_metadata',
]
-import simplejson
from itertools import izip
from lazr.restful.interfaces import IWebServiceClientRequest
+import simplejson
from zope.app.form.interfaces import MissingInputError
from zope.app.schema.vocabulary import IVocabularyFactory
from zope.component import (
@@ -32,12 +32,12 @@
from canonical.launchpad.webapp.batching import BatchNavigator
from canonical.launchpad.webapp.interfaces import NoCanonicalUrl
from canonical.launchpad.webapp.publisher import canonical_url
+from canonical.launchpad.webapp.vocabulary import IHugeVocabulary
from lp.app.browser.tales import (
DateTimeFormatterAPI,
IRCNicknameFormatterAPI,
ObjectImageDisplayAPI,
)
-from canonical.launchpad.webapp.vocabulary import IHugeVocabulary
from lp.app.errors import UnexpectedFormData
from lp.code.interfaces.branch import IBranch
from lp.registry.interfaces.distributionsourcepackage import (
@@ -355,8 +355,8 @@
self.context,
enhanced_picker_enabled=self.enhanced_picker_enabled,
picker_expander_enabled=self.picker_expander_enabled,
- personpicker_affiliation_enabled=
- self.personpicker_affiliation_enabled)
+ personpicker_affiliation_enabled=(
+ self.personpicker_affiliation_enabled))
for term_value, picker_entry in izip(term_values, picker_entries):
picker_term_entries[term_value] = picker_entry
=== modified file 'lib/lp/archiveuploader/nascentuploadfile.py'
--- lib/lp/archiveuploader/nascentuploadfile.py 2011-03-21 10:30:32 +0000
+++ lib/lp/archiveuploader/nascentuploadfile.py 2011-08-28 07:37:26 +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).
"""Specific models for uploaded files"""
@@ -19,15 +19,15 @@
'splitComponentAndSection',
]
-import apt_inst
-import apt_pkg
-from debian.deb822 import Deb822Dict
import hashlib
import os
import subprocess
import sys
import time
+import apt_inst
+import apt_pkg
+from debian.deb822 import Deb822Dict
from zope.component import getUtility
from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
@@ -819,7 +819,6 @@
yield UploadError("%s: deb contents timestamp check failed: %s"
% (self.filename, error))
-
#
# Database relationship methods
#
@@ -849,7 +848,6 @@
"Unable to find source package %s/%s in %s" % (
self.source_name, self.source_version, distroseries.name))
-
def verifySourcePackageRelease(self, sourcepackagerelease):
"""Check if the given ISourcePackageRelease matches the context."""
assert 'source' in self.changes.architectures, (
=== modified file 'lib/lp/blueprints/browser/tests/test_specification.py'
--- lib/lp/blueprints/browser/tests/test_specification.py 2011-08-25 10:20:17 +0000
+++ lib/lp/blueprints/browser/tests/test_specification.py 2011-08-28 07:37:26 +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).
__metaclass__ = type
@@ -17,12 +17,12 @@
from zope.publisher.interfaces import NotFound
from zope.security.proxy import removeSecurityProxy
-from canonical.launchpad.webapp.interfaces import BrowserNotificationLevel
-from canonical.launchpad.webapp.servers import StepsToGo
from canonical.launchpad.testing.pages import (
extract_text,
find_tag_by_id,
)
+from canonical.launchpad.webapp.interfaces import BrowserNotificationLevel
+from canonical.launchpad.webapp.servers import StepsToGo
from canonical.testing.layers import DatabaseFunctionalLayer
from lp.app.browser.tales import format_link
from lp.blueprints.browser import specification
@@ -38,6 +38,7 @@
)
from lp.testing.views import create_initialized_view
+
class TestSpecificationSearch(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
@@ -167,9 +168,15 @@
owner=self.factory.makePerson(displayname="Some Person"))
html = create_initialized_view(
spec, '+index')()
- self.assertThat(extract_text(html), DocTestMatches(extract_text(
- "... Registered by Some Person a moment ago ..."), doctest.ELLIPSIS
- | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF))
+ self.assertThat(
+ extract_text(html), DocTestMatches(
+ extract_text(
+ "... Registered by Some Person a moment ago ..."),
+ (
+ doctest.ELLIPSIS |
+ doctest.NORMALIZE_WHITESPACE |
+ doctest.REPORT_NDIFF)))
+
class TestSpecificationEditStatusView(TestCaseWithFactory):
"""Test the SpecificationEditStatusView."""
=== modified file 'lib/lp/bugs/tests/test_bugs_webservice.py'
--- lib/lp/bugs/tests/test_bugs_webservice.py 2011-08-22 13:59:47 +0000
+++ lib/lp/bugs/tests/test_bugs_webservice.py 2011-08-28 07:37:26 +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).
"""Webservice unit tests related to Launchpad Bugs."""
@@ -194,7 +194,6 @@
store = Store.of(self.bug)
self.factory.makeBugAttachment(self.bug)
self.factory.makeBugAttachment(self.bug)
- person = self.factory.makePerson()
webservice = LaunchpadWebServiceCaller(
'launchpad-library', 'salgado-change-anything')
collector = QueryCollector()
@@ -230,7 +229,6 @@
self.factory.makeBugComment(bug)
self.factory.makeBugComment(bug)
self.factory.makeBugComment(bug)
- person = self.factory.makePerson()
webservice = LaunchpadWebServiceCaller(
'launchpad-library', 'salgado-change-anything')
collector = QueryCollector()
@@ -343,9 +341,9 @@
def test_add_duplicate_bugtask_for_project_gives_bad_request(self):
bug = self.factory.makeBug()
product = self.factory.makeProduct()
- bugtask = self.factory.makeBugTask(bug=bug, target=product)
+ self.factory.makeBugTask(bug=bug, target=product)
launchpad = launchpadlib_for('test', bug.owner)
lp_bug = launchpad.load(api_url(bug))
- exception = self.assertRaises(
+ self.assertRaises(
BadRequest, lp_bug.addTask, target=api_url(product))
=== modified file 'lib/lp/bugs/tests/test_structuralsubscription.py'
--- lib/lp/bugs/tests/test_structuralsubscription.py 2011-08-22 23:21:16 +0000
+++ lib/lp/bugs/tests/test_structuralsubscription.py 2011-08-28 07:37:26 +0000
@@ -1,11 +1,10 @@
-# 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).
"""Tests for `StructuralSubscription`."""
__metaclass__ = type
-from storm.expr import SQL
from storm.store import (
EmptyResultSet,
ResultSet,
@@ -15,8 +14,8 @@
from zope.security.interfaces import Unauthorized
from canonical.testing.layers import (
+ DatabaseFunctionalLayer,
LaunchpadFunctionalLayer,
- DatabaseFunctionalLayer,
)
from lp.bugs.enum import BugNotificationLevel
from lp.bugs.interfaces.bugtask import (
@@ -24,18 +23,16 @@
BugTaskStatus,
)
from lp.bugs.mail.bugnotificationrecipients import BugNotificationRecipients
-from lp.bugs.model.bugnotification import BugNotification
from lp.bugs.model.bugsubscriptionfilter import (
BugSubscriptionFilter,
BugSubscriptionFilterMute,
MuteNotAllowed,
)
from lp.bugs.model.structuralsubscription import (
- get_structural_subscriptions_for_bug,
get_structural_subscribers,
get_structural_subscription_targets,
+ get_structural_subscriptions_for_bug,
)
-from lp.bugs.scripts.bugnotification import get_email_notifications
from lp.testing import (
anonymous_logged_in,
login_person,
@@ -527,7 +524,7 @@
project=project, owner=project.owner)
subscriber = self.factory.makePerson()
with person_logged_in(subscriber):
- self_sub = project.addBugSubscription(subscriber, subscriber)
+ project.addBugSubscription(subscriber, subscriber)
# This is a sanity check.
self.assertEqual(project, product.parent_subscription_target)
bug = self.factory.makeBug(product=product)
@@ -536,6 +533,7 @@
set([(bug.bugtasks[0], product), (bug.bugtasks[0], project)]),
set(result))
+
class TestGetStructuralSubscriptionsForBug(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
=== modified file 'lib/lp/code/enums.py'
--- lib/lp/code/enums.py 2011-08-25 23:32:36 +0000
+++ lib/lp/code/enums.py 2011-08-28 07:37:26 +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).
"""Enumerations used in the lp/code modules."""
@@ -222,7 +222,7 @@
Limit the generated diff to 500 lines.
""")
- ONEKLINES = DBItem(1000, """
+ ONEKLINES = DBItem(1000, """
1000 lines
Limit the generated diff to 1000 lines.
@@ -234,7 +234,7 @@
Limit the generated diff to 5000 lines.
""")
- WHOLEDIFF = DBItem(-1, """
+ WHOLEDIFF = DBItem(-1, """
Send entire diff
Don't limit the size of the diff.
=== modified file 'lib/lp/code/model/codeimport.py'
--- lib/lp/code/model/codeimport.py 2011-08-24 21:17:35 +0000
+++ lib/lp/code/model/codeimport.py 2011-08-28 07:37:26 +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).
# pylint: disable-msg=E0611,W0212
@@ -140,7 +140,7 @@
return self.url
else:
raise AssertionError(
- 'Unknown rcs type: %s'% self.rcs_type.title)
+ "Unknown rcs type: %s" % self.rcs_type.title)
def _removeJob(self):
"""If there is a pending job, remove it."""
@@ -220,15 +220,16 @@
def requestImport(self, requester, error_if_already_requested=False):
"""See `ICodeImport`."""
- if self.import_job is None: # not in automatic mode
- raise CodeImportNotInReviewedState("This code import is %s, and "
- "must be Reviewed for you to call requestImport."
+ if self.import_job is None:
+ # Not in automatic mode.
+ raise CodeImportNotInReviewedState(
+ "This code import is %s, and must be Reviewed for you to "
+ "call requestImport."
% self.review_status.name)
- if (self.import_job.state != CodeImportJobState.PENDING):
- assert (self.import_job.state == CodeImportJobState.RUNNING)
- # Already running
- raise CodeImportAlreadyRunning("This code import is already "
- "running.")
+ if self.import_job.state != CodeImportJobState.PENDING:
+ assert self.import_job.state == CodeImportJobState.RUNNING
+ raise CodeImportAlreadyRunning(
+ "This code import is already running.")
elif self.import_job.requesting_user is not None:
if error_if_already_requested:
raise CodeImportAlreadyRequested("This code import has "
@@ -262,7 +263,7 @@
else:
raise AssertionError(
"Don't know how to sanity check source details for unknown "
- "rcs_type %s"%rcs_type)
+ "rcs_type %s" % rcs_type)
if review_status is None:
# Auto approve git and hg imports.
if rcs_type in (