Merge ~twom/launchpad:lint-e722 into launchpad:master

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 06424d4dd42eb1c02a7a6f3a2d136290d608f730
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~twom/launchpad:lint-e722
Merge into: launchpad:master
Diff against target: 521 lines (+46/-46)
32 files modified
lib/lp/archivepublisher/scripts/publish_ftpmaster.py (+1/-1)
lib/lp/archivepublisher/tests/test_publish_ftpmaster.py (+1/-1)
lib/lp/archiveuploader/dscfile.py (+1/-1)
lib/lp/archiveuploader/uploadprocessor.py (+4/-4)
lib/lp/bugs/externalbugtracker/bugzilla.py (+1/-1)
lib/lp/bugs/scripts/checkwatches/base.py (+1/-1)
lib/lp/bugs/vocabularies.py (+1/-1)
lib/lp/code/model/directbranchcommit.py (+1/-1)
lib/lp/code/model/sourcepackagerecipebuild.py (+1/-1)
lib/lp/codehosting/puller/scheduler.py (+1/-1)
lib/lp/codehosting/puller/tests/__init__.py (+1/-1)
lib/lp/codehosting/upgrade.py (+1/-1)
lib/lp/services/database/__init__.py (+1/-1)
lib/lp/services/database/sqlbase.py (+1/-1)
lib/lp/services/job/runner.py (+2/-2)
lib/lp/services/job/tests/test_celeryjob.py (+1/-1)
lib/lp/services/librarianserver/libraryprotocol.py (+1/-1)
lib/lp/services/librarianserver/storage.py (+2/-2)
lib/lp/services/librarianserver/testing/tests/test_server_fixture.py (+1/-1)
lib/lp/services/profile/profile.py (+1/-1)
lib/lp/services/spriteutils.py (+1/-1)
lib/lp/services/stacktrace.py (+3/-3)
lib/lp/services/twistedsupport/tests/test_processmonitor.py (+1/-1)
lib/lp/services/twistedsupport/tests/test_xmlrpc.py (+1/-1)
lib/lp/services/webapp/publication.py (+1/-1)
lib/lp/soyuz/model/packagecopyjob.py (+1/-1)
lib/lp/soyuz/scripts/gina/changelog.py (+1/-1)
lib/lp/testing/yuixhr.py (+3/-3)
lib/lp/translations/scripts/copy_distroseries_translations.py (+2/-2)
lib/lp/translations/scripts/language_pack.py (+5/-5)
scripts/script-monitor.py (+1/-1)
utilities/community-contributions.py (+1/-1)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+406640@code.launchpad.net

Commit message

Fix E722 violations

Description of the change

Swap bare except for `except Exception`

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

