author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 29 Apr 2010 14:21:57 +0200 | |
changeset 5442 | 3ed8afbbdf70 |
parent 5424 | 8ecbcbff9777 |
child 5752 | b0bb553e3be4 |
permissions | -rw-r--r-- |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
1 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
0 | 18 |
"""cubicweb-clt handlers for twisted |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
19 |
|
0 | 20 |
""" |
21 |
||
22 |
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
|
23 |
from cubicweb.web.webctl import WebCreateHandler |
0 | 24 |
|
25 |
# trigger configuration registration |
|
26 |
import cubicweb.etwist.twconfig # pylint: disable-msg=W0611 |
|
27 |
||
3820
52cd7432030d
c-c create stopped asking if anonymous access should be activated
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3180
diff
changeset
|
28 |
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
|
29 |
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
|
30 |
|
0 | 31 |
class TWStartHandler(CommandHandler): |
32 |
cmdname = 'start' |
|
33 |
cfgname = 'twisted' |
|
34 |
||
5442
3ed8afbbdf70
[webconfig] refactor/cleanup debug mode management on startup: simply use config.debugmode instead of debug argument everywhere...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
35 |
def start_server(self, config): |
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
|
36 |
from cubicweb.etwist import server |
5442
3ed8afbbdf70
[webconfig] refactor/cleanup debug mode management on startup: simply use config.debugmode instead of debug argument everywhere...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
37 |
server.run(config) |
0 | 38 |
|
39 |
class TWStopHandler(CommandHandler): |
|
40 |
cmdname = 'stop' |
|
41 |
cfgname = 'twisted' |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
42 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
43 |
|
0 | 44 |
try: |
45 |
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
|
46 |
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
|
47 |
TWCreateHandler): |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2395
diff
changeset
|
48 |
"""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
|
49 |
integrating a repository server in the same process |
0 | 50 |
""" |
51 |
cfgname = 'all-in-one' |
|
52 |
||
53 |
def bootstrap(self, cubes, inputlevel=0): |
|
54 |
"""bootstrap this configuration""" |
|
55 |
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
|
56 |
TWCreateHandler.bootstrap(self, cubes, inputlevel) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
57 |
|
0 | 58 |
class AllInOneStartHandler(TWStartHandler): |
59 |
cmdname = 'start' |
|
60 |
cfgname = 'all-in-one' |
|
61 |
subcommand = 'cubicweb-twisted' |
|
62 |
||
63 |
class AllInOneStopHandler(serverctl.RepositoryStopHandler): |
|
64 |
cmdname = 'stop' |
|
65 |
cfgname = 'all-in-one' |
|
66 |
subcommand = 'cubicweb-twisted' |
|
67 |
||
68 |
except ImportError: |
|
69 |
pass |