fixed broken session in recent trunk
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.2.1 (2012-11-17 12:14:24) stable
|
Version 2.2.1 (2012-11-17 13:28:42) stable
|
||||||
|
|||||||
+6
-4
@@ -557,8 +557,8 @@ class Session(Storage):
|
|||||||
else:
|
else:
|
||||||
response.session_id = None
|
response.session_id = None
|
||||||
# do not try load the data from file is these was data in cookie
|
# do not try load the data from file is these was data in cookie
|
||||||
if response.session_id and not session_cookie_data and \
|
if response.session_id and not session_cookie_data:
|
||||||
os.path.exists(response.session_filename):
|
# os.path.exists(response.session_filename):
|
||||||
try:
|
try:
|
||||||
response.session_file = \
|
response.session_file = \
|
||||||
open(response.session_filename, 'rb+')
|
open(response.session_filename, 'rb+')
|
||||||
@@ -572,12 +572,14 @@ class Session(Storage):
|
|||||||
.split('-')[0]
|
.split('-')[0]
|
||||||
if check_client and client != oc:
|
if check_client and client != oc:
|
||||||
raise Exception("cookie attack")
|
raise Exception("cookie attack")
|
||||||
|
except:
|
||||||
|
response.session_id = None
|
||||||
finally:
|
finally:
|
||||||
pass
|
pass
|
||||||
#This causes admin login to break. Must find out why.
|
#This causes admin login to break. Must find out why.
|
||||||
#self._close(response)
|
#self._close(response)
|
||||||
except:
|
except:
|
||||||
response.session_id = None
|
response.session_file = None
|
||||||
if not response.session_id:
|
if not response.session_id:
|
||||||
uuid = web2py_uuid()
|
uuid = web2py_uuid()
|
||||||
response.session_id = '%s-%s' % (client, uuid)
|
response.session_id = '%s-%s' % (client, uuid)
|
||||||
@@ -748,7 +750,7 @@ class Session(Storage):
|
|||||||
if not response.session_id or self._forget or self._unchanged():
|
if not response.session_id or self._forget or self._unchanged():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if response.session_new:
|
if response.session_new or not response.session_file:
|
||||||
# Tests if the session sub-folder exists, if not, create it
|
# Tests if the session sub-folder exists, if not, create it
|
||||||
session_folder = os.path.dirname(response.session_filename)
|
session_folder = os.path.dirname(response.session_filename)
|
||||||
if not os.path.exists(session_folder):
|
if not os.path.exists(session_folder):
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class TestWeb(unittest.TestCase):
|
|||||||
|
|
||||||
# check registration and login were successful
|
# check registration and login were successful
|
||||||
client.get('index')
|
client.get('index')
|
||||||
|
print client.text
|
||||||
self.assertTrue('Welcome Homer' in client.text)
|
self.assertTrue('Welcome Homer' in client.text)
|
||||||
|
|
||||||
client = WebClient('http://127.0.0.1:8000/admin/default/')
|
client = WebClient('http://127.0.0.1:8000/admin/default/')
|
||||||
|
|||||||
Reference in New Issue
Block a user