author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 25 Sep 2009 11:56:31 +0200 | |
changeset 3482 | 9a868f462fa4 |
parent 3185 | bd0126d17e83 |
child 3890 | d7a270f50f54 |
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 |
||
11 |
from cubicweb.toolsutils import CommandHandler |
|
12 |
||
13 |
# trigger configuration registration |
|
14 |
import cubicweb.etwist.twconfig # pylint: disable-msg=W0611 |
|
15 |
||
16 |
class TWStartHandler(CommandHandler): |
|
17 |
cmdname = 'start' |
|
18 |
cfgname = 'twisted' |
|
19 |
||
3180
6bab5746ebf5
[c-c] fix start/restart commands
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2654
diff
changeset
|
20 |
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
|
21 |
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
|
22 |
server.run(config, debug) |
0 | 23 |
|
24 |
class TWStopHandler(CommandHandler): |
|
25 |
cmdname = 'stop' |
|
26 |
cfgname = 'twisted' |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
27 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
28 |
|
0 | 29 |
try: |
30 |
from cubicweb.server import serverctl |
|
31 |
||
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
|
32 |
class AllInOneCreateHandler(serverctl.RepositoryCreateHandler): |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2395
diff
changeset
|
33 |
"""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
|
34 |
integrating a repository server in the same process |
0 | 35 |
""" |
36 |
cfgname = 'all-in-one' |
|
37 |
||
38 |
def bootstrap(self, cubes, inputlevel=0): |
|
39 |
"""bootstrap this configuration""" |
|
40 |
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
|
41 |
|
0 | 42 |
class AllInOneStartHandler(TWStartHandler): |
43 |
cmdname = 'start' |
|
44 |
cfgname = 'all-in-one' |
|
45 |
subcommand = 'cubicweb-twisted' |
|
46 |
||
47 |
class AllInOneStopHandler(serverctl.RepositoryStopHandler): |
|
48 |
cmdname = 'stop' |
|
49 |
cfgname = 'all-in-one' |
|
50 |
subcommand = 'cubicweb-twisted' |
|
51 |
||
52 |
except ImportError: |
|
53 |
pass |