Merge lp:~cjwatson/lazr.restful/py3-raise into lp:lazr.restful

Proposed by Colin Watson
Status: Merged
Merged at revision: 234
Proposed branch: lp:~cjwatson/lazr.restful/py3-raise
Merge into: lp:lazr.restful
Diff against target: 48 lines (+6/-3)
3 files modified
setup.py (+1/-0)
src/lazr/restful/_resource.py (+4/-2)
src/lazr/restful/metazcml.py (+1/-1)
To merge this branch: bzr merge lp:~cjwatson/lazr.restful/py3-raise
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
LAZR Developers Pending
Review via email: mp+378513@code.launchpad.net

Commit message

Use Python 3-compatible raise syntax.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'setup.py'
2--- setup.py 2019-11-12 14:26:41 +0000
3+++ setup.py 2020-02-04 12:23:33 +0000
4@@ -62,6 +62,7 @@
5 'pytz',
6 'setuptools',
7 'simplejson>=2.1.0',
8+ 'six',
9 'testtools',
10 'van.testing',
11 'wsgiref',
12
13=== modified file 'src/lazr/restful/_resource.py'
14--- src/lazr/restful/_resource.py 2020-02-04 11:52:59 +0000
15+++ src/lazr/restful/_resource.py 2020-02-04 12:23:33 +0000
16@@ -48,6 +48,7 @@
17 import sha
18 sha_constructor = sha.new
19
20+import six
21 from zope.component import (
22 adapter,
23 getAdapters,
24@@ -945,8 +946,9 @@
25 # web application rather than a web service. We'll
26 # re-raise the exception, let the publisher look up
27 # the view, and hopefully handle it better. Note the careful
28- # reraising that ensures the original trackabck is preserved.
29- raise exception_info[0], exception_info[1], exception_info[2]
30+ # reraising that ensures the original traceback is preserved.
31+ six.reraise(
32+ exception_info[0], exception_info[1], exception_info[2])
33
34 self.request.response.setStatus(ws_view.status)
35 if ws_view.status / 100 == 4:
36
37=== modified file 'src/lazr/restful/metazcml.py'
38--- src/lazr/restful/metazcml.py 2020-02-04 11:52:59 +0000
39+++ src/lazr/restful/metazcml.py 2020-02-04 12:23:33 +0000
40@@ -185,7 +185,7 @@
41 good_versions = '", "'.join(sorted_version_list)
42 msg = ('Annotations on "%s" put an earlier version on top of a '
43 'later version: "%s". The correct order is: "%s".')
44- raise AssertionError, msg % (name, bad_versions, good_versions)
45+ raise AssertionError(msg % (name, bad_versions, good_versions))
46
47
48 def register_adapter_for_version(factory, interface, version_name,

Subscribers

People subscribed via source and target branches