comparison twisted/plugins/sat_plugin.py @ 2670:ef93fcbaa749

core(twisted): install reactor before doing anything else
author Goffi <goffi@goffi.org>
date Fri, 31 Aug 2018 17:18:51 +0200
parents 735467eb6cf7
children c5543fba97e8
comparison
equal deleted inserted replaced
2669:bdb8276fd2da 2670:ef93fcbaa749
15 # GNU Affero General Public License for more details. 15 # GNU Affero General Public License for more details.
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from twisted.internet import gireactor
21 gireactor.install()
20 from twisted.internet import defer 22 from twisted.internet import defer
21 if defer.Deferred.debug: 23 if defer.Deferred.debug:
22 # if we are in debug mode, we want to use ipdb instead of pdb 24 # if we are in debug mode, we want to use ipdb instead of pdb
23 try: 25 try:
24 import ipdb 26 import ipdb
38 from sat.core.i18n import _ 40 from sat.core.i18n import _
39 41
40 42
41 def initialise(options): 43 def initialise(options):
42 """Method to initialise global modules""" 44 """Method to initialise global modules"""
43 from twisted.internet import gireactor
44 gireactor.install()
45 # XXX: We need to configure logs before any log method is used, so here is the best place. 45 # XXX: We need to configure logs before any log method is used, so here is the best place.
46 from sat.core import log_config 46 from sat.core import log_config
47 log_config.satConfigure(C.LOG_BACKEND_TWISTED, C, backend_data=options) 47 log_config.satConfigure(C.LOG_BACKEND_TWISTED, C, backend_data=options)
48 48
49 49