annotate src/sat.tac @ 1014:e40d9858cb83

core: if in debug mode and ipdb is present, use ipdb instead of pdb
author Goffi <goffi@goffi.org>
date Mon, 05 May 2014 20:16:14 +0200
parents 73a0b7f94674
children a836b6da2c5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
goffi@necton2
parents:
diff changeset
1 #!/usr/bin/python
goffi@necton2
parents:
diff changeset
2 # -*- coding: utf-8 -*-
goffi@necton2
parents:
diff changeset
3
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
4 # SAT: a jabber client
811
1fe00f0c9a91 dates update
Goffi <goffi@goffi.org>
parents: 771
diff changeset
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org)
0
goffi@necton2
parents:
diff changeset
6
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
7 # This program is free software: you can redistribute it and/or modify
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
10 # (at your option) any later version.
0
goffi@necton2
parents:
diff changeset
11
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
12 # This program is distributed in the hope that it will be useful,
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
15 # GNU Affero General Public License for more details.
0
goffi@necton2
parents:
diff changeset
16
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
0
goffi@necton2
parents:
diff changeset
19
1014
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
20 from twisted.internet import defer
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
21 if defer.Deferred.debug:
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
22 # if we are in debug mode, we want to use ipdb instead of pdb
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
23 try:
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
24 import ipdb
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
25 import pdb
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
26 pdb.set_trace = ipdb.set_trace
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
27 pdb.post_mortem = ipdb.post_mortem
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
28 except ImportError:
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
29 pass
e40d9858cb83 core: if in debug mode and ipdb is present, use ipdb instead of pdb
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
30
331
0a8eb0461f31 core: main SAT class now moved in its own module core.sat_main
Goffi <goffi@goffi.org>
parents: 330
diff changeset
31 from twisted.application import service
0a8eb0461f31 core: main SAT class now moved in its own module core.sat_main
Goffi <goffi@goffi.org>
parents: 330
diff changeset
32 from twisted.internet import glib2reactor
0
goffi@necton2
parents:
diff changeset
33 glib2reactor.install()
goffi@necton2
parents:
diff changeset
34
994
652c01ca69b1 core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents: 991
diff changeset
35 # XXX: We need to configure logs before any log method is used, so here is the best place.
1010
73a0b7f94674 primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents: 994
diff changeset
36 from sat.core.constants import Const as C
991
05e02f8b7eb4 core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents: 811
diff changeset
37 from sat.core import log
1010
73a0b7f94674 primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents: 994
diff changeset
38 log.satConfigure(C.LOG_BACKEND_TWISTED)
991
05e02f8b7eb4 core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents: 811
diff changeset
39
994
652c01ca69b1 core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents: 991
diff changeset
40 # XXX: SAT must be imported after log configuration, because it write stuff to logs
331
0a8eb0461f31 core: main SAT class now moved in its own module core.sat_main
Goffi <goffi@goffi.org>
parents: 330
diff changeset
41 from sat.core.sat_main import SAT
101
783e9d6980ec Couchsurfing plugin: first draft
Goffi <goffi@goffi.org>
parents: 90
diff changeset
42
994
652c01ca69b1 core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents: 991
diff changeset
43
2
c49345fd7737 refactoring: moved sat to sat.tac, now a twisted application so we can use twistd.
Goffi <goffi@goffi.org>
parents: 1
diff changeset
44 application = service.Application('SàT')
13
bd9e9997d540 wokkel integration (not finished yet)
Goffi <goffi@goffi.org>
parents: 12
diff changeset
45 service = SAT()
2
c49345fd7737 refactoring: moved sat to sat.tac, now a twisted application so we can use twistd.
Goffi <goffi@goffi.org>
parents: 1
diff changeset
46 service.setServiceParent(application)