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

Proposed by Colin Watson
Status: Merged
Merged at revision: 251
Proposed branch: lp:~cjwatson/lazr.restful/py3-integer-types
Merge into: lp:lazr.restful
Diff against target: 36 lines (+4/-3)
2 files modified
src/lazr/restful/declarations.py (+3/-2)
src/lazr/restful/docs/webservice-declarations.rst (+1/-1)
To merge this branch: bzr merge lp:~cjwatson/lazr.restful/py3-integer-types
Reviewer Review Type Date Requested Status
Tom Wardill (community) Approve
Review via email: mp+389014@code.launchpad.net

Commit message

Handle int/long changes in Python 3.

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/lazr/restful/declarations.py'
2--- src/lazr/restful/declarations.py 2020-07-22 23:22:26 +0000
3+++ src/lazr/restful/declarations.py 2020-08-10 16:58:57 +0000
4@@ -47,6 +47,7 @@
5 import itertools
6 import sys
7
8+import six
9 from zope.component import getUtility, getGlobalSiteManager
10 from zope.interface import classImplements
11 from zope.interface.advice import addClassAdvisor
12@@ -1042,9 +1043,9 @@
13
14 def __init__(self, duration):
15 """Specify the duration, in seconds, of the caching resource."""
16- if not isinstance(duration, (int, long)):
17+ if not isinstance(duration, six.integer_types):
18 raise TypeError(
19- 'Caching duration should be int or long, not %s' %
20+ 'Caching duration should be an integer type, not %s' %
21 duration.__class__.__name__)
22 if duration <= 0:
23 raise ValueError(
24
25=== modified file 'src/lazr/restful/docs/webservice-declarations.rst'
26--- src/lazr/restful/docs/webservice-declarations.rst 2020-07-22 23:22:26 +0000
27+++ src/lazr/restful/docs/webservice-declarations.rst 2020-08-10 16:58:57 +0000
28@@ -1615,7 +1615,7 @@
29 ...
30 Traceback (most recent call last):
31 ...
32- TypeError: Caching duration should be int or long, not str
33+ TypeError: Caching duration should be an integer type, not str
34 >>>
35 >>> class ICachedBookSet(IBookSet):
36 ... @cache_for(-15)

Subscribers

People subscribed via source and target branches