equal
deleted
inserted
replaced
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """cubicweb-ctl commands and command handlers common to twisted/modpython |
18 """cubicweb-ctl commands and command handlers common to twisted/modpython |
19 web configuration |
19 web configuration |
20 """ |
20 """ |
|
21 from __future__ import print_function |
21 |
22 |
22 __docformat__ = "restructuredtext en" |
23 __docformat__ = "restructuredtext en" |
23 |
24 |
24 import os, os.path as osp |
25 import os, os.path as osp |
25 from shutil import copy, rmtree |
26 from shutil import copy, rmtree |
42 cmdname = 'create' |
43 cmdname = 'create' |
43 |
44 |
44 def bootstrap(self, cubes, automatic=False, inputlevel=0): |
45 def bootstrap(self, cubes, automatic=False, inputlevel=0): |
45 """bootstrap this configuration""" |
46 """bootstrap this configuration""" |
46 if not automatic: |
47 if not automatic: |
47 print '\n' + underline_title('Generic web configuration') |
48 print('\n' + underline_title('Generic web configuration')) |
48 config = self.config |
49 config = self.config |
49 config.input_config('web', inputlevel) |
50 config.input_config('web', inputlevel) |
50 if ASK.confirm('Allow anonymous access ?', False): |
51 if ASK.confirm('Allow anonymous access ?', False): |
51 config.global_set_option('anonymous-user', 'anon') |
52 config.global_set_option('anonymous-user', 'anon') |
52 config.global_set_option('anonymous-password', 'anon') |
53 config.global_set_option('anonymous-password', 'anon') |
85 os.makedirs(dirname) |
86 os.makedirs(dirname) |
86 resource_dir, resource_path = config.locate_resource(resource) |
87 resource_dir, resource_path = config.locate_resource(resource) |
87 copy(osp.join(resource_dir, resource_path), dest_resource) |
88 copy(osp.join(resource_dir, resource_path), dest_resource) |
88 # handle md5 version subdirectory |
89 # handle md5 version subdirectory |
89 linkdir(dest, osp.join(dest, config.instance_md5_version())) |
90 linkdir(dest, osp.join(dest, config.instance_md5_version())) |
90 print ('You can use apache rewrite rule below :\n' |
91 print('You can use apache rewrite rule below :\n' |
91 'RewriteRule ^/data/(.*) %s/$1 [L]' % dest) |
92 'RewriteRule ^/data/(.*) %s/$1 [L]' % dest) |
92 |
93 |
93 def _datadirs(self, config, repo=None): |
94 def _datadirs(self, config, repo=None): |
94 if repo is None: |
95 if repo is None: |
95 repo = config.repository() |
96 repo = config.repository() |
96 if config._cubes is None: |
97 if config._cubes is None: |