##// END OF EJS Templates
pyramid: removed pylons reference from apps....
marcink -
r1782:33dbb293 default
parent child Browse files
Show More
@@ -21,7 +21,7 b''
21 import collections
21 import collections
22 import logging
22 import logging
23
23
24 from pylons import tmpl_context as c
24
25 from pyramid.view import view_config
25 from pyramid.view import view_config
26
26
27 from rhodecode.apps._base import BaseAppView
27 from rhodecode.apps._base import BaseAppView
@@ -34,15 +34,21 b' log = logging.getLogger(__name__)'
34
34
35 class OpenSourceLicensesAdminSettingsView(BaseAppView):
35 class OpenSourceLicensesAdminSettingsView(BaseAppView):
36
36
37 def load_default_context(self):
38 c = self._get_local_tmpl_context()
39 self._register_global_c(c)
40 return c
41
37 @LoginRequired()
42 @LoginRequired()
38 @HasPermissionAllDecorator('hg.admin')
43 @HasPermissionAllDecorator('hg.admin')
39 @view_config(
44 @view_config(
40 route_name='admin_settings_open_source', request_method='GET',
45 route_name='admin_settings_open_source', request_method='GET',
41 renderer='rhodecode:templates/admin/settings/settings.mako')
46 renderer='rhodecode:templates/admin/settings/settings.mako')
42 def open_source_licenses(self):
47 def open_source_licenses(self):
48 c = self.load_default_context()
43 c.active = 'open_source'
49 c.active = 'open_source'
44 c.navlist = navigation_list(self.request)
50 c.navlist = navigation_list(self.request)
45 c.opensource_licenses = collections.OrderedDict(
51 c.opensource_licenses = collections.OrderedDict(
46 sorted(read_opensource_licenses().items(), key=lambda t: t[0]))
52 sorted(read_opensource_licenses().items(), key=lambda t: t[0]))
47
53
48 return {}
54 return self._get_template_context(c)
@@ -20,7 +20,6 b''
20
20
21 import logging
21 import logging
22
22
23 from pylons import tmpl_context as c
24 from pyramid.view import view_config
23 from pyramid.view import view_config
25 from pyramid.httpexceptions import HTTPFound
24 from pyramid.httpexceptions import HTTPFound
26
25
@@ -37,6 +36,11 b' log = logging.getLogger(__name__)'
37
36
38
37
39 class AdminSessionSettingsView(BaseAppView):
38 class AdminSessionSettingsView(BaseAppView):
39 def load_default_context(self):
40 c = self._get_local_tmpl_context()
41
42 self._register_global_c(c)
43 return c
40
44
41 @LoginRequired()
45 @LoginRequired()
42 @HasPermissionAllDecorator('hg.admin')
46 @HasPermissionAllDecorator('hg.admin')
@@ -44,6 +48,8 b' class AdminSessionSettingsView(BaseAppVi'
44 route_name='admin_settings_sessions', request_method='GET',
48 route_name='admin_settings_sessions', request_method='GET',
45 renderer='rhodecode:templates/admin/settings/settings.mako')
49 renderer='rhodecode:templates/admin/settings/settings.mako')
46 def settings_sessions(self):
50 def settings_sessions(self):
51 c = self.load_default_context()
52
47 c.active = 'sessions'
53 c.active = 'sessions'
48 c.navlist = navigation_list(self.request)
54 c.navlist = navigation_list(self.request)
49
55
@@ -59,7 +65,7 b' class AdminSessionSettingsView(BaseAppVi'
59 c.session_expired_count = c.session_model.get_expired_count(
65 c.session_expired_count = c.session_model.get_expired_count(
60 older_than_seconds)
66 older_than_seconds)
61
67
62 return {}
68 return self._get_template_context(c)
63
69
64 @LoginRequired()
70 @LoginRequired()
65 @CSRFRequired()
71 @CSRFRequired()
@@ -22,7 +22,6 b' import logging'
22 import urllib2
22 import urllib2
23 import packaging.version
23 import packaging.version
24
24
25 from pylons import tmpl_context as c
26 from pyramid.view import view_config
25 from pyramid.view import view_config
27
26
28 import rhodecode
27 import rhodecode
@@ -39,6 +38,10 b' log = logging.getLogger(__name__)'
39
38
40
39
41 class AdminSystemInfoSettingsView(BaseAppView):
40 class AdminSystemInfoSettingsView(BaseAppView):
41 def load_default_context(self):
42 c = self._get_local_tmpl_context()
43 self._register_global_c(c)
44 return c
42
45
43 @staticmethod
46 @staticmethod
44 def get_update_data(update_url):
47 def get_update_data(update_url):
@@ -64,6 +67,7 b' class AdminSystemInfoSettingsView(BaseAp'
64 renderer='rhodecode:templates/admin/settings/settings.mako')
67 renderer='rhodecode:templates/admin/settings/settings.mako')
65 def settings_system_info(self):
68 def settings_system_info(self):
66 _ = self.request.translate
69 _ = self.request.translate
70 c = self.load_default_context()
67
71
68 c.active = 'system'
72 c.active = 'system'
69 c.navlist = navigation_list(self.request)
73 c.navlist = navigation_list(self.request)
@@ -164,7 +168,7 b' class AdminSystemInfoSettingsView(BaseAp'
164 else:
168 else:
165 self.request.session.flash(
169 self.request.session.flash(
166 'You are not allowed to do this', queue='warning')
170 'You are not allowed to do this', queue='warning')
167 return {}
171 return self._get_template_context(c)
168
172
169 @LoginRequired()
173 @LoginRequired()
170 @HasPermissionAllDecorator('hg.admin')
174 @HasPermissionAllDecorator('hg.admin')
@@ -173,6 +177,7 b' class AdminSystemInfoSettingsView(BaseAp'
173 renderer='rhodecode:templates/admin/settings/settings_system_update.mako')
177 renderer='rhodecode:templates/admin/settings/settings_system_update.mako')
174 def settings_system_info_check_update(self):
178 def settings_system_info_check_update(self):
175 _ = self.request.translate
179 _ = self.request.translate
180 c = self.load_default_context()
176
181
177 update_url = self.get_update_url()
182 update_url = self.get_update_url()
178
183
@@ -201,4 +206,4 b' class AdminSystemInfoSettingsView(BaseAp'
201 c.should_upgrade = True
206 c.should_upgrade = True
202 c.important_notices = latest['general']
207 c.important_notices = latest['general']
203
208
204 return {}
209 return self._get_template_context(c)
@@ -30,8 +30,6 b' Channel Stream controller for rhodecode'
30 import logging
30 import logging
31 import uuid
31 import uuid
32
32
33 from pylons import tmpl_context as c
34 from pyramid.settings import asbool
35 from pyramid.view import view_config
33 from pyramid.view import view_config
36 from webob.exc import HTTPBadRequest, HTTPForbidden, HTTPBadGateway
34 from webob.exc import HTTPBadRequest, HTTPForbidden, HTTPBadGateway
37
35
@@ -46,7 +44,6 b' from rhodecode.lib.channelstream import '
46 update_history_from_logs,
44 update_history_from_logs,
47 STATE_PUBLIC_KEYS)
45 STATE_PUBLIC_KEYS)
48 from rhodecode.lib.auth import NotAnonymous
46 from rhodecode.lib.auth import NotAnonymous
49 from rhodecode.lib.utils2 import str2bool
50
47
51 log = logging.getLogger(__name__)
48 log = logging.getLogger(__name__)
52
49
@@ -82,7 +79,7 b' class ChannelstreamView(object):'
82 log.error('Incorrect permissions for requested channels')
79 log.error('Incorrect permissions for requested channels')
83 raise HTTPForbidden()
80 raise HTTPForbidden()
84
81
85 user = c.rhodecode_user
82 user = self._rhodecode_user
86 if user.user_id:
83 if user.user_id:
87 user_data = get_user_data(user.user_id)
84 user_data = get_user_data(user.user_id)
88 else:
85 else:
@@ -95,7 +92,7 b' class ChannelstreamView(object):'
95 'display_name': None,
92 'display_name': None,
96 'display_link': None,
93 'display_link': None,
97 }
94 }
98 user_data['permissions'] = c.rhodecode_user.permissions
95 user_data['permissions'] = self._rhodecode_user.permissions
99 payload = {
96 payload = {
100 'username': user.username,
97 'username': user.username,
101 'user_state': user_data,
98 'user_state': user_data,
General Comments 0
You need to be logged in to leave comments. Login now