author | Nicolas Chauvat <nicolas.chauvat@logilab.fr> |
Mon, 24 Aug 2009 20:01:05 +0200 | |
branch | 3.5 |
changeset 2970 | d83f5d96e1d7 |
parent 2654 | 6512522860aa |
child 2791 | 7ef2b08fbe28 |
child 3180 | 6bab5746ebf5 |
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 |
||
21 |
def start_command(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 |