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
=== modified file 'src/lazr/restful/declarations.py'
--- src/lazr/restful/declarations.py 2020-07-22 23:22:26 +0000
+++ src/lazr/restful/declarations.py 2020-08-10 16:58:57 +0000
@@ -47,6 +47,7 @@
47import itertools47import itertools
48import sys48import sys
4949
50import six
50from zope.component import getUtility, getGlobalSiteManager51from zope.component import getUtility, getGlobalSiteManager
51from zope.interface import classImplements52from zope.interface import classImplements
52from zope.interface.advice import addClassAdvisor53from zope.interface.advice import addClassAdvisor
@@ -1042,9 +1043,9 @@
10421043
1043 def __init__(self, duration):1044 def __init__(self, duration):
1044 """Specify the duration, in seconds, of the caching resource."""1045 """Specify the duration, in seconds, of the caching resource."""
1045 if not isinstance(duration, (int, long)):1046 if not isinstance(duration, six.integer_types):
1046 raise TypeError(1047 raise TypeError(
1047 'Caching duration should be int or long, not %s' %1048 'Caching duration should be an integer type, not %s' %
1048 duration.__class__.__name__)1049 duration.__class__.__name__)
1049 if duration <= 0:1050 if duration <= 0:
1050 raise ValueError(1051 raise ValueError(
10511052
=== modified file 'src/lazr/restful/docs/webservice-declarations.rst'
--- src/lazr/restful/docs/webservice-declarations.rst 2020-07-22 23:22:26 +0000
+++ src/lazr/restful/docs/webservice-declarations.rst 2020-08-10 16:58:57 +0000
@@ -1615,7 +1615,7 @@
1615 ...1615 ...
1616 Traceback (most recent call last):1616 Traceback (most recent call last):
1617 ...1617 ...
1618 TypeError: Caching duration should be int or long, not str1618 TypeError: Caching duration should be an integer type, not str
1619 >>>1619 >>>
1620 >>> class ICachedBookSet(IBookSet):1620 >>> class ICachedBookSet(IBookSet):
1621 ... @cache_for(-15)1621 ... @cache_for(-15)

Subscribers

People subscribed via source and target branches