minor bug fixed about db connection not sharing between threads problem

This commit is contained in:
Volkan Şahin 2016-07-25 16:28:23 +03:00
parent dbfe504292
commit 90a03c1598

View file

@ -12,7 +12,7 @@ from base.messaging.AnonymousMessenger import AnonymousMessager
from base.system.system import System from base.system.system import System
from base.timer.setup_timer import SetupTimer from base.timer.setup_timer import SetupTimer
from base.timer.timer import Timer from base.timer.timer import Timer
from base.system.system import System
class Registration: class Registration:
def __init__(self): def __init__(self):
@ -34,8 +34,8 @@ class Registration:
def registration_request(self): def registration_request(self):
self.logger.debug('[Registration] Requesting registration') self.logger.debug('[Registration] Requesting registration')
SetupTimer.start(Timer(System.Ahenk.registration_timeout(), timeout_function=self.registration_timeout, checker_func=self.is_registered, kwargs=None)) SetupTimer.start(Timer(System.Ahenk.registration_timeout(), timeout_function=self.registration_timeout, checker_func=self.is_registered, kwargs=None))
anon_messager = AnonymousMessager(self.message_manager.registration_msg()) anon_messenger = AnonymousMessager(self.message_manager.registration_msg())
anon_messager.connect_to_server() anon_messenger.connect_to_server()
def ldap_registration_request(self): def ldap_registration_request(self):
self.logger.debug('[Registration] Requesting LDAP registration') self.logger.debug('[Registration] Requesting LDAP registration')
@ -72,10 +72,13 @@ class Registration:
self.logger.debug('[Registration] Registration configuration file is updated') self.logger.debug('[Registration] Registration configuration file is updated')
def is_registered(self): def is_registered(self):
registered = self.db_service.select_one_result('registration', 'registered', 'registered = 1')
if registered == 1: try:
return True if str(System.Ahenk.uid()):
else: return True
else:
return False
except:
return False return False
def is_ldap_registered(self): def is_ldap_registered(self):