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