Merge ~twom/launchpad:lint-e722 into launchpad:master
- Git
- lp:~twom/launchpad
- lint-e722
- Merge into 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) |
Related bugs: |
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) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py | |||
2 | index e2d22a6..5326141 100644 | |||
3 | --- a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py | |||
4 | +++ b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py | |||
5 | @@ -543,7 +543,7 @@ class PublishFTPMaster(LaunchpadCronScript): | |||
6 | 543 | # Swizzle the now-updated backup dists and the current dists | 543 | # Swizzle the now-updated backup dists and the current dists |
7 | 544 | # around. | 544 | # around. |
8 | 545 | self.installDists(distribution) | 545 | self.installDists(distribution) |
10 | 546 | except: | 546 | except BaseException: |
11 | 547 | # If we failed here, there's a chance that we left a | 547 | # If we failed here, there's a chance that we left a |
12 | 548 | # working dists directory in its temporary location. If so, | 548 | # working dists directory in its temporary location. If so, |
13 | 549 | # recover it. The next script run would do that anyway, but | 549 | # recover it. The next script run would do that anyway, but |
14 | diff --git a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py | |||
15 | index 2039856..3861a50 100644 | |||
16 | --- a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py | |||
17 | +++ b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py | |||
18 | @@ -1100,7 +1100,7 @@ class TestCreateDistroSeriesIndexes(TestCaseWithFactory, HelpersMixin): | |||
19 | 1100 | script.runPublishDistro = FakeMethod(failure=Boom("Sorry!")) | 1100 | script.runPublishDistro = FakeMethod(failure=Boom("Sorry!")) |
20 | 1101 | try: | 1101 | try: |
21 | 1102 | script.createIndexes(series.distribution, [get_a_suite(series)]) | 1102 | script.createIndexes(series.distribution, [get_a_suite(series)]) |
23 | 1103 | except: | 1103 | except Exception: |
24 | 1104 | pass | 1104 | pass |
25 | 1105 | self.assertEqual([], script.markIndexCreationComplete.calls) | 1105 | self.assertEqual([], script.markIndexCreationComplete.calls) |
26 | 1106 | 1106 | ||
27 | diff --git a/lib/lp/archiveuploader/dscfile.py b/lib/lp/archiveuploader/dscfile.py | |||
28 | index 369f8d9..ba47bd3 100644 | |||
29 | --- a/lib/lp/archiveuploader/dscfile.py | |||
30 | +++ b/lib/lp/archiveuploader/dscfile.py | |||
31 | @@ -90,7 +90,7 @@ def unpack_source(dsc_filepath): | |||
32 | 90 | unpacked_dir = tempfile.mkdtemp() | 90 | unpacked_dir = tempfile.mkdtemp() |
33 | 91 | try: | 91 | try: |
34 | 92 | extract_dpkg_source(dsc_filepath, unpacked_dir) | 92 | extract_dpkg_source(dsc_filepath, unpacked_dir) |
36 | 93 | except: | 93 | except Exception: |
37 | 94 | shutil.rmtree(unpacked_dir) | 94 | shutil.rmtree(unpacked_dir) |
38 | 95 | raise | 95 | raise |
39 | 96 | 96 | ||
40 | diff --git a/lib/lp/archiveuploader/uploadprocessor.py b/lib/lp/archiveuploader/uploadprocessor.py | |||
41 | index b8d1148..54510c7 100644 | |||
42 | --- a/lib/lp/archiveuploader/uploadprocessor.py | |||
43 | +++ b/lib/lp/archiveuploader/uploadprocessor.py | |||
44 | @@ -432,7 +432,7 @@ class UploadHandler: | |||
45 | 432 | "Committing the transaction and any mails associated " | 432 | "Committing the transaction and any mails associated " |
46 | 433 | "with this upload.") | 433 | "with this upload.") |
47 | 434 | self.processor.ztm.commit() | 434 | self.processor.ztm.commit() |
49 | 435 | except: | 435 | except BaseException: |
50 | 436 | self.processor.ztm.abort() | 436 | self.processor.ztm.abort() |
51 | 437 | raise | 437 | raise |
52 | 438 | 438 | ||
53 | @@ -605,7 +605,7 @@ class BuildUploadHandler(UploadHandler): | |||
54 | 605 | "with this upload.") | 605 | "with this upload.") |
55 | 606 | self.processor.ztm.commit() | 606 | self.processor.ztm.commit() |
56 | 607 | return UploadStatusEnum.ACCEPTED | 607 | return UploadStatusEnum.ACCEPTED |
58 | 608 | except: | 608 | except BaseException: |
59 | 609 | self.processor.ztm.abort() | 609 | self.processor.ztm.abort() |
60 | 610 | raise | 610 | raise |
61 | 611 | 611 | ||
62 | @@ -630,7 +630,7 @@ class BuildUploadHandler(UploadHandler): | |||
63 | 630 | except UploadError as e: | 630 | except UploadError as e: |
64 | 631 | logger.error(str(e)) | 631 | logger.error(str(e)) |
65 | 632 | return UploadStatusEnum.REJECTED | 632 | return UploadStatusEnum.REJECTED |
67 | 633 | except: | 633 | except BaseException: |
68 | 634 | self.processor.ztm.abort() | 634 | self.processor.ztm.abort() |
69 | 635 | raise | 635 | raise |
70 | 636 | 636 | ||
71 | @@ -681,7 +681,7 @@ class BuildUploadHandler(UploadHandler): | |||
72 | 681 | except UploadError as e: | 681 | except UploadError as e: |
73 | 682 | logger.error(str(e)) | 682 | logger.error(str(e)) |
74 | 683 | return UploadStatusEnum.REJECTED | 683 | return UploadStatusEnum.REJECTED |
76 | 684 | except: | 684 | except BaseException: |
77 | 685 | self.processor.ztm.abort() | 685 | self.processor.ztm.abort() |
78 | 686 | raise | 686 | raise |
79 | 687 | 687 | ||
80 | diff --git a/lib/lp/bugs/externalbugtracker/bugzilla.py b/lib/lp/bugs/externalbugtracker/bugzilla.py | |||
81 | index 7ab8ac5..830f680 100644 | |||
82 | --- a/lib/lp/bugs/externalbugtracker/bugzilla.py | |||
83 | +++ b/lib/lp/bugs/externalbugtracker/bugzilla.py | |||
84 | @@ -517,7 +517,7 @@ class Bugzilla(ExternalBugTracker): | |||
85 | 517 | if bug_id not in self.remote_bug_importance: | 517 | if bug_id not in self.remote_bug_importance: |
86 | 518 | return "Bug %s is not in remote_bug_importance" % bug_id | 518 | return "Bug %s is not in remote_bug_importance" % bug_id |
87 | 519 | return self.remote_bug_importance[bug_id] | 519 | return self.remote_bug_importance[bug_id] |
89 | 520 | except: | 520 | except Exception: |
90 | 521 | return UNKNOWN_REMOTE_IMPORTANCE | 521 | return UNKNOWN_REMOTE_IMPORTANCE |
91 | 522 | 522 | ||
92 | 523 | def getRemoteStatus(self, bug_id): | 523 | def getRemoteStatus(self, bug_id): |
93 | diff --git a/lib/lp/bugs/scripts/checkwatches/base.py b/lib/lp/bugs/scripts/checkwatches/base.py | |||
94 | index 016ea8e..a778b78 100644 | |||
95 | --- a/lib/lp/bugs/scripts/checkwatches/base.py | |||
96 | +++ b/lib/lp/bugs/scripts/checkwatches/base.py | |||
97 | @@ -163,7 +163,7 @@ class WorkingBase: | |||
98 | 163 | check_no_transaction() | 163 | check_no_transaction() |
99 | 164 | try: | 164 | try: |
100 | 165 | yield self._transaction_manager | 165 | yield self._transaction_manager |
102 | 166 | except: | 166 | except BaseException: |
103 | 167 | self._transaction_manager.abort() | 167 | self._transaction_manager.abort() |
104 | 168 | # Let the exception propagate. | 168 | # Let the exception propagate. |
105 | 169 | raise | 169 | raise |
106 | diff --git a/lib/lp/bugs/vocabularies.py b/lib/lp/bugs/vocabularies.py | |||
107 | index 7863a3b..5c4c70a 100644 | |||
108 | --- a/lib/lp/bugs/vocabularies.py | |||
109 | +++ b/lib/lp/bugs/vocabularies.py | |||
110 | @@ -407,7 +407,7 @@ class BugTaskMilestoneVocabulary: | |||
111 | 407 | """See `IVocabularyTokenized`.""" | 407 | """See `IVocabularyTokenized`.""" |
112 | 408 | try: | 408 | try: |
113 | 409 | return self.toTerm(self.milestones[str(token)]) | 409 | return self.toTerm(self.milestones[str(token)]) |
115 | 410 | except: | 410 | except Exception: |
116 | 411 | raise LookupError(token) | 411 | raise LookupError(token) |
117 | 412 | 412 | ||
118 | 413 | def __len__(self): | 413 | def __len__(self): |
119 | diff --git a/lib/lp/code/model/directbranchcommit.py b/lib/lp/code/model/directbranchcommit.py | |||
120 | index 89586b0..17f0e8d 100644 | |||
121 | --- a/lib/lp/code/model/directbranchcommit.py | |||
122 | +++ b/lib/lp/code/model/directbranchcommit.py | |||
123 | @@ -118,7 +118,7 @@ class DirectBranchCommit: | |||
124 | 118 | db_branch, get_branch_info(self.bzrbranch)) | 118 | db_branch, get_branch_info(self.bzrbranch)) |
125 | 119 | 119 | ||
126 | 120 | self.is_open = True | 120 | self.is_open = True |
128 | 121 | except: | 121 | except BaseException: |
129 | 122 | self.unlock() | 122 | self.unlock() |
130 | 123 | raise | 123 | raise |
131 | 124 | 124 | ||
132 | diff --git a/lib/lp/code/model/sourcepackagerecipebuild.py b/lib/lp/code/model/sourcepackagerecipebuild.py | |||
133 | index 0320c77..aac5a0f 100644 | |||
134 | --- a/lib/lp/code/model/sourcepackagerecipebuild.py | |||
135 | +++ b/lib/lp/code/model/sourcepackagerecipebuild.py | |||
136 | @@ -257,7 +257,7 @@ class SourcePackageRecipeBuild(SpecificBuildFarmJobSourceMixin, | |||
137 | 257 | ' - cannot build against %s.' % series_name) | 257 | ' - cannot build against %s.' % series_name) |
138 | 258 | except ProgrammingError: | 258 | except ProgrammingError: |
139 | 259 | raise | 259 | raise |
141 | 260 | except: | 260 | except Exception: |
142 | 261 | logger.exception(' - problem with %s', series_name) | 261 | logger.exception(' - problem with %s', series_name) |
143 | 262 | else: | 262 | else: |
144 | 263 | logger.debug(' - build requested for %s', series_name) | 263 | logger.debug(' - build requested for %s', series_name) |
145 | diff --git a/lib/lp/codehosting/puller/scheduler.py b/lib/lp/codehosting/puller/scheduler.py | |||
146 | index e0b8363..90442cb 100644 | |||
147 | --- a/lib/lp/codehosting/puller/scheduler.py | |||
148 | +++ b/lib/lp/codehosting/puller/scheduler.py | |||
149 | @@ -151,7 +151,7 @@ class PullerWireProtocol(NetstringReceiver): | |||
150 | 151 | try: | 151 | try: |
151 | 152 | try: | 152 | try: |
152 | 153 | method(*self._current_args) | 153 | method(*self._current_args) |
154 | 154 | except: | 154 | except Exception: |
155 | 155 | self.puller_protocol.unexpectedError(failure.Failure()) | 155 | self.puller_protocol.unexpectedError(failure.Failure()) |
156 | 156 | finally: | 156 | finally: |
157 | 157 | self._resetState() | 157 | self._resetState() |
158 | diff --git a/lib/lp/codehosting/puller/tests/__init__.py b/lib/lp/codehosting/puller/tests/__init__.py | |||
159 | index 350eda7..2d5b0ae 100644 | |||
160 | --- a/lib/lp/codehosting/puller/tests/__init__.py | |||
161 | +++ b/lib/lp/codehosting/puller/tests/__init__.py | |||
162 | @@ -74,7 +74,7 @@ def fixed_handle_request(self): | |||
163 | 74 | if self.verify_request(request, client_address): | 74 | if self.verify_request(request, client_address): |
164 | 75 | try: | 75 | try: |
165 | 76 | self.process_request(request, client_address) | 76 | self.process_request(request, client_address) |
167 | 77 | except: | 77 | except Exception: |
168 | 78 | self.handle_error(request, client_address) | 78 | self.handle_error(request, client_address) |
169 | 79 | self.close_request(request) | 79 | self.close_request(request) |
170 | 80 | 80 | ||
171 | diff --git a/lib/lp/codehosting/upgrade.py b/lib/lp/codehosting/upgrade.py | |||
172 | index 2159871..54112b2 100755 | |||
173 | --- a/lib/lp/codehosting/upgrade.py | |||
174 | +++ b/lib/lp/codehosting/upgrade.py | |||
175 | @@ -174,7 +174,7 @@ class Upgrader: | |||
176 | 174 | bzrdir = BzrDir.create(upgrade_dir, self.get_target_format()) | 174 | bzrdir = BzrDir.create(upgrade_dir, self.get_target_format()) |
177 | 175 | repository = bzrdir.create_repository() | 175 | repository = bzrdir.create_repository() |
178 | 176 | repository.fetch(self.bzr_branch.repository) | 176 | repository.fetch(self.bzr_branch.repository) |
180 | 177 | except: | 177 | except Exception: |
181 | 178 | rmtree(upgrade_dir) | 178 | rmtree(upgrade_dir) |
182 | 179 | raise | 179 | raise |
183 | 180 | else: | 180 | else: |
184 | diff --git a/lib/lp/services/database/__init__.py b/lib/lp/services/database/__init__.py | |||
185 | index 5af379f..3bbca06 100644 | |||
186 | --- a/lib/lp/services/database/__init__.py | |||
187 | +++ b/lib/lp/services/database/__init__.py | |||
188 | @@ -77,7 +77,7 @@ def write_transaction(func): | |||
189 | 77 | transaction.begin() | 77 | transaction.begin() |
190 | 78 | try: | 78 | try: |
191 | 79 | ret = func(*args, **kwargs) | 79 | ret = func(*args, **kwargs) |
193 | 80 | except: | 80 | except BaseException: |
194 | 81 | transaction.abort() | 81 | transaction.abort() |
195 | 82 | raise | 82 | raise |
196 | 83 | transaction.commit() | 83 | transaction.commit() |
197 | diff --git a/lib/lp/services/database/sqlbase.py b/lib/lp/services/database/sqlbase.py | |||
198 | index cf7d5d5..96a5c62 100644 | |||
199 | --- a/lib/lp/services/database/sqlbase.py | |||
200 | +++ b/lib/lp/services/database/sqlbase.py | |||
201 | @@ -205,7 +205,7 @@ class SQLBase(storm.sqlobject.SQLObjectBase): | |||
202 | 205 | store.add(self) | 205 | store.add(self) |
203 | 206 | try: | 206 | try: |
204 | 207 | self._create(None, **kwargs) | 207 | self._create(None, **kwargs) |
206 | 208 | except: | 208 | except Exception: |
207 | 209 | store.remove(self) | 209 | store.remove(self) |
208 | 210 | raise | 210 | raise |
209 | 211 | 211 | ||
210 | diff --git a/lib/lp/services/job/runner.py b/lib/lp/services/job/runner.py | |||
211 | index 2ec4506..e37b54e 100644 | |||
212 | --- a/lib/lp/services/job/runner.py | |||
213 | +++ b/lib/lp/services/job/runner.py | |||
214 | @@ -677,9 +677,9 @@ class TwistedJobRunner(BaseJobRunner): | |||
215 | 677 | if job is None: | 677 | if job is None: |
216 | 678 | self.logger.info('No jobs to run.') | 678 | self.logger.info('No jobs to run.') |
217 | 679 | self.terminated() | 679 | self.terminated() |
219 | 680 | except: | 680 | except BaseException: |
220 | 681 | self.failed(failure.Failure()) | 681 | self.failed(failure.Failure()) |
222 | 682 | except: | 682 | except BaseException: |
223 | 683 | self.terminated() | 683 | self.terminated() |
224 | 684 | raise | 684 | raise |
225 | 685 | 685 | ||
226 | diff --git a/lib/lp/services/job/tests/test_celeryjob.py b/lib/lp/services/job/tests/test_celeryjob.py | |||
227 | index 22ec50e..9757d36 100644 | |||
228 | --- a/lib/lp/services/job/tests/test_celeryjob.py | |||
229 | +++ b/lib/lp/services/job/tests/test_celeryjob.py | |||
230 | @@ -86,7 +86,7 @@ class TestRunMissingJobs(TestCaseWithFactory): | |||
231 | 86 | missing_ready = find_missing_ready_obj.find_missing_ready() | 86 | missing_ready = find_missing_ready_obj.find_missing_ready() |
232 | 87 | try: | 87 | try: |
233 | 88 | self.assertEqual([], missing_ready) | 88 | self.assertEqual([], missing_ready) |
235 | 89 | except: | 89 | except Exception: |
236 | 90 | # XXX AaronBentley: 2012-08-01 bug=1031018: Extra diagnostic info | 90 | # XXX AaronBentley: 2012-08-01 bug=1031018: Extra diagnostic info |
237 | 91 | # to help diagnose this hard-to-reproduce failure. | 91 | # to help diagnose this hard-to-reproduce failure. |
238 | 92 | self.addTextDetail('queued_job_ids', | 92 | self.addTextDetail('queued_job_ids', |
239 | diff --git a/lib/lp/services/librarianserver/libraryprotocol.py b/lib/lp/services/librarianserver/libraryprotocol.py | |||
240 | index c59ca28..bd11e39 100644 | |||
241 | --- a/lib/lp/services/librarianserver/libraryprotocol.py | |||
242 | +++ b/lib/lp/services/librarianserver/libraryprotocol.py | |||
243 | @@ -74,7 +74,7 @@ class FileUploadProtocol(basic.LineReceiver): | |||
244 | 74 | getattr(self, 'line_' + self.state, self.badLine)(line) | 74 | getattr(self, 'line_' + self.state, self.badLine)(line) |
245 | 75 | except ProtocolViolation as e: | 75 | except ProtocolViolation as e: |
246 | 76 | self.sendError(e.msg) | 76 | self.sendError(e.msg) |
248 | 77 | except: | 77 | except Exception: |
249 | 78 | self.unknownError() | 78 | self.unknownError() |
250 | 79 | 79 | ||
251 | 80 | def sendError(self, msg, code='400'): | 80 | def sendError(self, msg, code='400'): |
252 | diff --git a/lib/lp/services/librarianserver/storage.py b/lib/lp/services/librarianserver/storage.py | |||
253 | index 053f37d..cebcd59 100644 | |||
254 | --- a/lib/lp/services/librarianserver/storage.py | |||
255 | +++ b/lib/lp/services/librarianserver/storage.py | |||
256 | @@ -271,7 +271,7 @@ class LibraryFileUpload(object): | |||
257 | 271 | aliasID = None | 271 | aliasID = None |
258 | 272 | self.debugLog.append('received contentID: %r' % (contentID, )) | 272 | self.debugLog.append('received contentID: %r' % (contentID, )) |
259 | 273 | 273 | ||
261 | 274 | except: | 274 | except Exception: |
262 | 275 | # Abort transaction and re-raise | 275 | # Abort transaction and re-raise |
263 | 276 | self.debugLog.append('failed to get contentID/aliasID, aborting') | 276 | self.debugLog.append('failed to get contentID/aliasID, aborting') |
264 | 277 | raise | 277 | raise |
265 | @@ -279,7 +279,7 @@ class LibraryFileUpload(object): | |||
266 | 279 | # Move file to final location | 279 | # Move file to final location |
267 | 280 | try: | 280 | try: |
268 | 281 | self._move(contentID) | 281 | self._move(contentID) |
270 | 282 | except: | 282 | except Exception: |
271 | 283 | # Abort DB transaction | 283 | # Abort DB transaction |
272 | 284 | self.debugLog.append('failed to move file, aborting') | 284 | self.debugLog.append('failed to move file, aborting') |
273 | 285 | 285 | ||
274 | diff --git a/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py b/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py | |||
275 | index c315ca4..c960098 100644 | |||
276 | --- a/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py | |||
277 | +++ b/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py | |||
278 | @@ -83,7 +83,7 @@ class TestLibrarianServerFixture(TestCase): | |||
279 | 83 | fixture.restricted_download_port, | 83 | fixture.restricted_download_port, |
280 | 84 | ) | 84 | ) |
281 | 85 | self.assertEqual(expected_config, fixture.service_config) | 85 | self.assertEqual(expected_config, fixture.service_config) |
283 | 86 | except: | 86 | except Exception: |
284 | 87 | self.attachLibrarianLog(fixture) | 87 | self.attachLibrarianLog(fixture) |
285 | 88 | raise | 88 | raise |
286 | 89 | 89 | ||
287 | diff --git a/lib/lp/services/profile/profile.py b/lib/lp/services/profile/profile.py | |||
288 | index 85e98f1..e98f17f 100644 | |||
289 | --- a/lib/lp/services/profile/profile.py | |||
290 | +++ b/lib/lp/services/profile/profile.py | |||
291 | @@ -89,7 +89,7 @@ class Profiler: | |||
292 | 89 | self.profiler_lock.acquire(True) # Blocks. | 89 | self.profiler_lock.acquire(True) # Blocks. |
293 | 90 | try: | 90 | try: |
294 | 91 | self.enable() | 91 | self.enable() |
296 | 92 | except: | 92 | except Exception: |
297 | 93 | self.profiler_lock.release() | 93 | self.profiler_lock.release() |
298 | 94 | self.started = False | 94 | self.started = False |
299 | 95 | raise | 95 | raise |
300 | diff --git a/lib/lp/services/spriteutils.py b/lib/lp/services/spriteutils.py | |||
301 | index 2ecd703..735f706 100644 | |||
302 | --- a/lib/lp/services/spriteutils.py | |||
303 | +++ b/lib/lp/services/spriteutils.py | |||
304 | @@ -195,7 +195,7 @@ class SpriteUtil: | |||
305 | 195 | for x_position in range(width, max_sprite_width, width): | 195 | for x_position in range(width, max_sprite_width, width): |
306 | 196 | position[0] = x_position | 196 | position[0] = x_position |
307 | 197 | combined_image.paste(sprite_image, tuple(position)) | 197 | combined_image.paste(sprite_image, tuple(position)) |
309 | 198 | except: | 198 | except Exception: |
310 | 199 | print( | 199 | print( |
311 | 200 | "Error with image file %s" % sprite['filename'], | 200 | "Error with image file %s" % sprite['filename'], |
312 | 201 | file=sys.stderr) | 201 | file=sys.stderr) |
313 | diff --git a/lib/lp/services/stacktrace.py b/lib/lp/services/stacktrace.py | |||
314 | index 6b3cacb..10b6764 100644 | |||
315 | --- a/lib/lp/services/stacktrace.py | |||
316 | +++ b/lib/lp/services/stacktrace.py | |||
317 | @@ -29,7 +29,7 @@ def _try_except(callable, *args, **kwargs): | |||
318 | 29 | return callable(*args, **kwargs) | 29 | return callable(*args, **kwargs) |
319 | 30 | except EXPLOSIVE_ERRORS: | 30 | except EXPLOSIVE_ERRORS: |
320 | 31 | raise | 31 | raise |
322 | 32 | except: | 32 | except Exception: |
323 | 33 | if DEBUG_EXCEPTION_FORMATTER: | 33 | if DEBUG_EXCEPTION_FORMATTER: |
324 | 34 | traceback.print_exc(file=sys.stderr) | 34 | traceback.print_exc(file=sys.stderr) |
325 | 35 | # return None | 35 | # return None |
326 | @@ -100,7 +100,7 @@ def format_list(extracted_list): | |||
327 | 100 | item.append(_fmt(info)) | 100 | item.append(_fmt(info)) |
328 | 101 | except EXPLOSIVE_ERRORS: | 101 | except EXPLOSIVE_ERRORS: |
329 | 102 | raise | 102 | raise |
331 | 103 | except: | 103 | except Exception: |
332 | 104 | # The values above may not stringify properly, or who knows what | 104 | # The values above may not stringify properly, or who knows what |
333 | 105 | # else. Be defensive. | 105 | # else. Be defensive. |
334 | 106 | if DEBUG_EXCEPTION_FORMATTER: | 106 | if DEBUG_EXCEPTION_FORMATTER: |
335 | @@ -170,7 +170,7 @@ def _get_frame_data(f, lineno): | |||
336 | 170 | warnings.append(warning) | 170 | warnings.append(warning) |
337 | 171 | except EXPLOSIVE_ERRORS: | 171 | except EXPLOSIVE_ERRORS: |
338 | 172 | raise | 172 | raise |
340 | 173 | except: | 173 | except Exception: |
341 | 174 | if DEBUG_EXCEPTION_FORMATTER: | 174 | if DEBUG_EXCEPTION_FORMATTER: |
342 | 175 | traceback.print_exc(file=sys.stderr) | 175 | traceback.print_exc(file=sys.stderr) |
343 | 176 | supplement_dict = dict(warnings=warnings, extra=extra) | 176 | supplement_dict = dict(warnings=warnings, extra=extra) |
344 | diff --git a/lib/lp/services/twistedsupport/tests/test_processmonitor.py b/lib/lp/services/twistedsupport/tests/test_processmonitor.py | |||
345 | index 3ea4fd7..9ff30f6 100644 | |||
346 | --- a/lib/lp/services/twistedsupport/tests/test_processmonitor.py | |||
347 | +++ b/lib/lp/services/twistedsupport/tests/test_processmonitor.py | |||
348 | @@ -35,7 +35,7 @@ def makeFailure(exception_factory, *args, **kwargs): | |||
349 | 35 | """ | 35 | """ |
350 | 36 | try: | 36 | try: |
351 | 37 | raise exception_factory(*args, **kwargs) | 37 | raise exception_factory(*args, **kwargs) |
353 | 38 | except: | 38 | except Exception: |
354 | 39 | return failure.Failure() | 39 | return failure.Failure() |
355 | 40 | 40 | ||
356 | 41 | 41 | ||
357 | diff --git a/lib/lp/services/twistedsupport/tests/test_xmlrpc.py b/lib/lp/services/twistedsupport/tests/test_xmlrpc.py | |||
358 | index ebe72e9..126d275 100644 | |||
359 | --- a/lib/lp/services/twistedsupport/tests/test_xmlrpc.py | |||
360 | +++ b/lib/lp/services/twistedsupport/tests/test_xmlrpc.py | |||
361 | @@ -52,7 +52,7 @@ class TestTrapFault(TestCase): | |||
362 | 52 | """Make a `Failure` from the given exception factory.""" | 52 | """Make a `Failure` from the given exception factory.""" |
363 | 53 | try: | 53 | try: |
364 | 54 | raise exception_factory(*args, **kwargs) | 54 | raise exception_factory(*args, **kwargs) |
366 | 55 | except: | 55 | except Exception: |
367 | 56 | return Failure() | 56 | return Failure() |
368 | 57 | 57 | ||
369 | 58 | def assertRaisesFailure(self, failure, function, *args, **kwargs): | 58 | def assertRaisesFailure(self, failure, function, *args, **kwargs): |
370 | diff --git a/lib/lp/services/webapp/publication.py b/lib/lp/services/webapp/publication.py | |||
371 | index 955685a..6aadefe 100644 | |||
372 | --- a/lib/lp/services/webapp/publication.py | |||
373 | +++ b/lib/lp/services/webapp/publication.py | |||
374 | @@ -268,7 +268,7 @@ class LaunchpadBrowserPublication( | |||
375 | 268 | request_txt = 'Exception converting request to string\n\n' | 268 | request_txt = 'Exception converting request to string\n\n' |
376 | 269 | try: | 269 | try: |
377 | 270 | request_txt += traceback.format_exc() | 270 | request_txt += traceback.format_exc() |
379 | 271 | except: | 271 | except Exception: |
380 | 272 | request_txt += 'Unable to render traceback!' | 272 | request_txt += 'Unable to render traceback!' |
381 | 273 | threadrequestfile.write(request_txt.encode('UTF-8')) | 273 | threadrequestfile.write(request_txt.encode('UTF-8')) |
382 | 274 | threadrequestfile.close() | 274 | threadrequestfile.close() |
383 | diff --git a/lib/lp/soyuz/model/packagecopyjob.py b/lib/lp/soyuz/model/packagecopyjob.py | |||
384 | index 83c8b1f..4d8871c 100644 | |||
385 | --- a/lib/lp/soyuz/model/packagecopyjob.py | |||
386 | +++ b/lib/lp/soyuz/model/packagecopyjob.py | |||
387 | @@ -647,7 +647,7 @@ class PlainPackageCopyJob(PackageCopyJobDerived): | |||
388 | 647 | pass | 647 | pass |
389 | 648 | except (SuspendJobException, AdvisoryLockHeld): | 648 | except (SuspendJobException, AdvisoryLockHeld): |
390 | 649 | raise | 649 | raise |
392 | 650 | except: | 650 | except Exception: |
393 | 651 | # Abort work done so far, but make sure that we commit the | 651 | # Abort work done so far, but make sure that we commit the |
394 | 652 | # rejection to the PackageUpload. | 652 | # rejection to the PackageUpload. |
395 | 653 | transaction.abort() | 653 | transaction.abort() |
396 | diff --git a/lib/lp/soyuz/scripts/gina/changelog.py b/lib/lp/soyuz/scripts/gina/changelog.py | |||
397 | index ec20556..cc31594 100644 | |||
398 | --- a/lib/lp/soyuz/scripts/gina/changelog.py | |||
399 | +++ b/lib/lp/soyuz/scripts/gina/changelog.py | |||
400 | @@ -70,7 +70,7 @@ def parse_changelog(changelines): | |||
401 | 70 | try: | 70 | try: |
402 | 71 | (source, version, urgency) = parse_first_line(line.strip()) | 71 | (source, version, urgency) = parse_first_line(line.strip()) |
403 | 72 | Version(six.ensure_text(version)) | 72 | Version(six.ensure_text(version)) |
405 | 73 | except: | 73 | except Exception: |
406 | 74 | stanza.append(line) | 74 | stanza.append(line) |
407 | 75 | #print "state0 Exception skip" | 75 | #print "state0 Exception skip" |
408 | 76 | continue | 76 | continue |
409 | diff --git a/lib/lp/testing/yuixhr.py b/lib/lp/testing/yuixhr.py | |||
410 | index c21831b..f66295b 100644 | |||
411 | --- a/lib/lp/testing/yuixhr.py | |||
412 | +++ b/lib/lp/testing/yuixhr.py | |||
413 | @@ -335,7 +335,7 @@ class YUITestFixtureControllerView(LaunchpadView): | |||
414 | 335 | suite = suite_factory() | 335 | suite = suite_factory() |
415 | 336 | except EXPLOSIVE_ERRORS: | 336 | except EXPLOSIVE_ERRORS: |
416 | 337 | raise | 337 | raise |
418 | 338 | except: | 338 | except Exception: |
419 | 339 | warning = 'test_suite raises errors' | 339 | warning = 'test_suite raises errors' |
420 | 340 | else: | 340 | else: |
421 | 341 | case = None | 341 | case = None |
422 | @@ -400,7 +400,7 @@ class YUITestFixtureControllerView(LaunchpadView): | |||
423 | 400 | fixtures[fixture_name](self.request, data) | 400 | fixtures[fixture_name](self.request, data) |
424 | 401 | except EXPLOSIVE_ERRORS: | 401 | except EXPLOSIVE_ERRORS: |
425 | 402 | raise | 402 | raise |
427 | 403 | except: | 403 | except Exception: |
428 | 404 | self.request.response.setStatus(500) | 404 | self.request.response.setStatus(500) |
429 | 405 | result = ''.join(format_exception(*sys.exc_info())) | 405 | result = ''.join(format_exception(*sys.exc_info())) |
430 | 406 | else: | 406 | else: |
431 | @@ -421,7 +421,7 @@ class YUITestFixtureControllerView(LaunchpadView): | |||
432 | 421 | fixtures[fixture_name].teardown(self.request, data) | 421 | fixtures[fixture_name].teardown(self.request, data) |
433 | 422 | except EXPLOSIVE_ERRORS: | 422 | except EXPLOSIVE_ERRORS: |
434 | 423 | raise | 423 | raise |
436 | 424 | except: | 424 | except Exception: |
437 | 425 | self.request.response.setStatus(500) | 425 | self.request.response.setStatus(500) |
438 | 426 | result = ''.join(format_exception(*sys.exc_info())) | 426 | result = ''.join(format_exception(*sys.exc_info())) |
439 | 427 | else: | 427 | else: |
440 | diff --git a/lib/lp/translations/scripts/copy_distroseries_translations.py b/lib/lp/translations/scripts/copy_distroseries_translations.py | |||
441 | index 1196e43..e072246 100644 | |||
442 | --- a/lib/lp/translations/scripts/copy_distroseries_translations.py | |||
443 | +++ b/lib/lp/translations/scripts/copy_distroseries_translations.py | |||
444 | @@ -131,7 +131,7 @@ def copy_distroseries_translations(source, target, txn, logger, | |||
445 | 131 | copy_active_translations( | 131 | copy_active_translations( |
446 | 132 | source, target, txn, logger, sourcepackagenames=spns, | 132 | source, target, txn, logger, sourcepackagenames=spns, |
447 | 133 | skip_duplicates=skip_duplicates) | 133 | skip_duplicates=skip_duplicates) |
449 | 134 | except: | 134 | except BaseException: |
450 | 135 | copy_failed = True | 135 | copy_failed = True |
451 | 136 | # Give us a fresh transaction for proper cleanup. | 136 | # Give us a fresh transaction for proper cleanup. |
452 | 137 | txn.abort() | 137 | txn.abort() |
453 | @@ -142,7 +142,7 @@ def copy_distroseries_translations(source, target, txn, logger, | |||
454 | 142 | statekeeper.restore() | 142 | statekeeper.restore() |
455 | 143 | except Warning as message: | 143 | except Warning as message: |
456 | 144 | logger.warning(message) | 144 | logger.warning(message) |
458 | 145 | except: | 145 | except BaseException: |
459 | 146 | logger.warning( | 146 | logger.warning( |
460 | 147 | "Failed to restore hide_all_translations and " | 147 | "Failed to restore hide_all_translations and " |
461 | 148 | "defer_translation_imports flags on %s after translations " | 148 | "defer_translation_imports flags on %s after translations " |
462 | diff --git a/lib/lp/translations/scripts/language_pack.py b/lib/lp/translations/scripts/language_pack.py | |||
463 | index 0ef600f..e70ab7d 100644 | |||
464 | --- a/lib/lp/translations/scripts/language_pack.py | |||
465 | +++ b/lib/lp/translations/scripts/language_pack.py | |||
466 | @@ -143,7 +143,7 @@ def export(distroseries, component, update, force_utf8, logger): | |||
467 | 143 | 143 | ||
468 | 144 | # Store it in the tarball. | 144 | # Store it in the tarball. |
469 | 145 | archive.add_file(path, contents) | 145 | archive.add_file(path, contents) |
471 | 146 | except: | 146 | except Exception: |
472 | 147 | logger.exception( | 147 | logger.exception( |
473 | 148 | "Uncaught exception while exporting PO file %d" % pofile.id) | 148 | "Uncaught exception while exporting PO file %d" % pofile.id) |
474 | 149 | 149 | ||
475 | @@ -217,8 +217,8 @@ def export_language_pack(distribution_name, series_name, logger, | |||
476 | 217 | try: | 217 | try: |
477 | 218 | filehandle, size = export( | 218 | filehandle, size = export( |
478 | 219 | distroseries, component, update, force_utf8, logger) | 219 | distroseries, component, update, force_utf8, logger) |
481 | 220 | except: | 220 | except Exception: |
482 | 221 | # Bare except statements are used in order to prevent premature | 221 | # Generic exception statements are used in order to prevent premature |
483 | 222 | # termination of the script. | 222 | # termination of the script. |
484 | 223 | logger.exception('Uncaught exception while exporting') | 223 | logger.exception('Uncaught exception while exporting') |
485 | 224 | return None | 224 | return None |
486 | @@ -263,8 +263,8 @@ def export_language_pack(distribution_name, series_name, logger, | |||
487 | 263 | except UploadFailed as e: | 263 | except UploadFailed as e: |
488 | 264 | logger.error('Uploading to the Librarian failed: %s', e) | 264 | logger.error('Uploading to the Librarian failed: %s', e) |
489 | 265 | return None | 265 | return None |
492 | 266 | except: | 266 | except Exception: |
493 | 267 | # Bare except statements are used in order to prevent premature | 267 | # Generic exception statements are used in order to prevent premature |
494 | 268 | # termination of the script. | 268 | # termination of the script. |
495 | 269 | logger.exception( | 269 | logger.exception( |
496 | 270 | 'Uncaught exception while uploading to the Librarian') | 270 | 'Uncaught exception while uploading to the Librarian') |
497 | diff --git a/scripts/script-monitor.py b/scripts/script-monitor.py | |||
498 | index 9671e7e..f859d54 100755 | |||
499 | --- a/scripts/script-monitor.py | |||
500 | +++ b/scripts/script-monitor.py | |||
501 | @@ -99,7 +99,7 @@ def main(): | |||
502 | 99 | msg.as_string()) | 99 | msg.as_string()) |
503 | 100 | smtp.close() | 100 | smtp.close() |
504 | 101 | return 2 | 101 | return 2 |
506 | 102 | except: | 102 | except Exception: |
507 | 103 | log.exception("Unhandled exception") | 103 | log.exception("Unhandled exception") |
508 | 104 | return 1 | 104 | return 1 |
509 | 105 | 105 | ||
510 | diff --git a/utilities/community-contributions.py b/utilities/community-contributions.py | |||
511 | index d9c59e2..662d374 100755 | |||
512 | --- a/utilities/community-contributions.py | |||
513 | +++ b/utilities/community-contributions.py | |||
514 | @@ -52,7 +52,7 @@ from bzrlib.osutils import format_date | |||
515 | 52 | 52 | ||
516 | 53 | try: | 53 | try: |
517 | 54 | from editmoin import editshortcut | 54 | from editmoin import editshortcut |
519 | 55 | except: | 55 | except ImportError: |
520 | 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: |
521 | 57 | Get editmoin.py from launchpadlib's "contrib/" directory: | 57 | Get editmoin.py from launchpadlib's "contrib/" directory: |
522 | 58 | 58 |
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`, `KeyboardInterr upt`, 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.