author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 12 Nov 2009 09:27:01 +0100 | |
branch | stable |
changeset 3820 | 52cd7432030d |
parent 3180 | 6bab5746ebf5 |
child 3821 | 653ddc1e4179 |
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 |
3820
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
13 |
from cubicweb.web.webctl import WebCreateHandler |
0 | 14 |
|
15 |
# trigger configuration registration |
|
16 |
import cubicweb.etwist.twconfig # pylint: disable-msg=W0611 |
|
17 |
||
3820
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
18 |
class TWCreateHandler(WebCreateHandler): |
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
19 |
cfgname = 'twisted' |
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
20 |
|
0 | 21 |
class TWStartHandler(CommandHandler): |
22 |
cmdname = 'start' |
|
23 |
cfgname = 'twisted' |
|
24 |
||
3180
6bab5746ebf5
[c-c] fix start/restart commands
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2654
diff
changeset
|
25 |
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
|
26 |
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
|
27 |
server.run(config, debug) |
0 | 28 |
|
29 |
class TWStopHandler(CommandHandler): |
|
30 |
cmdname = 'stop' |
|
31 |
cfgname = 'twisted' |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
32 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
33 |
|
0 | 34 |
try: |
35 |
from cubicweb.server import serverctl |
|
3820
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
36 |
from cubicweb.server import serverctl |
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
37 |
WebCreateHandler |
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
38 |
class AllInOneCreateHandler(serverctl.RepositoryCreateHandler, |
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
39 |
TWCreateHandler): |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2395
diff
changeset
|
40 |
"""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
|
41 |
integrating a repository server in the same process |
0 | 42 |
""" |
43 |
cfgname = 'all-in-one' |
|
44 |
||
45 |
def bootstrap(self, cubes, inputlevel=0): |
|
46 |
"""bootstrap this configuration""" |
|
47 |
serverctl.RepositoryCreateHandler.bootstrap(self, cubes, inputlevel) |
|
3820
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
48 |
TWCreateHandler.bootstrap(self, cubes, inputlevel) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
49 |
|
0 | 50 |
class AllInOneStartHandler(TWStartHandler): |
51 |
cmdname = 'start' |
|
52 |
cfgname = 'all-in-one' |
|
53 |
subcommand = 'cubicweb-twisted' |
|
54 |
||
55 |
class AllInOneStopHandler(serverctl.RepositoryStopHandler): |
|
56 |
cmdname = 'stop' |
|
57 |
cfgname = 'all-in-one' |
|
58 |
subcommand = 'cubicweb-twisted' |
|
59 |
||
60 |
except ImportError: |
|
61 |
pass |