Show More
@@ -0,0 +1,28 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | ||||
|
3 | # Copyright (C) 2016-2016 RhodeCode GmbH | |||
|
4 | # | |||
|
5 | # This program is free software: you can redistribute it and/or modify | |||
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |||
|
7 | # (only), as published by the Free Software Foundation. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU Affero General Public License | |||
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
|
16 | # | |||
|
17 | # This program is dual-licensed. If you wish to learn more about the | |||
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |||
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |||
|
20 | ||||
|
21 | ||||
|
22 | # Definition of setting keys used to configure this module. Defined here to | |||
|
23 | # avoid repetition of keys throughout the module. | |||
|
24 | config_file_path = 'svn.proxy.config_file_path' | |||
|
25 | generate_config = 'svn.proxy.generate_config' | |||
|
26 | list_parent_path = 'svn.proxy.list_parent_path' | |||
|
27 | location_root = 'svn.proxy.location_root' | |||
|
28 | parent_path_root = 'svn.proxy.parent_path_root' |
@@ -1,75 +1,75 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2016-2016 RhodeCode GmbH |
|
3 | # Copyright (C) 2016-2016 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | import logging |
|
21 | import logging | |
22 | import os |
|
22 | import os | |
23 |
|
23 | |||
24 | from rhodecode import events |
|
24 | from rhodecode import events | |
25 | from rhodecode.lib.utils2 import str2bool |
|
25 | from rhodecode.lib.utils2 import str2bool | |
26 |
|
26 | |||
27 | from .subscribers import generate_config_subscriber |
|
27 | from .subscribers import generate_config_subscriber | |
28 | from . import keys |
|
28 | from . import config_keys | |
29 |
|
29 | |||
30 |
|
30 | |||
31 | log = logging.getLogger(__name__) |
|
31 | log = logging.getLogger(__name__) | |
32 |
|
32 | |||
33 |
|
33 | |||
34 | def includeme(config): |
|
34 | def includeme(config): | |
35 | settings = config.registry.settings |
|
35 | settings = config.registry.settings | |
36 | _sanitize_settings_and_apply_defaults(settings) |
|
36 | _sanitize_settings_and_apply_defaults(settings) | |
37 |
|
37 | |||
38 | if settings[keys.generate_config]: |
|
38 | if settings[config_keys.generate_config]: | |
39 | config.add_subscriber( |
|
39 | config.add_subscriber( | |
40 | generate_config_subscriber, events.RepoGroupEvent) |
|
40 | generate_config_subscriber, events.RepoGroupEvent) | |
41 |
|
41 | |||
42 |
|
42 | |||
43 | def _sanitize_settings_and_apply_defaults(settings): |
|
43 | def _sanitize_settings_and_apply_defaults(settings): | |
44 | """ |
|
44 | """ | |
45 | Set defaults, convert to python types and validate settings. |
|
45 | Set defaults, convert to python types and validate settings. | |
46 | """ |
|
46 | """ | |
47 | # Convert bool settings from string to bool. |
|
47 | # Convert bool settings from string to bool. | |
48 | settings[keys.generate_config] = str2bool( |
|
48 | settings[config_keys.generate_config] = str2bool( | |
49 | settings.get(keys.generate_config, 'false')) |
|
49 | settings.get(config_keys.generate_config, 'false')) | |
50 | settings[keys.list_parent_path] = str2bool( |
|
50 | settings[config_keys.list_parent_path] = str2bool( | |
51 | settings.get(keys.list_parent_path, 'true')) |
|
51 | settings.get(config_keys.list_parent_path, 'true')) | |
52 |
|
52 | |||
53 | # Set defaults if key not present. |
|
53 | # Set defaults if key not present. | |
54 | settings.setdefault(keys.config_file_path, None) |
|
54 | settings.setdefault(config_keys.config_file_path, None) | |
55 | settings.setdefault(keys.location_root, '/') |
|
55 | settings.setdefault(config_keys.location_root, '/') | |
56 | settings.setdefault(keys.parent_path_root, None) |
|
56 | settings.setdefault(config_keys.parent_path_root, None) | |
57 |
|
57 | |||
58 | # Append path separator to paths. |
|
58 | # Append path separator to paths. | |
59 | settings[keys.location_root] = _append_path_sep( |
|
59 | settings[config_keys.location_root] = _append_path_sep( | |
60 | settings[keys.location_root]) |
|
60 | settings[config_keys.location_root]) | |
61 | settings[keys.parent_path_root] = _append_path_sep( |
|
61 | settings[config_keys.parent_path_root] = _append_path_sep( | |
62 | settings[keys.parent_path_root]) |
|
62 | settings[config_keys.parent_path_root]) | |
63 |
|
63 | |||
64 | # Validate settings. |
|
64 | # Validate settings. | |
65 | if settings[keys.generate_config]: |
|
65 | if settings[config_keys.generate_config]: | |
66 | assert settings[keys.config_file_path] is not None |
|
66 | assert settings[config_keys.config_file_path] is not None | |
67 |
|
67 | |||
68 |
|
68 | |||
69 | def _append_path_sep(path): |
|
69 | def _append_path_sep(path): | |
70 | """ |
|
70 | """ | |
71 | Append the path separator if missing. |
|
71 | Append the path separator if missing. | |
72 | """ |
|
72 | """ | |
73 | if isinstance(path, basestring) and not path.endswith(os.path.sep): |
|
73 | if isinstance(path, basestring) and not path.endswith(os.path.sep): | |
74 | path += os.path.sep |
|
74 | path += os.path.sep | |
75 | return path |
|
75 | return path |
@@ -1,138 +1,138 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2016-2016 RhodeCode GmbH |
|
3 | # Copyright (C) 2016-2016 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 |
|
21 | |||
22 | import mock |
|
22 | import mock | |
23 | import re |
|
23 | import re | |
24 | import shutil |
|
24 | import shutil | |
25 | import tempfile |
|
25 | import tempfile | |
26 |
|
26 | |||
27 | from pyramid import testing |
|
27 | from pyramid import testing | |
28 |
|
28 | |||
29 | from rhodecode.svn_support import keys |
|
29 | from rhodecode.svn_support import config_keys | |
30 | from rhodecode.svn_support.utils import generate_mod_dav_svn_config |
|
30 | from rhodecode.svn_support.utils import generate_mod_dav_svn_config | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | class TestModDavSvnConfig(object): |
|
33 | class TestModDavSvnConfig(object): | |
34 | @classmethod |
|
34 | @classmethod | |
35 | def setup_class(cls): |
|
35 | def setup_class(cls): | |
36 | # Make mako renderer available in tests. |
|
36 | # Make mako renderer available in tests. | |
37 | config = testing.setUp() |
|
37 | config = testing.setUp() | |
38 | config.include('pyramid_mako') |
|
38 | config.include('pyramid_mako') | |
39 |
|
39 | |||
40 | # Temporary directory holding the generated config files. |
|
40 | # Temporary directory holding the generated config files. | |
41 | cls.tempdir = tempfile.mkdtemp(suffix='pytest-mod-dav-svn') |
|
41 | cls.tempdir = tempfile.mkdtemp(suffix='pytest-mod-dav-svn') | |
42 |
|
42 | |||
43 | # Regex pattern to match a location block in the generated config. |
|
43 | # Regex pattern to match a location block in the generated config. | |
44 | cls.location_regex = ( |
|
44 | cls.location_regex = ( | |
45 | '<Location {location}>\s+' |
|
45 | '<Location {location}>\s+' | |
46 | 'DAV svn\s+' |
|
46 | 'DAV svn\s+' | |
47 | 'SVNParentPath {svn_parent_path}\s+' |
|
47 | 'SVNParentPath {svn_parent_path}\s+' | |
48 | 'SVNListParentPath {svn_list_parent_path}\s+' |
|
48 | 'SVNListParentPath {svn_list_parent_path}\s+' | |
49 | 'Allow from all\s+' |
|
49 | 'Allow from all\s+' | |
50 | 'Order allow,deny\s+' |
|
50 | 'Order allow,deny\s+' | |
51 | '</Location>') |
|
51 | '</Location>') | |
52 |
|
52 | |||
53 | @classmethod |
|
53 | @classmethod | |
54 | def teardown_class(cls): |
|
54 | def teardown_class(cls): | |
55 | testing.tearDown() |
|
55 | testing.tearDown() | |
56 | shutil.rmtree(cls.tempdir, ignore_errors=True) |
|
56 | shutil.rmtree(cls.tempdir, ignore_errors=True) | |
57 |
|
57 | |||
58 | @classmethod |
|
58 | @classmethod | |
59 | def get_settings(cls): |
|
59 | def get_settings(cls): | |
60 | config_file_path = tempfile.mkstemp( |
|
60 | config_file_path = tempfile.mkstemp( | |
61 | suffix='mod-dav-svn.conf', dir=cls.tempdir)[1] |
|
61 | suffix='mod-dav-svn.conf', dir=cls.tempdir)[1] | |
62 | return { |
|
62 | return { | |
63 | keys.config_file_path: config_file_path, |
|
63 | config_keys.config_file_path: config_file_path, | |
64 | keys.location_root: '/location/root/', |
|
64 | config_keys.location_root: '/location/root/', | |
65 | keys.parent_path_root: '/parent/path/root/', |
|
65 | config_keys.parent_path_root: '/parent/path/root/', | |
66 | keys.list_parent_path: True, |
|
66 | config_keys.list_parent_path: True, | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | @classmethod |
|
69 | @classmethod | |
70 | def get_repo_groups(cls, count=1): |
|
70 | def get_repo_groups(cls, count=1): | |
71 | repo_groups = [] |
|
71 | repo_groups = [] | |
72 | for num in range(0, count): |
|
72 | for num in range(0, count): | |
73 | repo_group_mock = mock.MagicMock() |
|
73 | repo_group_mock = mock.MagicMock() | |
74 | repo_group_mock.full_path = '/path/to/RepoGroup{}'.format(num) |
|
74 | repo_group_mock.full_path = '/path/to/RepoGroup{}'.format(num) | |
75 | repo_groups.append(repo_group_mock) |
|
75 | repo_groups.append(repo_group_mock) | |
76 | return repo_groups |
|
76 | return repo_groups | |
77 |
|
77 | |||
78 | @mock.patch('rhodecode.svn_support.utils.RepoGroup') |
|
78 | @mock.patch('rhodecode.svn_support.utils.RepoGroup') | |
79 | def test_generate_mod_dav_svn_config(self, RepoGroupMock): |
|
79 | def test_generate_mod_dav_svn_config(self, RepoGroupMock): | |
80 | num_groups = 3 |
|
80 | num_groups = 3 | |
81 | RepoGroupMock.get_all_repo_groups.return_value = self.get_repo_groups( |
|
81 | RepoGroupMock.get_all_repo_groups.return_value = self.get_repo_groups( | |
82 | count=num_groups) |
|
82 | count=num_groups) | |
83 |
|
83 | |||
84 | # Execute the method under test. |
|
84 | # Execute the method under test. | |
85 | settings = self.get_settings() |
|
85 | settings = self.get_settings() | |
86 | generate_mod_dav_svn_config(settings) |
|
86 | generate_mod_dav_svn_config(settings) | |
87 |
|
87 | |||
88 | # Read generated file. |
|
88 | # Read generated file. | |
89 | with open(settings[keys.config_file_path], 'r') as file_: |
|
89 | with open(settings[config_keys.config_file_path], 'r') as file_: | |
90 | content = file_.read() |
|
90 | content = file_.read() | |
91 |
|
91 | |||
92 | # Assert that one location block exists for each repository group. |
|
92 | # Assert that one location block exists for each repository group. | |
93 | repo_group_pattern = self.location_regex.format( |
|
93 | repo_group_pattern = self.location_regex.format( | |
94 | location='/location/root/path/to/RepoGroup\d+', |
|
94 | location='/location/root/path/to/RepoGroup\d+', | |
95 | svn_parent_path='/parent/path/root/path/to/RepoGroup\d+', |
|
95 | svn_parent_path='/parent/path/root/path/to/RepoGroup\d+', | |
96 | svn_list_parent_path='On') |
|
96 | svn_list_parent_path='On') | |
97 | assert len(re.findall(repo_group_pattern, content)) == num_groups |
|
97 | assert len(re.findall(repo_group_pattern, content)) == num_groups | |
98 |
|
98 | |||
99 | # Assert that the root location block exists. |
|
99 | # Assert that the root location block exists. | |
100 | root_pattern = self.location_regex.format( |
|
100 | root_pattern = self.location_regex.format( | |
101 | location='/location/root/', |
|
101 | location='/location/root/', | |
102 | svn_parent_path='/parent/path/root/', |
|
102 | svn_parent_path='/parent/path/root/', | |
103 | svn_list_parent_path='On') |
|
103 | svn_list_parent_path='On') | |
104 | assert len(re.findall(root_pattern, content)) == 1 |
|
104 | assert len(re.findall(root_pattern, content)) == 1 | |
105 |
|
105 | |||
106 | @mock.patch('rhodecode.svn_support.utils.RepoGroup') |
|
106 | @mock.patch('rhodecode.svn_support.utils.RepoGroup') | |
107 | def test_list_parent_path_on(self, RepoGroupMock): |
|
107 | def test_list_parent_path_on(self, RepoGroupMock): | |
108 | RepoGroupMock.get_all_repo_groups.return_value = self.get_repo_groups() |
|
108 | RepoGroupMock.get_all_repo_groups.return_value = self.get_repo_groups() | |
109 |
|
109 | |||
110 | # Execute the method under test. |
|
110 | # Execute the method under test. | |
111 | settings = self.get_settings() |
|
111 | settings = self.get_settings() | |
112 | settings[keys.list_parent_path] = True |
|
112 | settings[config_keys.list_parent_path] = True | |
113 | generate_mod_dav_svn_config(settings) |
|
113 | generate_mod_dav_svn_config(settings) | |
114 |
|
114 | |||
115 | # Read generated file. |
|
115 | # Read generated file. | |
116 | with open(settings[keys.config_file_path], 'r') as file_: |
|
116 | with open(settings[config_keys.config_file_path], 'r') as file_: | |
117 | content = file_.read() |
|
117 | content = file_.read() | |
118 |
|
118 | |||
119 | # Make assertions. |
|
119 | # Make assertions. | |
120 | assert not re.search('SVNListParentPath\s+Off', content) |
|
120 | assert not re.search('SVNListParentPath\s+Off', content) | |
121 | assert re.search('SVNListParentPath\s+On', content) |
|
121 | assert re.search('SVNListParentPath\s+On', content) | |
122 |
|
122 | |||
123 | @mock.patch('rhodecode.svn_support.utils.RepoGroup') |
|
123 | @mock.patch('rhodecode.svn_support.utils.RepoGroup') | |
124 | def test_list_parent_path_off(self, RepoGroupMock): |
|
124 | def test_list_parent_path_off(self, RepoGroupMock): | |
125 | RepoGroupMock.get_all_repo_groups.return_value = self.get_repo_groups() |
|
125 | RepoGroupMock.get_all_repo_groups.return_value = self.get_repo_groups() | |
126 |
|
126 | |||
127 | # Execute the method under test. |
|
127 | # Execute the method under test. | |
128 | settings = self.get_settings() |
|
128 | settings = self.get_settings() | |
129 | settings[keys.list_parent_path] = False |
|
129 | settings[config_keys.list_parent_path] = False | |
130 | generate_mod_dav_svn_config(settings) |
|
130 | generate_mod_dav_svn_config(settings) | |
131 |
|
131 | |||
132 | # Read generated file. |
|
132 | # Read generated file. | |
133 | with open(settings[keys.config_file_path], 'r') as file_: |
|
133 | with open(settings[config_keys.config_file_path], 'r') as file_: | |
134 | content = file_.read() |
|
134 | content = file_.read() | |
135 |
|
135 | |||
136 | # Make assertions. |
|
136 | # Make assertions. | |
137 | assert re.search('SVNListParentPath\s+Off', content) |
|
137 | assert re.search('SVNListParentPath\s+Off', content) | |
138 | assert not re.search('SVNListParentPath\s+On', content) |
|
138 | assert not re.search('SVNListParentPath\s+On', content) |
@@ -1,55 +1,55 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2016-2016 RhodeCode GmbH |
|
3 | # Copyright (C) 2016-2016 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | import os |
|
21 | import os | |
22 |
|
22 | |||
23 | from pyramid.renderers import render |
|
23 | from pyramid.renderers import render | |
24 |
|
24 | |||
25 | from rhodecode.model.db import RepoGroup |
|
25 | from rhodecode.model.db import RepoGroup | |
26 | from . import keys |
|
26 | from . import config_keys | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | def generate_mod_dav_svn_config(settings): |
|
29 | def generate_mod_dav_svn_config(settings): | |
30 | """ |
|
30 | """ | |
31 | Generate the configuration file for use with subversion's mod_dav_svn |
|
31 | Generate the configuration file for use with subversion's mod_dav_svn | |
32 | module. The configuration has to contain a <Location> block for each |
|
32 | module. The configuration has to contain a <Location> block for each | |
33 | available repository group because the mod_dav_svn module does not support |
|
33 | available repository group because the mod_dav_svn module does not support | |
34 | repositories organized in sub folders. |
|
34 | repositories organized in sub folders. | |
35 | """ |
|
35 | """ | |
36 | filepath = settings[keys.config_file_path] |
|
36 | filepath = settings[config_keys.config_file_path] | |
37 | parent_path_root = settings[keys.parent_path_root] |
|
37 | parent_path_root = settings[config_keys.parent_path_root] | |
38 | list_parent_path = settings[keys.list_parent_path] |
|
38 | list_parent_path = settings[config_keys.list_parent_path] | |
39 | location_root = settings[keys.location_root] |
|
39 | location_root = settings[config_keys.location_root] | |
40 |
|
40 | |||
41 | # Render the configuration to string. |
|
41 | # Render the configuration to string. | |
42 | template = 'rhodecode:svn_support/templates/mod-dav-svn.conf.mako' |
|
42 | template = 'rhodecode:svn_support/templates/mod-dav-svn.conf.mako' | |
43 | context = { |
|
43 | context = { | |
44 | 'location_root': location_root, |
|
44 | 'location_root': location_root, | |
45 | 'location_root_stripped': location_root.rstrip(os.path.sep), |
|
45 | 'location_root_stripped': location_root.rstrip(os.path.sep), | |
46 | 'parent_path_root': parent_path_root, |
|
46 | 'parent_path_root': parent_path_root, | |
47 | 'parent_path_root_stripped': parent_path_root.rstrip(os.path.sep), |
|
47 | 'parent_path_root_stripped': parent_path_root.rstrip(os.path.sep), | |
48 | 'repo_groups': RepoGroup.get_all_repo_groups(), |
|
48 | 'repo_groups': RepoGroup.get_all_repo_groups(), | |
49 | 'svn_list_parent_path': list_parent_path, |
|
49 | 'svn_list_parent_path': list_parent_path, | |
50 | } |
|
50 | } | |
51 | mod_dav_svn_config = render(template, context) |
|
51 | mod_dav_svn_config = render(template, context) | |
52 |
|
52 | |||
53 | # Write configuration to file. |
|
53 | # Write configuration to file. | |
54 | with open(filepath, 'w') as file_: |
|
54 | with open(filepath, 'w') as file_: | |
55 | file_.write(mod_dav_svn_config) |
|
55 | file_.write(mod_dav_svn_config) |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now