Merge pull request #136 from cher-nov/pr20170619_session

Fix bugs related to temporary sessions
This commit is contained in:
Lonami 2017-06-18 23:49:36 +02:00 committed by GitHub
commit daa626aa04

View File

@ -104,24 +104,24 @@ class JsonSession:
those required to init a connection will be copied.
"""
# These values will NOT be saved
if isinstance(session_user_id, str):
self.session_user_id = session_user_id
# For connection purposes
self.device_model = platform.node()
self.system_version = platform.system()
self.app_version = '0'
self.lang_code = 'en'
elif isinstance(session_user_id, JsonSession):
if isinstance(session_user_id, JsonSession):
self.session_user_id = None
# For connection purposes
session = session_user_id
self.device_model = session.device_model
self.system_version = session.system_version
self.app_version = session.app_version
self.lang_code = session.lang_code
else: # str / None
self.session_user_id = session_user_id
self.device_model = platform.node()
self.system_version = platform.system()
self.app_version = '1.0' # note: '0' will provoke error
self.lang_code = 'en'
# Cross-thread safety
self._lock = Lock()