author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 25 Sep 2009 14:25:46 +0200 | |
branch | stable |
changeset 3489 | 3766d53c607e |
parent 3180 | 6bab5746ebf5 |
child 3185 | bd0126d17e83 |
child 3820 | 52cd7432030d |
permissions | -rw-r--r-- |
0 | 1 |
"""cubicweb-clt handlers for twisted |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
2 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
3 |
:organization: Logilab |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
4 |
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
0 | 7 |
""" |
8 |
||
9 |
import sys |
|
10 |
||
2395
e3093fc12a00
[cw-ctl] improve dialog messages
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
11 |
from cubicweb import underline_title |
0 | 12 |
from cubicweb.toolsutils import CommandHandler |
13 |
||
14 |
# trigger configuration registration |
|
15 |
import cubicweb.etwist.twconfig # pylint: disable-msg=W0611 |
|
16 |
||
17 |
class TWStartHandler(CommandHandler): |
|
18 |
cmdname = 'start' |
|
19 |
cfgname = 'twisted' |
|
20 |
||
3180
6bab5746ebf5
[c-c] fix start/restart commands
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2654
diff
changeset
|
21 |
def start_server(self, config, debug): |
2654
6512522860aa
[twisted] don't use twistd anymore, all-in-one.py file is needed anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
22 |
from cubicweb.etwist import server |
6512522860aa
[twisted] don't use twistd anymore, all-in-one.py file is needed anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
23 |
server.run(config, debug) |
0 | 24 |
|
25 |
class TWStopHandler(CommandHandler): |
|
26 |
cmdname = 'stop' |
|
27 |
cfgname = 'twisted' |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
28 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
29 |
|
0 | 30 |
try: |
31 |
from cubicweb.server import serverctl |
|
32 |
||
2654
6512522860aa
[twisted] don't use twistd anymore, all-in-one.py file is needed anymore
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
33 |
class AllInOneCreateHandler(serverctl.RepositoryCreateHandler): |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2395
diff
changeset
|
34 |
"""configuration to get an instance running in a twisted web server |
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2395
diff
changeset
|
35 |
integrating a repository server in the same process |
0 | 36 |
""" |
37 |
cfgname = 'all-in-one' |
|
38 |
||
39 |
def bootstrap(self, cubes, inputlevel=0): |
|
40 |
"""bootstrap this configuration""" |
|
41 |
serverctl.RepositoryCreateHandler.bootstrap(self, cubes, inputlevel) |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
42 |
|
0 | 43 |
class AllInOneStartHandler(TWStartHandler): |
44 |
cmdname = 'start' |
|
45 |
cfgname = 'all-in-one' |
|
46 |
subcommand = 'cubicweb-twisted' |
|
47 |
||
48 |
class AllInOneStopHandler(serverctl.RepositoryStopHandler): |
|
49 |
cmdname = 'stop' |
|
50 |
cfgname = 'all-in-one' |
|
51 |
subcommand = 'cubicweb-twisted' |
|
52 |
||
53 |
except ImportError: |
|
54 |
pass |