Skip to content

Commit 945649d

Browse files
authored
Merge pull request #200 from ruchirarya/master
FIX: Py3 - NameError: name 'long' is not defined
2 parents 95209b7 + 55eb8dc commit 945649d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/cbapi/models.py

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from cbapi.six import python_2_unicode_compatible
88

9+
import sys
910
import base64
1011
import os.path
1112
from cbapi.six import iteritems, add_metaclass
@@ -144,6 +145,7 @@ def __init__(self, field_name, multiplier=1.0):
144145

145146
def __get__(self, instance, instance_type=None):
146147
d = super(EpochDateTimeFieldDescriptor, self).__get__(instance, instance_type)
148+
long = long if sys.version_info < (3, 0) else int
147149
if type(d) is float or type(d) is int or type(d) is long:
148150
epoch_seconds = d / self.multiplier
149151
return datetime.utcfromtimestamp(epoch_seconds)

0 commit comments

Comments
 (0)