svn: Move path computation from themplate to python.
This commit is contained in:
parent
95880bb787
commit
4765be2517
2 changed files with 16 additions and 8 deletions
|
|
@ -46,8 +46,9 @@
|
|||
Order allow,deny
|
||||
</Location>
|
||||
|
||||
% for repo_group in repo_groups:
|
||||
<Location ${location_root_stripped}${repo_group.full_path}>
|
||||
% for location, parent_path in repo_group_paths:
|
||||
|
||||
<Location ${location}>
|
||||
AuthType Basic
|
||||
AuthName "Subversion proxy"
|
||||
AuthBasicProvider anon
|
||||
|
|
@ -55,7 +56,7 @@
|
|||
Require valid-user
|
||||
|
||||
DAV svn
|
||||
SVNParentPath ${parent_path_root_stripped}${repo_group.full_path}
|
||||
SVNParentPath ${parent_path}
|
||||
SVNListParentPath ${'On' if svn_list_parent_path else 'Off'}
|
||||
|
||||
Allow from all
|
||||
|
|
|
|||
|
|
@ -38,16 +38,23 @@ def generate_mod_dav_svn_config(settings):
|
|||
list_parent_path = settings[config_keys.list_parent_path]
|
||||
location_root = settings[config_keys.location_root]
|
||||
|
||||
# Render the configuration to string.
|
||||
template = 'rhodecode:svn_support/templates/mod-dav-svn.conf.mako'
|
||||
# Prepare render context.
|
||||
repo_group_paths = []
|
||||
for repo_group in RepoGroup.get_all_repo_groups():
|
||||
group_path = repo_group.full_path_splitted
|
||||
location = os.path.join(location_root, *group_path)
|
||||
parent_path = os.path.join(parent_path_root, *group_path)
|
||||
repo_group_paths.append((location, parent_path))
|
||||
|
||||
context = {
|
||||
'location_root': location_root,
|
||||
'location_root_stripped': location_root.rstrip(os.path.sep),
|
||||
'parent_path_root': parent_path_root,
|
||||
'parent_path_root_stripped': parent_path_root.rstrip(os.path.sep),
|
||||
'repo_groups': RepoGroup.get_all_repo_groups(),
|
||||
'repo_group_paths': repo_group_paths,
|
||||
'svn_list_parent_path': list_parent_path,
|
||||
}
|
||||
|
||||
# Render the configuration template to string.
|
||||
template = 'rhodecode:svn_support/templates/mod-dav-svn.conf.mako'
|
||||
mod_dav_svn_config = render(template, context)
|
||||
|
||||
# Write configuration to file.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue