Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Python 3 fixups.

  • Loading branch information...
commit 7d4d055ada04c28c1d5b5ae07fd055162d5e6e39 1 parent 58f4a2c
@bbangert authored
View
3  beaker/session.py
@@ -683,6 +683,9 @@ def __iter__(self):
def __contains__(self, key):
return key in self._session()
+ def has_key(self, key):
+ return key in self._session()
+
def get_by_id(self, id):
"""Loads a session given a session ID"""
params = self.__dict__['_params']
View
4 tests/test_increment.py
@@ -28,7 +28,7 @@ def simple_app(environ, start_response):
if not session:
start_response('200 OK', [('Content-type', 'text/plain')])
return ["No session id of %s found." % sess_id]
- if not session.has_key('value'):
+ if not 'value' in session:
session['value'] = 0
session['value'] += 1
if not environ['PATH_INFO'].startswith('/nosave'):
@@ -46,7 +46,7 @@ def simple_auto_app(environ, start_response):
if not session:
start_response('200 OK', [('Content-type', 'text/plain')])
return ["No session id of %s found." % sess_id]
- if not session.has_key('value'):
+ if not 'value' in session:
session['value'] = 0
session['value'] += 1
if environ['PATH_INFO'].startswith('/nosave'):
View
18 tests/test_namespacing_files/namespace_go.py
@@ -1,5 +1,7 @@
+from __future__ import print_function
import time
+
def go():
import namespace_get
a = namespace_get.get_cached_value()
@@ -13,13 +15,11 @@ def go():
time.sleep(0.3)
d = test_namespacing_files.namespace_get.get_cached_value()
- print a
- print b
- print c
- print d
-
- assert a==b, 'Basic caching problem - should never happen'
- assert c==d, 'Basic caching problem - should never happen'
- assert a==c, 'Namespaces not consistent when using different import paths'
-
+ print(a)
+ print(b)
+ print(c)
+ print(d)
+ assert a == b, 'Basic caching problem - should never happen'
+ assert c == d, 'Basic caching problem - should never happen'
+ assert a == c, 'Namespaces not consistent when using different import paths'
Please sign in to comment.
Something went wrong with that request. Please try again.