diff --git a/src/Products/Sessions/__init__.py b/src/Products/Sessions/__init__.py index c64d6db..0cdd043 100644 --- a/src/Products/Sessions/__init__.py +++ b/src/Products/Sessions/__init__.py @@ -17,8 +17,8 @@ def initialize(context): - import BrowserIdManager - import SessionDataManager + from . import BrowserIdManager + from . import SessionDataManager context.registerClass( BrowserIdManager.BrowserIdManager, diff --git a/src/Products/Transience/Fake.py b/src/Products/Transience/Fake.py index a9cb160..4c080e1 100644 --- a/src/Products/Transience/Fake.py +++ b/src/Products/Transience/Fake.py @@ -24,7 +24,7 @@ def keys(self, min, max): min = 0 if max is None: - max = sys.maxint + max = sys.maxsize for k in self.data: if min <= k <= max: diff --git a/src/Products/Transience/Transience.py b/src/Products/Transience/Transience.py index 706b413..6557b17 100644 --- a/src/Products/Transience/Transience.py +++ b/src/Products/Transience/Transience.py @@ -379,7 +379,7 @@ def _all(self): return d def keys(self): - return self._all().keys() + return list(self._all().keys()) def raw(self, current_ts): # for debugging and unit testing @@ -398,10 +398,10 @@ def raw(self, current_ts): return d def items(self): - return self._all().items() + return list(self._all().items()) def values(self): - return self._all().values() + return list(self._all().values()) def _wrap(self, item): # dont use hasattr here (it hides conflict errors) @@ -961,7 +961,7 @@ def __setstate__(self, state): # can't make __len__ an instance variable in new-style classes # f/w compat: 2.8 cannot use __len__ as an instance variable - if not state.has_key('_length'): + if '_length' not in state: length = state.get('__len__', Length2()) self._length = self.getLen = length @@ -974,12 +974,12 @@ def __setstate__(self, state): self._length = self.getLen = Length2(sz) # TOCs prior to 2.7.1 took their period from a global - if not state.has_key('_period'): + if '_period' not in state: self._period = 20 # this was the default for all prior releases # TOCs prior to 2.7.1 used a different set of data structures # for efficiently keeping tabs on the maximum slice - if not state.has_key('_max_timeslice'): + if '_max_timeslice' not in state: new_slices = getTimeslices( getCurrentTimeslice(self._period), SPARE_BUCKETS*2, @@ -990,11 +990,11 @@ def __setstate__(self, state): # create an Increaser for max timeslice self._max_timeslice = Increaser(max(new_slices)) - if not state.has_key('_last_finalized_timeslice'): + if '_last_finalized_timeslice' not in state: self._last_finalized_timeslice = Increaser(-self._period) # TOCs prior to 2.7.3 didn't have a _last_gc_timeslice - if not state.has_key('_last_gc_timeslice'): + if '_last_gc_timeslice' not in state: self._last_gc_timeslice = Increaser(-self._period) # we should probably delete older attributes from state such as diff --git a/src/Products/Transience/TransientObject.py b/src/Products/Transience/TransientObject.py index 60bc388..85ce90f 100644 --- a/src/Products/Transience/TransientObject.py +++ b/src/Products/Transience/TransientObject.py @@ -141,13 +141,13 @@ def getContainerKey(self): # def keys(self): - return self._container.keys() + return list(self._container.keys()) def values(self): - return self._container.values() + return list(self._container.values()) def items(self): - return self._container.items() + return list(self._container.items()) def get(self, k, default=_notfound): v = self._container.get(k, default) @@ -207,7 +207,7 @@ def _p_resolveConflict(self, saved, state1, state2): # We can clearly resolve the conflict if one state is invalid, # because it's a terminal state. for state in states: - if state.has_key('_invalid'): + if '_invalid' in state: DEBUG and TLOG('TO _p_rc: a state was invalid') return state @@ -256,12 +256,12 @@ def _p_resolveConflict(self, saved, state1, state2): def _generateUniqueId(self): t = str(int(time.time())) - d = "%010d" % random.randint(0, sys.maxint-1) + d = "%010d" % random.randint(0, sys.maxsize-1) return "%s%s" % (t, d) def __repr__(self): return "id: %s, token: %s, content keys: %r" % ( - self.id, self.token, self.keys() + self.id, self.token, list(self.keys()) ) def lastmodified_sort(d1, d2):