##// END OF EJS Templates
oss-licenses: Migrate view to pyramid.
Martin Bornhold -
r204:9d966d61 default
parent child Browse files
Show More
@@ -0,0 +1,32 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 from rhodecode.config.routing import ADMIN_PREFIX
23
24
25 def includeme(config):
26
27 config.add_route(
28 name='admin_settings_open_source',
29 pattern=ADMIN_PREFIX + '/settings/open_source')
30
31 # Scan module for configuration decorators.
32 config.scan()
@@ -0,0 +1,54 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 import collections
22 import logging
23
24 from pylons import tmpl_context as c
25 from pyramid.view import view_config
26
27 from rhodecode.controllers.admin.settings import navigation
28 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
29 from rhodecode.lib.utils import read_opensource_licenses
30
31
32 log = logging.getLogger(__name__)
33
34
35 class AdminSettingsView(object):
36
37 def __init__(self, context, request):
38 self.request = request
39 self.context = context
40 self.session = request.session
41 self._rhodecode_user = request.user
42
43 @LoginRequired()
44 @HasPermissionAllDecorator('hg.admin')
45 @view_config(
46 route_name='admin_settings_open_source', request_method='GET',
47 renderer='rhodecode:templates/admin/settings/settings.html')
48 def open_source_licenses(self):
49 c.active = 'open_source'
50 c.navlist = navigation.get_navlist(self.request)
51 c.opensource_licenses = collections.OrderedDict(
52 sorted(read_opensource_licenses().items(), key=lambda t: t[0]))
53
54 return {}
@@ -214,6 +214,7 b' def includeme(config):'
214 214 # Includes which are required. The application would fail without them.
215 215 config.include('pyramid_mako')
216 216 config.include('pyramid_beaker')
217 config.include('rhodecode.admin')
217 218 config.include('rhodecode.authentication')
218 219 config.include('rhodecode.login')
219 220 config.include('rhodecode.tweens')
@@ -822,7 +822,7 b' class NavigationRegistry(object):'
822 822 NavEntry('system', lazy_ugettext('System Info'),
823 823 'admin_settings_system'),
824 824 NavEntry('open_source', lazy_ugettext('Open Source Licenses'),
825 'admin_settings_open_source'),
825 'admin_settings_open_source', pyramid=True),
826 826 # TODO: marcink: we disable supervisor now until the supervisor stats
827 827 # page is fixed in the nix configuration
828 828 # NavEntry('supervisor', lazy_ugettext('Supervisor'),
General Comments 0
You need to be logged in to leave comments. Login now