svn-support: Add a view to trigger the (re)generation of Apache mod_dav_svn configuration file.
The configuration is automatically generated if a repository group is changed. This is problematic in a case where no repository groups are used (yet). Therfore an option is needed to start the geneartion manually.
This commit is contained in:
parent
9b4da4cb9b
commit
03c17a2a57
2 changed files with 31 additions and 1 deletions
|
|
@ -35,6 +35,9 @@ def includeme(config):
|
|||
config.add_route(
|
||||
name='admin_settings_open_source',
|
||||
pattern=ADMIN_PREFIX + '/settings/open_source')
|
||||
config.add_route(
|
||||
name='admin_settings_vcs_svn_generate_cfg',
|
||||
pattern=ADMIN_PREFIX + '/settings/vcs/svn_generate_cfg')
|
||||
|
||||
# Scan module for configuration decorators.
|
||||
config.scan()
|
||||
|
|
|
|||
|
|
@ -24,8 +24,11 @@ import logging
|
|||
from pylons import tmpl_context as c
|
||||
from pyramid.view import view_config
|
||||
|
||||
from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
|
||||
from rhodecode.lib.auth import (
|
||||
LoginRequired, HasPermissionAllDecorator, CSRFRequired)
|
||||
from rhodecode.lib.utils import read_opensource_licenses
|
||||
from rhodecode.svn_support.utils import generate_mod_dav_svn_config
|
||||
from rhodecode.translation import _
|
||||
|
||||
from .navigation import navigation_list
|
||||
|
||||
|
|
@ -53,3 +56,27 @@ class AdminSettingsView(object):
|
|||
sorted(read_opensource_licenses().items(), key=lambda t: t[0]))
|
||||
|
||||
return {}
|
||||
|
||||
@LoginRequired()
|
||||
@CSRFRequired()
|
||||
@HasPermissionAllDecorator('hg.admin')
|
||||
@view_config(
|
||||
route_name='admin_settings_vcs_svn_generate_cfg',
|
||||
request_method='POST', renderer='json')
|
||||
def vcs_svn_generate_config(self):
|
||||
try:
|
||||
generate_mod_dav_svn_config(self.request.registry)
|
||||
msg = {
|
||||
'message': _('Apache configuration for Subversion generated.'),
|
||||
'level': 'success',
|
||||
}
|
||||
except Exception:
|
||||
log.exception(
|
||||
'Exception while generating the Apache configuration for Subversion.')
|
||||
msg = {
|
||||
'message': _('Failed to generate the Apache configuration for Subversion.'),
|
||||
'level': 'error',
|
||||
}
|
||||
|
||||
data = {'message': msg}
|
||||
return data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue