Show More
@@ -35,6 +35,9 b' def includeme(config):' | |||||
35 | config.add_route( |
|
35 | config.add_route( | |
36 | name='admin_settings_open_source', |
|
36 | name='admin_settings_open_source', | |
37 | pattern=ADMIN_PREFIX + '/settings/open_source') |
|
37 | pattern=ADMIN_PREFIX + '/settings/open_source') | |
|
38 | config.add_route( | |||
|
39 | name='admin_settings_vcs_svn_generate_cfg', | |||
|
40 | pattern=ADMIN_PREFIX + '/settings/vcs/svn_generate_cfg') | |||
38 |
|
41 | |||
39 | # Scan module for configuration decorators. |
|
42 | # Scan module for configuration decorators. | |
40 | config.scan() |
|
43 | config.scan() |
@@ -24,8 +24,11 b' import logging' | |||||
24 | from pylons import tmpl_context as c |
|
24 | from pylons import tmpl_context as c | |
25 | from pyramid.view import view_config |
|
25 | from pyramid.view import view_config | |
26 |
|
26 | |||
27 |
from rhodecode.lib.auth import |
|
27 | from rhodecode.lib.auth import ( | |
|
28 | LoginRequired, HasPermissionAllDecorator, CSRFRequired) | |||
28 | from rhodecode.lib.utils import read_opensource_licenses |
|
29 | from rhodecode.lib.utils import read_opensource_licenses | |
|
30 | from rhodecode.svn_support.utils import generate_mod_dav_svn_config | |||
|
31 | from rhodecode.translation import _ | |||
29 |
|
32 | |||
30 | from .navigation import navigation_list |
|
33 | from .navigation import navigation_list | |
31 |
|
34 | |||
@@ -53,3 +56,27 b' class AdminSettingsView(object):' | |||||
53 | sorted(read_opensource_licenses().items(), key=lambda t: t[0])) |
|
56 | sorted(read_opensource_licenses().items(), key=lambda t: t[0])) | |
54 |
|
57 | |||
55 | return {} |
|
58 | return {} | |
|
59 | ||||
|
60 | @LoginRequired() | |||
|
61 | @CSRFRequired() | |||
|
62 | @HasPermissionAllDecorator('hg.admin') | |||
|
63 | @view_config( | |||
|
64 | route_name='admin_settings_vcs_svn_generate_cfg', | |||
|
65 | request_method='POST', renderer='json') | |||
|
66 | def vcs_svn_generate_config(self): | |||
|
67 | try: | |||
|
68 | generate_mod_dav_svn_config(self.request.registry) | |||
|
69 | msg = { | |||
|
70 | 'message': _('Apache configuration for Subversion generated.'), | |||
|
71 | 'level': 'success', | |||
|
72 | } | |||
|
73 | except Exception: | |||
|
74 | log.exception( | |||
|
75 | 'Exception while generating the Apache configuration for Subversion.') | |||
|
76 | msg = { | |||
|
77 | 'message': _('Failed to generate the Apache configuration for Subversion.'), | |||
|
78 | 'level': 'error', | |||
|
79 | } | |||
|
80 | ||||
|
81 | data = {'message': msg} | |||
|
82 | return data |
General Comments 0
You need to be logged in to leave comments.
Login now