A number of these are last-ditch cleanup measures, so `except BaseException:` would be appropriate rather than `except Exception:`. (This should normally be used with care because it catches even `SystemExit`, `KeyboardInterrupt`, and `GeneratorExit`, but in most of the cases where we were previously using bare `except`, that's the desired behaviour.) I've noted the cases where I think this should be changed.

review: Approve
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
index e2d22a6..5326141 100644
--- a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
+++ b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
@@ -543,7 +543,7 @@ class PublishFTPMaster(LaunchpadCronScript):
543 # Swizzle the now-updated backup dists and the current dists543 # Swizzle the now-updated backup dists and the current dists
544 # around.544 # around.
545 self.installDists(distribution)545 self.installDists(distribution)
546 except:546 except BaseException:
547 # If we failed here, there's a chance that we left a547 # If we failed here, there's a chance that we left a
548 # working dists directory in its temporary location. If so,548 # working dists directory in its temporary location. If so,
549 # recover it. The next script run would do that anyway, but549 # recover it. The next script run would do that anyway, but
diff --git a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
index 2039856..3861a50 100644
--- a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
+++ b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
@@ -1100,7 +1100,7 @@ class TestCreateDistroSeriesIndexes(TestCaseWithFactory, HelpersMixin):
1100 script.runPublishDistro = FakeMethod(failure=Boom("Sorry!"))1100 script.runPublishDistro = FakeMethod(failure=Boom("Sorry!"))
1101 try:1101 try:
1102 script.createIndexes(series.distribution, [get_a_suite(series)])1102 script.createIndexes(series.distribution, [get_a_suite(series)])
1103 except:1103 except Exception:
1104 pass1104 pass
1105 self.assertEqual([], script.markIndexCreationComplete.calls)1105 self.assertEqual([], script.markIndexCreationComplete.calls)
11061106
diff --git a/lib/lp/archiveuploader/dscfile.py b/lib/lp/archiveuploader/dscfile.py
index 369f8d9..ba47bd3 100644
--- a/lib/lp/archiveuploader/dscfile.py
+++ b/lib/lp/archiveuploader/dscfile.py
@@ -90,7 +90,7 @@ def unpack_source(dsc_filepath):
90 unpacked_dir = tempfile.mkdtemp()90 unpacked_dir = tempfile.mkdtemp()
91 try:91 try:
92 extract_dpkg_source(dsc_filepath, unpacked_dir)92 extract_dpkg_source(dsc_filepath, unpacked_dir)
93 except:93 except Exception:
94 shutil.rmtree(unpacked_dir)94 shutil.rmtree(unpacked_dir)
95 raise95 raise
9696
diff --git a/lib/lp/archiveuploader/uploadprocessor.py b/lib/lp/archiveuploader/uploadprocessor.py
index b8d1148..54510c7 100644
--- a/lib/lp/archiveuploader/uploadprocessor.py
+++ b/lib/lp/archiveuploader/uploadprocessor.py
@@ -432,7 +432,7 @@ class UploadHandler:
432 "Committing the transaction and any mails associated "432 "Committing the transaction and any mails associated "
433 "with this upload.")433 "with this upload.")
434 self.processor.ztm.commit()434 self.processor.ztm.commit()
435 except:435 except BaseException:
436 self.processor.ztm.abort()436 self.processor.ztm.abort()
437 raise437 raise
438438
@@ -605,7 +605,7 @@ class BuildUploadHandler(UploadHandler):
605 "with this upload.")605 "with this upload.")
606 self.processor.ztm.commit()606 self.processor.ztm.commit()
607 return UploadStatusEnum.ACCEPTED607 return UploadStatusEnum.ACCEPTED
608 except:608 except BaseException:
609 self.processor.ztm.abort()609 self.processor.ztm.abort()
610 raise610 raise
611611
@@ -630,7 +630,7 @@ class BuildUploadHandler(UploadHandler):
630 except UploadError as e:630 except UploadError as e:
631 logger.error(str(e))631 logger.error(str(e))
632 return UploadStatusEnum.REJECTED632 return UploadStatusEnum.REJECTED
633 except:633 except BaseException:
634 self.processor.ztm.abort()634 self.processor.ztm.abort()
635 raise635 raise
636636
@@ -681,7 +681,7 @@ class BuildUploadHandler(UploadHandler):
681 except UploadError as e:681 except UploadError as e:
682 logger.error(str(e))682 logger.error(str(e))
683 return UploadStatusEnum.REJECTED683 return UploadStatusEnum.REJECTED
684 except:684 except BaseException:
685 self.processor.ztm.abort()685 self.processor.ztm.abort()
686 raise686 raise
687687
diff --git a/lib/lp/bugs/externalbugtracker/bugzilla.py b/lib/lp/bugs/externalbugtracker/bugzilla.py
index 7ab8ac5..830f680 100644
--- a/lib/lp/bugs/externalbugtracker/bugzilla.py
+++ b/lib/lp/bugs/externalbugtracker/bugzilla.py
@@ -517,7 +517,7 @@ class Bugzilla(ExternalBugTracker):
517 if bug_id not in self.remote_bug_importance:517 if bug_id not in self.remote_bug_importance:
518 return "Bug %s is not in remote_bug_importance" % bug_id518 return "Bug %s is not in remote_bug_importance" % bug_id
519 return self.remote_bug_importance[bug_id]519 return self.remote_bug_importance[bug_id]
520 except:520 except Exception:
521 return UNKNOWN_REMOTE_IMPORTANCE521 return UNKNOWN_REMOTE_IMPORTANCE
522522
523 def getRemoteStatus(self, bug_id):523 def getRemoteStatus(self, bug_id):
diff --git a/lib/lp/bugs/scripts/checkwatches/base.py b/lib/lp/bugs/scripts/checkwatches/base.py
index 016ea8e..a778b78 100644
--- a/lib/lp/bugs/scripts/checkwatches/base.py
+++ b/lib/lp/bugs/scripts/checkwatches/base.py
@@ -163,7 +163,7 @@ class WorkingBase:
163 check_no_transaction()163 check_no_transaction()
164 try:164 try:
165 yield self._transaction_manager165 yield self._transaction_manager
166 except:166 except BaseException:
167 self._transaction_manager.abort()167 self._transaction_manager.abort()
168 # Let the exception propagate.168 # Let the exception propagate.
169 raise169 raise
diff --git a/lib/lp/bugs/vocabularies.py b/lib/lp/bugs/vocabularies.py
index 7863a3b..5c4c70a 100644
--- a/lib/lp/bugs/vocabularies.py
+++ b/lib/lp/bugs/vocabularies.py
@@ -407,7 +407,7 @@ class BugTaskMilestoneVocabulary:
407 """See `IVocabularyTokenized`."""407 """See `IVocabularyTokenized`."""
408 try:408 try:
409 return self.toTerm(self.milestones[str(token)])409 return self.toTerm(self.milestones[str(token)])
410 except:410 except Exception:
411 raise LookupError(token)411 raise LookupError(token)
412412
413 def __len__(self):413 def __len__(self):
diff --git a/lib/lp/code/model/directbranchcommit.py b/lib/lp/code/model/directbranchcommit.py
index 89586b0..17f0e8d 100644
--- a/lib/lp/code/model/directbranchcommit.py
+++ b/lib/lp/code/model/directbranchcommit.py
@@ -118,7 +118,7 @@ class DirectBranchCommit:
118 db_branch, get_branch_info(self.bzrbranch))118 db_branch, get_branch_info(self.bzrbranch))
119119
120 self.is_open = True120 self.is_open = True
121 except:121 except BaseException:
122 self.unlock()122 self.unlock()
123 raise123 raise
124124
diff --git a/lib/lp/code/model/sourcepackagerecipebuild.py b/lib/lp/code/model/sourcepackagerecipebuild.py
index 0320c77..aac5a0f 100644
--- a/lib/lp/code/model/sourcepackagerecipebuild.py
+++ b/lib/lp/code/model/sourcepackagerecipebuild.py
@@ -257,7 +257,7 @@ class SourcePackageRecipeBuild(SpecificBuildFarmJobSourceMixin,
257 ' - cannot build against %s.' % series_name)257 ' - cannot build against %s.' % series_name)
258 except ProgrammingError:258 except ProgrammingError:
259 raise259 raise
260 except:260 except Exception:
261 logger.exception(' - problem with %s', series_name)261 logger.exception(' - problem with %s', series_name)
262 else:262 else:
263 logger.debug(' - build requested for %s', series_name)263 logger.debug(' - build requested for %s', series_name)
diff --git a/lib/lp/codehosting/puller/scheduler.py b/lib/lp/codehosting/puller/scheduler.py
index e0b8363..90442cb 100644
--- a/lib/lp/codehosting/puller/scheduler.py
+++ b/lib/lp/codehosting/puller/scheduler.py
@@ -151,7 +151,7 @@ class PullerWireProtocol(NetstringReceiver):
151 try:151 try:
152 try:152 try:
153 method(*self._current_args)153 method(*self._current_args)
154 except:154 except Exception:
155 self.puller_protocol.unexpectedError(failure.Failure())155 self.puller_protocol.unexpectedError(failure.Failure())
156 finally:156 finally:
157 self._resetState()157 self._resetState()
diff --git a/lib/lp/codehosting/puller/tests/__init__.py b/lib/lp/codehosting/puller/tests/__init__.py
index 350eda7..2d5b0ae 100644
--- a/lib/lp/codehosting/puller/tests/__init__.py
+++ b/lib/lp/codehosting/puller/tests/__init__.py
@@ -74,7 +74,7 @@ def fixed_handle_request(self):
74 if self.verify_request(request, client_address):74 if self.verify_request(request, client_address):
75 try:75 try:
76 self.process_request(request, client_address)76 self.process_request(request, client_address)
77 except:77 except Exception:
78 self.handle_error(request, client_address)78 self.handle_error(request, client_address)
79 self.close_request(request)79 self.close_request(request)
8080
diff --git a/lib/lp/codehosting/upgrade.py b/lib/lp/codehosting/upgrade.py
index 2159871..54112b2 100755
--- a/lib/lp/codehosting/upgrade.py
+++ b/lib/lp/codehosting/upgrade.py
@@ -174,7 +174,7 @@ class Upgrader:
174 bzrdir = BzrDir.create(upgrade_dir, self.get_target_format())174 bzrdir = BzrDir.create(upgrade_dir, self.get_target_format())
175 repository = bzrdir.create_repository()175 repository = bzrdir.create_repository()
176 repository.fetch(self.bzr_branch.repository)176 repository.fetch(self.bzr_branch.repository)
177 except:177 except Exception:
178 rmtree(upgrade_dir)178 rmtree(upgrade_dir)
179 raise179 raise
180 else:180 else:
diff --git a/lib/lp/services/database/__init__.py b/lib/lp/services/database/__init__.py
index 5af379f..3bbca06 100644
--- a/lib/lp/services/database/__init__.py
+++ b/lib/lp/services/database/__init__.py
@@ -77,7 +77,7 @@ def write_transaction(func):
77 transaction.begin()77 transaction.begin()
78 try:78 try:
79 ret = func(*args, **kwargs)79 ret = func(*args, **kwargs)
80 except:80 except BaseException:
81 transaction.abort()81 transaction.abort()
82 raise82 raise
83 transaction.commit()83 transaction.commit()
diff --git a/lib/lp/services/database/sqlbase.py b/lib/lp/services/database/sqlbase.py
index cf7d5d5..96a5c62 100644
--- a/lib/lp/services/database/sqlbase.py
+++ b/lib/lp/services/database/sqlbase.py
@@ -205,7 +205,7 @@ class SQLBase(storm.sqlobject.SQLObjectBase):
205 store.add(self)205 store.add(self)
206 try:206 try:
207 self._create(None, **kwargs)207 self._create(None, **kwargs)
208 except:208 except Exception:
209 store.remove(self)209 store.remove(self)
210 raise210 raise
211211
diff --git a/lib/lp/services/job/runner.py b/lib/lp/services/job/runner.py
index 2ec4506..e37b54e 100644
--- a/lib/lp/services/job/runner.py
+++ b/lib/lp/services/job/runner.py
@@ -677,9 +677,9 @@ class TwistedJobRunner(BaseJobRunner):
677 if job is None:677 if job is None:
678 self.logger.info('No jobs to run.')678 self.logger.info('No jobs to run.')
679 self.terminated()679 self.terminated()
680 except:680 except BaseException:
681 self.failed(failure.Failure())681 self.failed(failure.Failure())
682 except:682 except BaseException:
683 self.terminated()683 self.terminated()
684 raise684 raise
685685
diff --git a/lib/lp/services/job/tests/test_celeryjob.py b/lib/lp/services/job/tests/test_celeryjob.py
index 22ec50e..9757d36 100644
--- a/lib/lp/services/job/tests/test_celeryjob.py
+++ b/lib/lp/services/job/tests/test_celeryjob.py
@@ -86,7 +86,7 @@ class TestRunMissingJobs(TestCaseWithFactory):
86 missing_ready = find_missing_ready_obj.find_missing_ready()86 missing_ready = find_missing_ready_obj.find_missing_ready()
87 try:87 try:
88 self.assertEqual([], missing_ready)88 self.assertEqual([], missing_ready)
89 except:89 except Exception:
90 # XXX AaronBentley: 2012-08-01 bug=1031018: Extra diagnostic info90 # XXX AaronBentley: 2012-08-01 bug=1031018: Extra diagnostic info
91 # to help diagnose this hard-to-reproduce failure.91 # to help diagnose this hard-to-reproduce failure.
92 self.addTextDetail('queued_job_ids',92 self.addTextDetail('queued_job_ids',
diff --git a/lib/lp/services/librarianserver/libraryprotocol.py b/lib/lp/services/librarianserver/libraryprotocol.py
index c59ca28..bd11e39 100644
--- a/lib/lp/services/librarianserver/libraryprotocol.py
+++ b/lib/lp/services/librarianserver/libraryprotocol.py
@@ -74,7 +74,7 @@ class FileUploadProtocol(basic.LineReceiver):
74 getattr(self, 'line_' + self.state, self.badLine)(line)74 getattr(self, 'line_' + self.state, self.badLine)(line)
75 except ProtocolViolation as e:75 except ProtocolViolation as e:
76 self.sendError(e.msg)76 self.sendError(e.msg)
77 except:77 except Exception:
78 self.unknownError()78 self.unknownError()
7979
80 def sendError(self, msg, code='400'):80 def sendError(self, msg, code='400'):
diff --git a/lib/lp/services/librarianserver/storage.py b/lib/lp/services/librarianserver/storage.py
index 053f37d..cebcd59 100644
--- a/lib/lp/services/librarianserver/storage.py
+++ b/lib/lp/services/librarianserver/storage.py
@@ -271,7 +271,7 @@ class LibraryFileUpload(object):
271 aliasID = None271 aliasID = None
272 self.debugLog.append('received contentID: %r' % (contentID, ))272 self.debugLog.append('received contentID: %r' % (contentID, ))
273273
274 except:274 except Exception:
275 # Abort transaction and re-raise275 # Abort transaction and re-raise
276 self.debugLog.append('failed to get contentID/aliasID, aborting')276 self.debugLog.append('failed to get contentID/aliasID, aborting')
277 raise277 raise
@@ -279,7 +279,7 @@ class LibraryFileUpload(object):
279 # Move file to final location279 # Move file to final location
280 try:280 try:
281 self._move(contentID)281 self._move(contentID)
282 except:282 except Exception:
283 # Abort DB transaction283 # Abort DB transaction
284 self.debugLog.append('failed to move file, aborting')284 self.debugLog.append('failed to move file, aborting')
285285
diff --git a/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py b/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py
index c315ca4..c960098 100644
--- a/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py
+++ b/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py
@@ -83,7 +83,7 @@ class TestLibrarianServerFixture(TestCase):
83 fixture.restricted_download_port,83 fixture.restricted_download_port,
84 )84 )
85 self.assertEqual(expected_config, fixture.service_config)85 self.assertEqual(expected_config, fixture.service_config)
86 except:86 except Exception:
87 self.attachLibrarianLog(fixture)87 self.attachLibrarianLog(fixture)
88 raise88 raise
8989
diff --git a/lib/lp/services/profile/profile.py b/lib/lp/services/profile/profile.py
index 85e98f1..e98f17f 100644
--- a/lib/lp/services/profile/profile.py
+++ b/lib/lp/services/profile/profile.py
@@ -89,7 +89,7 @@ class Profiler:
89 self.profiler_lock.acquire(True) # Blocks.89 self.profiler_lock.acquire(True) # Blocks.
90 try:90 try:
91 self.enable()91 self.enable()
92 except:92 except Exception:
93 self.profiler_lock.release()93 self.profiler_lock.release()
94 self.started = False94 self.started = False
95 raise95 raise
diff --git a/lib/lp/services/spriteutils.py b/lib/lp/services/spriteutils.py
index 2ecd703..735f706 100644
--- a/lib/lp/services/spriteutils.py
+++ b/lib/lp/services/spriteutils.py
@@ -195,7 +195,7 @@ class SpriteUtil:
195 for x_position in range(width, max_sprite_width, width):195 for x_position in range(width, max_sprite_width, width):
196 position[0] = x_position196 position[0] = x_position
197 combined_image.paste(sprite_image, tuple(position))197 combined_image.paste(sprite_image, tuple(position))
198 except:198 except Exception:
199 print(199 print(
200 "Error with image file %s" % sprite['filename'],200 "Error with image file %s" % sprite['filename'],
201 file=sys.stderr)201 file=sys.stderr)
diff --git a/lib/lp/services/stacktrace.py b/lib/lp/services/stacktrace.py
index 6b3cacb..10b6764 100644
--- a/lib/lp/services/stacktrace.py
+++ b/lib/lp/services/stacktrace.py
@@ -29,7 +29,7 @@ def _try_except(callable, *args, **kwargs):
29 return callable(*args, **kwargs)29 return callable(*args, **kwargs)
30 except EXPLOSIVE_ERRORS:30 except EXPLOSIVE_ERRORS:
31 raise31 raise
32 except:32 except Exception:
33 if DEBUG_EXCEPTION_FORMATTER:33 if DEBUG_EXCEPTION_FORMATTER:
34 traceback.print_exc(file=sys.stderr)34 traceback.print_exc(file=sys.stderr)
35 # return None35 # return None
@@ -100,7 +100,7 @@ def format_list(extracted_list):
100 item.append(_fmt(info))100 item.append(_fmt(info))
101 except EXPLOSIVE_ERRORS:101 except EXPLOSIVE_ERRORS:
102 raise102 raise
103 except:103 except Exception:
104 # The values above may not stringify properly, or who knows what104 # The values above may not stringify properly, or who knows what
105 # else. Be defensive.105 # else. Be defensive.
106 if DEBUG_EXCEPTION_FORMATTER:106 if DEBUG_EXCEPTION_FORMATTER:
@@ -170,7 +170,7 @@ def _get_frame_data(f, lineno):
170 warnings.append(warning)170 warnings.append(warning)
171 except EXPLOSIVE_ERRORS:171 except EXPLOSIVE_ERRORS:
172 raise172 raise
173 except:173 except Exception:
174 if DEBUG_EXCEPTION_FORMATTER:174 if DEBUG_EXCEPTION_FORMATTER:
175 traceback.print_exc(file=sys.stderr)175 traceback.print_exc(file=sys.stderr)
176 supplement_dict = dict(warnings=warnings, extra=extra)176 supplement_dict = dict(warnings=warnings, extra=extra)
diff --git a/lib/lp/services/twistedsupport/tests/test_processmonitor.py b/lib/lp/services/twistedsupport/tests/test_processmonitor.py
index 3ea4fd7..9ff30f6 100644
--- a/lib/lp/services/twistedsupport/tests/test_processmonitor.py
+++ b/lib/lp/services/twistedsupport/tests/test_processmonitor.py
@@ -35,7 +35,7 @@ def makeFailure(exception_factory, *args, **kwargs):
35 """35 """
36 try:36 try:
37 raise exception_factory(*args, **kwargs)37 raise exception_factory(*args, **kwargs)
38 except:38 except Exception:
39 return failure.Failure()39 return failure.Failure()
4040
4141
diff --git a/lib/lp/services/twistedsupport/tests/test_xmlrpc.py b/lib/lp/services/twistedsupport/tests/test_xmlrpc.py
index ebe72e9..126d275 100644
--- a/lib/lp/services/twistedsupport/tests/test_xmlrpc.py
+++ b/lib/lp/services/twistedsupport/tests/test_xmlrpc.py
@@ -52,7 +52,7 @@ class TestTrapFault(TestCase):
52 """Make a `Failure` from the given exception factory."""52 """Make a `Failure` from the given exception factory."""
53 try:53 try:
54 raise exception_factory(*args, **kwargs)54 raise exception_factory(*args, **kwargs)
55 except:55 except Exception:
56 return Failure()56 return Failure()
5757
58 def assertRaisesFailure(self, failure, function, *args, **kwargs):58 def assertRaisesFailure(self, failure, function, *args, **kwargs):
diff --git a/lib/lp/services/webapp/publication.py b/lib/lp/services/webapp/publication.py
index 955685a..6aadefe 100644
--- a/lib/lp/services/webapp/publication.py
+++ b/lib/lp/services/webapp/publication.py
@@ -268,7 +268,7 @@ class LaunchpadBrowserPublication(
268 request_txt = 'Exception converting request to string\n\n'268 request_txt = 'Exception converting request to string\n\n'
269 try:269 try:
270 request_txt += traceback.format_exc()270 request_txt += traceback.format_exc()
271 except:271 except Exception:
272 request_txt += 'Unable to render traceback!'272 request_txt += 'Unable to render traceback!'
273 threadrequestfile.write(request_txt.encode('UTF-8'))273 threadrequestfile.write(request_txt.encode('UTF-8'))
274 threadrequestfile.close()274 threadrequestfile.close()
diff --git a/lib/lp/soyuz/model/packagecopyjob.py b/lib/lp/soyuz/model/packagecopyjob.py
index 83c8b1f..4d8871c 100644
--- a/lib/lp/soyuz/model/packagecopyjob.py
+++ b/lib/lp/soyuz/model/packagecopyjob.py
@@ -647,7 +647,7 @@ class PlainPackageCopyJob(PackageCopyJobDerived):
647 pass647 pass
648 except (SuspendJobException, AdvisoryLockHeld):648 except (SuspendJobException, AdvisoryLockHeld):
649 raise649 raise
650 except:650 except Exception:
651 # Abort work done so far, but make sure that we commit the651 # Abort work done so far, but make sure that we commit the
652 # rejection to the PackageUpload.652 # rejection to the PackageUpload.
653 transaction.abort()653 transaction.abort()
diff --git a/lib/lp/soyuz/scripts/gina/changelog.py b/lib/lp/soyuz/scripts/gina/changelog.py
index ec20556..cc31594 100644
--- a/lib/lp/soyuz/scripts/gina/changelog.py
+++ b/lib/lp/soyuz/scripts/gina/changelog.py
@@ -70,7 +70,7 @@ def parse_changelog(changelines):
70 try:70 try:
71 (source, version, urgency) = parse_first_line(line.strip())71 (source, version, urgency) = parse_first_line(line.strip())
72 Version(six.ensure_text(version))72 Version(six.ensure_text(version))
73 except:73 except Exception:
74 stanza.append(line)74 stanza.append(line)
75 #print "state0 Exception skip"75 #print "state0 Exception skip"
76 continue76 continue
diff --git a/lib/lp/testing/yuixhr.py b/lib/lp/testing/yuixhr.py
index c21831b..f66295b 100644
--- a/lib/lp/testing/yuixhr.py
+++ b/lib/lp/testing/yuixhr.py
@@ -335,7 +335,7 @@ class YUITestFixtureControllerView(LaunchpadView):
335 suite = suite_factory()335 suite = suite_factory()
336 except EXPLOSIVE_ERRORS:336 except EXPLOSIVE_ERRORS:
337 raise337 raise
338 except:338 except Exception:
339 warning = 'test_suite raises errors'339 warning = 'test_suite raises errors'
340 else:340 else:
341 case = None341 case = None
@@ -400,7 +400,7 @@ class YUITestFixtureControllerView(LaunchpadView):
400 fixtures[fixture_name](self.request, data)400 fixtures[fixture_name](self.request, data)
401 except EXPLOSIVE_ERRORS:401 except EXPLOSIVE_ERRORS:
402 raise402 raise
403 except:403 except Exception:
404 self.request.response.setStatus(500)404 self.request.response.setStatus(500)
405 result = ''.join(format_exception(*sys.exc_info()))405 result = ''.join(format_exception(*sys.exc_info()))
406 else:406 else:
@@ -421,7 +421,7 @@ class YUITestFixtureControllerView(LaunchpadView):
421 fixtures[fixture_name].teardown(self.request, data)421 fixtures[fixture_name].teardown(self.request, data)
422 except EXPLOSIVE_ERRORS:422 except EXPLOSIVE_ERRORS:
423 raise423 raise
424 except:424 except Exception:
425 self.request.response.setStatus(500)425 self.request.response.setStatus(500)
426 result = ''.join(format_exception(*sys.exc_info()))426 result = ''.join(format_exception(*sys.exc_info()))
427 else:427 else:
diff --git a/lib/lp/translations/scripts/copy_distroseries_translations.py b/lib/lp/translations/scripts/copy_distroseries_translations.py
index 1196e43..e072246 100644
--- a/lib/lp/translations/scripts/copy_distroseries_translations.py
+++ b/lib/lp/translations/scripts/copy_distroseries_translations.py
@@ -131,7 +131,7 @@ def copy_distroseries_translations(source, target, txn, logger,
131 copy_active_translations(131 copy_active_translations(
132 source, target, txn, logger, sourcepackagenames=spns,132 source, target, txn, logger, sourcepackagenames=spns,
133 skip_duplicates=skip_duplicates)133 skip_duplicates=skip_duplicates)
134 except:134 except BaseException:
135 copy_failed = True135 copy_failed = True
136 # Give us a fresh transaction for proper cleanup.136 # Give us a fresh transaction for proper cleanup.
137 txn.abort()137 txn.abort()
@@ -142,7 +142,7 @@ def copy_distroseries_translations(source, target, txn, logger,
142 statekeeper.restore()142 statekeeper.restore()
143 except Warning as message:143 except Warning as message:
144 logger.warning(message)144 logger.warning(message)
145 except:145 except BaseException:
146 logger.warning(146 logger.warning(
147 "Failed to restore hide_all_translations and "147 "Failed to restore hide_all_translations and "
148 "defer_translation_imports flags on %s after translations "148 "defer_translation_imports flags on %s after translations "
diff --git a/lib/lp/translations/scripts/language_pack.py b/lib/lp/translations/scripts/language_pack.py
index 0ef600f..e70ab7d 100644
--- a/lib/lp/translations/scripts/language_pack.py
+++ b/lib/lp/translations/scripts/language_pack.py
@@ -143,7 +143,7 @@ def export(distroseries, component, update, force_utf8, logger):
143143
144 # Store it in the tarball.144 # Store it in the tarball.
145 archive.add_file(path, contents)145 archive.add_file(path, contents)
146 except:146 except Exception:
147 logger.exception(147 logger.exception(
148 "Uncaught exception while exporting PO file %d" % pofile.id)148 "Uncaught exception while exporting PO file %d" % pofile.id)
149149
@@ -217,8 +217,8 @@ def export_language_pack(distribution_name, series_name, logger,
217 try:217 try:
218 filehandle, size = export(218 filehandle, size = export(
219 distroseries, component, update, force_utf8, logger)219 distroseries, component, update, force_utf8, logger)
220 except:220 except Exception:
221 # Bare except statements are used in order to prevent premature221 # Generic exception statements are used in order to prevent premature
222 # termination of the script.222 # termination of the script.
223 logger.exception('Uncaught exception while exporting')223 logger.exception('Uncaught exception while exporting')
224 return None224 return None
@@ -263,8 +263,8 @@ def export_language_pack(distribution_name, series_name, logger,
263 except UploadFailed as e:263 except UploadFailed as e:
264 logger.error('Uploading to the Librarian failed: %s', e)264 logger.error('Uploading to the Librarian failed: %s', e)
265 return None265 return None
266 except:266 except Exception:
267 # Bare except statements are used in order to prevent premature267 # Generic exception statements are used in order to prevent premature
268 # termination of the script.268 # termination of the script.
269 logger.exception(269 logger.exception(
270 'Uncaught exception while uploading to the Librarian')270 'Uncaught exception while uploading to the Librarian')
diff --git a/scripts/script-monitor.py b/scripts/script-monitor.py
index 9671e7e..f859d54 100755
--- a/scripts/script-monitor.py
+++ b/scripts/script-monitor.py
@@ -99,7 +99,7 @@ def main():
99 msg.as_string())99 msg.as_string())
100 smtp.close()100 smtp.close()
101 return 2101 return 2
102 except:102 except Exception:
103 log.exception("Unhandled exception")103 log.exception("Unhandled exception")
104 return 1104 return 1
105105
diff --git a/utilities/community-contributions.py b/utilities/community-contributions.py
index d9c59e2..662d374 100755
--- a/utilities/community-contributions.py
+++ b/utilities/community-contributions.py
@@ -52,7 +52,7 @@ from bzrlib.osutils import format_date
5252
53try:53try:
54 from editmoin import editshortcut54 from editmoin import editshortcut
55except:55except ImportError:
56 sys.stderr.write("""ERROR: Unable to import from 'editmoin'. How to solve:56 sys.stderr.write("""ERROR: Unable to import from 'editmoin'. How to solve:
57Get editmoin.py from launchpadlib's "contrib/" directory:57Get editmoin.py from launchpadlib's "contrib/" directory:
5858

Subscribers

People subscribed via source and target branches

to status/vote changes: