Show More
@@ -112,7 +112,7 b' following list, modules may only depend ' | |||
|
112 | 112 | everything and has a huge dependency chain, so it should not be used for |
|
113 | 113 | anything else. TODO. |
|
114 | 114 | |
|
115 | ``controlles/base.py`` | |
|
115 | ``controllers/base.py`` | |
|
116 | 116 | The base class of controllers, with lots of model knowledge. |
|
117 | 117 | |
|
118 | 118 | ``lib/auth.py`` |
@@ -32,8 +32,8 b' import logging' | |||
|
32 | 32 | import re |
|
33 | 33 | |
|
34 | 34 | from kallithea.config.middleware.pygrack import make_wsgi_app |
|
35 | from kallithea.controllers import base | |
|
35 | 36 | from kallithea.lib import hooks |
|
36 | from kallithea.lib.base import BaseVCSController, get_path_info | |
|
37 | 37 | |
|
38 | 38 | |
|
39 | 39 | log = logging.getLogger(__name__) |
@@ -48,13 +48,13 b' cmd_mapping = {' | |||
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | |
|
51 | class SimpleGit(BaseVCSController): | |
|
51 | class SimpleGit(base.BaseVCSController): | |
|
52 | 52 | |
|
53 | 53 | scm_alias = 'git' |
|
54 | 54 | |
|
55 | 55 | @classmethod |
|
56 | 56 | def parse_request(cls, environ): |
|
57 | path_info = get_path_info(environ) | |
|
57 | path_info = base.get_path_info(environ) | |
|
58 | 58 | m = GIT_PROTO_PAT.match(path_info) |
|
59 | 59 | if m is None: |
|
60 | 60 | return None |
@@ -34,7 +34,7 b' import urllib.parse' | |||
|
34 | 34 | |
|
35 | 35 | import mercurial.hgweb |
|
36 | 36 | |
|
37 | from kallithea.lib.base import BaseVCSController, get_path_info | |
|
37 | from kallithea.controllers import base | |
|
38 | 38 | from kallithea.lib.utils import make_ui |
|
39 | 39 | from kallithea.lib.utils2 import safe_bytes |
|
40 | 40 | |
@@ -91,7 +91,7 b' cmd_mapping = {' | |||
|
91 | 91 | } |
|
92 | 92 | |
|
93 | 93 | |
|
94 | class SimpleHg(BaseVCSController): | |
|
94 | class SimpleHg(base.BaseVCSController): | |
|
95 | 95 | |
|
96 | 96 | scm_alias = 'hg' |
|
97 | 97 | |
@@ -100,7 +100,7 b' class SimpleHg(BaseVCSController):' | |||
|
100 | 100 | http_accept = environ.get('HTTP_ACCEPT', '') |
|
101 | 101 | if not http_accept.startswith('application/mercurial'): |
|
102 | 102 | return None |
|
103 | path_info = get_path_info(environ) | |
|
103 | path_info = base.get_path_info(environ) | |
|
104 | 104 | if not path_info.startswith('/'): # it must! |
|
105 | 105 | return None |
|
106 | 106 |
@@ -29,7 +29,7 b' Original author and date, and relevant c' | |||
|
29 | 29 | import logging |
|
30 | 30 | import time |
|
31 | 31 | |
|
32 | from kallithea.lib.base import get_ip_addr, get_path_info | |
|
32 | from kallithea.controllers import base | |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | log = logging.getLogger(__name__) |
@@ -91,8 +91,8 b' class RequestWrapper(object):' | |||
|
91 | 91 | def __call__(self, environ, start_response): |
|
92 | 92 | meter = Meter(start_response) |
|
93 | 93 | description = "Request from %s for %s" % ( |
|
94 | get_ip_addr(environ), | |
|
95 | get_path_info(environ), | |
|
94 | base.get_ip_addr(environ), | |
|
95 | base.get_path_info(environ), | |
|
96 | 96 | ) |
|
97 | 97 | log.info("%s received", description) |
|
98 | 98 | try: |
@@ -36,8 +36,8 b' from whoosh import query' | |||
|
36 | 36 | from whoosh.qparser.dateparse import DateParserPlugin |
|
37 | 37 | from whoosh.qparser.default import QueryParser |
|
38 | 38 | |
|
39 | from kallithea.controllers import base | |
|
39 | 40 | from kallithea.lib.auth import HasPermissionAnyDecorator, LoginRequired |
|
40 | from kallithea.lib.base import BaseController, render | |
|
41 | 41 | from kallithea.lib.indexers import JOURNAL_SCHEMA |
|
42 | 42 | from kallithea.lib.page import Page |
|
43 | 43 | from kallithea.lib.utils2 import remove_prefix, remove_suffix, safe_int |
@@ -118,7 +118,7 b' def _journal_filter(user_log, search_ter' | |||
|
118 | 118 | return user_log |
|
119 | 119 | |
|
120 | 120 | |
|
121 | class AdminController(BaseController): | |
|
121 | class AdminController(base.BaseController): | |
|
122 | 122 | |
|
123 | 123 | @LoginRequired(allow_default_user=True) |
|
124 | 124 | def _before(self, *args, **kwargs): |
@@ -142,6 +142,6 b' class AdminController(BaseController):' | |||
|
142 | 142 | filter=c.search_term) |
|
143 | 143 | |
|
144 | 144 | if request.environ.get('HTTP_X_PARTIAL_XHR'): |
|
145 | return render('admin/admin_log.html') | |
|
145 | return base.render('admin/admin_log.html') | |
|
146 | 146 | |
|
147 | return render('admin/admin.html') | |
|
147 | return base.render('admin/admin.html') |
@@ -32,9 +32,9 b' from tg import tmpl_context as c' | |||
|
32 | 32 | from tg.i18n import ugettext as _ |
|
33 | 33 | from webob.exc import HTTPFound |
|
34 | 34 | |
|
35 | from kallithea.controllers import base | |
|
35 | 36 | from kallithea.lib import auth_modules, webutils |
|
36 | 37 | from kallithea.lib.auth import HasPermissionAnyDecorator, LoginRequired |
|
37 | from kallithea.lib.base import BaseController, render | |
|
38 | 38 | from kallithea.lib.webutils import url |
|
39 | 39 | from kallithea.model import db, meta |
|
40 | 40 | from kallithea.model.forms import AuthSettingsForm |
@@ -43,7 +43,7 b' from kallithea.model.forms import AuthSe' | |||
|
43 | 43 | log = logging.getLogger(__name__) |
|
44 | 44 | |
|
45 | 45 | |
|
46 | class AuthSettingsController(BaseController): | |
|
46 | class AuthSettingsController(base.BaseController): | |
|
47 | 47 | |
|
48 | 48 | @LoginRequired() |
|
49 | 49 | @HasPermissionAnyDecorator('hg.admin') |
@@ -86,7 +86,7 b' class AuthSettingsController(BaseControl' | |||
|
86 | 86 | |
|
87 | 87 | log.debug('defaults: %s', defaults) |
|
88 | 88 | return formencode.htmlfill.render( |
|
89 | render('admin/auth/auth_settings.html'), | |
|
89 | base.render('admin/auth/auth_settings.html'), | |
|
90 | 90 | defaults=c.defaults, |
|
91 | 91 | errors=errors, |
|
92 | 92 | prefix_error=False, |
@@ -34,9 +34,9 b' from tg import request' | |||
|
34 | 34 | from tg.i18n import ugettext as _ |
|
35 | 35 | from webob.exc import HTTPFound |
|
36 | 36 | |
|
37 | from kallithea.controllers import base | |
|
37 | 38 | from kallithea.lib import webutils |
|
38 | 39 | from kallithea.lib.auth import HasPermissionAnyDecorator, LoginRequired |
|
39 | from kallithea.lib.base import BaseController, render | |
|
40 | 40 | from kallithea.lib.webutils import url |
|
41 | 41 | from kallithea.model import db, meta |
|
42 | 42 | from kallithea.model.forms import DefaultsForm |
@@ -45,7 +45,7 b' from kallithea.model.forms import Defaul' | |||
|
45 | 45 | log = logging.getLogger(__name__) |
|
46 | 46 | |
|
47 | 47 | |
|
48 | class DefaultsController(BaseController): | |
|
48 | class DefaultsController(base.BaseController): | |
|
49 | 49 | |
|
50 | 50 | @LoginRequired() |
|
51 | 51 | @HasPermissionAnyDecorator('hg.admin') |
@@ -56,7 +56,7 b' class DefaultsController(BaseController)' | |||
|
56 | 56 | defaults = db.Setting.get_default_repo_settings() |
|
57 | 57 | |
|
58 | 58 | return htmlfill.render( |
|
59 | render('admin/defaults/defaults.html'), | |
|
59 | base.render('admin/defaults/defaults.html'), | |
|
60 | 60 | defaults=defaults, |
|
61 | 61 | encoding="UTF-8", |
|
62 | 62 | force_defaults=False |
@@ -77,7 +77,7 b' class DefaultsController(BaseController)' | |||
|
77 | 77 | defaults = errors.value |
|
78 | 78 | |
|
79 | 79 | return htmlfill.render( |
|
80 | render('admin/defaults/defaults.html'), | |
|
80 | base.render('admin/defaults/defaults.html'), | |
|
81 | 81 | defaults=defaults, |
|
82 | 82 | errors=errors.error_dict or {}, |
|
83 | 83 | prefix_error=False, |
@@ -35,9 +35,9 b' from tg import tmpl_context as c' | |||
|
35 | 35 | from tg.i18n import ugettext as _ |
|
36 | 36 | from webob.exc import HTTPForbidden, HTTPFound, HTTPNotFound |
|
37 | 37 | |
|
38 | from kallithea.controllers import base | |
|
38 | 39 | from kallithea.lib import auth, webutils |
|
39 | 40 | from kallithea.lib.auth import LoginRequired |
|
40 | from kallithea.lib.base import BaseController, jsonify, render | |
|
41 | 41 | from kallithea.lib.page import Page |
|
42 | 42 | from kallithea.lib.utils2 import safe_int, safe_str, time_to_datetime |
|
43 | 43 | from kallithea.lib.vcs.exceptions import NodeNotChangedError, VCSError |
@@ -50,7 +50,7 b' from kallithea.model.gist import GistMod' | |||
|
50 | 50 | log = logging.getLogger(__name__) |
|
51 | 51 | |
|
52 | 52 | |
|
53 | class GistsController(BaseController): | |
|
53 | class GistsController(base.BaseController): | |
|
54 | 54 | |
|
55 | 55 | def __load_defaults(self, extra_values=None): |
|
56 | 56 | c.lifetime_values = [ |
@@ -102,7 +102,7 b' class GistsController(BaseController):' | |||
|
102 | 102 | p = safe_int(request.GET.get('page'), 1) |
|
103 | 103 | c.gists_pager = Page(c.gists, page=p, items_per_page=10, |
|
104 | 104 | **url_params) |
|
105 | return render('admin/gists/index.html') | |
|
105 | return base.render('admin/gists/index.html') | |
|
106 | 106 | |
|
107 | 107 | @LoginRequired() |
|
108 | 108 | def create(self): |
@@ -134,7 +134,7 b' class GistsController(BaseController):' | |||
|
134 | 134 | defaults = errors.value |
|
135 | 135 | |
|
136 | 136 | return formencode.htmlfill.render( |
|
137 | render('admin/gists/new.html'), | |
|
137 | base.render('admin/gists/new.html'), | |
|
138 | 138 | defaults=defaults, |
|
139 | 139 | errors=errors.error_dict or {}, |
|
140 | 140 | prefix_error=False, |
@@ -150,7 +150,7 b' class GistsController(BaseController):' | |||
|
150 | 150 | @LoginRequired() |
|
151 | 151 | def new(self, format='html'): |
|
152 | 152 | self.__load_defaults() |
|
153 | return render('admin/gists/new.html') | |
|
153 | return base.render('admin/gists/new.html') | |
|
154 | 154 | |
|
155 | 155 | @LoginRequired() |
|
156 | 156 | def delete(self, gist_id): |
@@ -186,7 +186,7 b' class GistsController(BaseController):' | |||
|
186 | 186 | ) |
|
187 | 187 | response.content_type = 'text/plain' |
|
188 | 188 | return content |
|
189 | return render('admin/gists/show.html') | |
|
189 | return base.render('admin/gists/show.html') | |
|
190 | 190 | |
|
191 | 191 | @LoginRequired() |
|
192 | 192 | def edit(self, gist_id, format='html'): |
@@ -203,7 +203,7 b' class GistsController(BaseController):' | |||
|
203 | 203 | raise HTTPNotFound() |
|
204 | 204 | |
|
205 | 205 | self.__load_defaults(extra_values=('0', _('Unmodified'))) |
|
206 | rendered = render('admin/gists/edit.html') | |
|
206 | rendered = base.render('admin/gists/edit.html') | |
|
207 | 207 | |
|
208 | 208 | if request.POST: |
|
209 | 209 | rpost = request.POST |
@@ -248,7 +248,7 b' class GistsController(BaseController):' | |||
|
248 | 248 | return rendered |
|
249 | 249 | |
|
250 | 250 | @LoginRequired() |
|
251 | @jsonify | |
|
251 | @base.jsonify | |
|
252 | 252 | def check_revision(self, gist_id): |
|
253 | 253 | c.gist = db.Gist.get_or_404(gist_id) |
|
254 | 254 | last_rev = c.gist.scm_instance.get_changeset() |
@@ -35,9 +35,9 b' from tg import tmpl_context as c' | |||
|
35 | 35 | from tg.i18n import ugettext as _ |
|
36 | 36 | from webob.exc import HTTPFound |
|
37 | 37 | |
|
38 | from kallithea.controllers import base | |
|
38 | 39 | from kallithea.lib import auth_modules, webutils |
|
39 | 40 | from kallithea.lib.auth import AuthUser, LoginRequired |
|
40 | from kallithea.lib.base import BaseController, IfSshEnabled, render | |
|
41 | 41 | from kallithea.lib.utils2 import generate_api_key, safe_int |
|
42 | 42 | from kallithea.lib.webutils import url |
|
43 | 43 | from kallithea.model import db, meta |
@@ -51,7 +51,7 b' from kallithea.model.user import UserMod' | |||
|
51 | 51 | log = logging.getLogger(__name__) |
|
52 | 52 | |
|
53 | 53 | |
|
54 | class MyAccountController(BaseController): | |
|
54 | class MyAccountController(base.BaseController): | |
|
55 | 55 | |
|
56 | 56 | @LoginRequired() |
|
57 | 57 | def _before(self, *args, **kwargs): |
@@ -116,7 +116,7 b' class MyAccountController(BaseController' | |||
|
116 | 116 | |
|
117 | 117 | except formencode.Invalid as errors: |
|
118 | 118 | return htmlfill.render( |
|
119 | render('admin/my_account/my_account.html'), | |
|
119 | base.render('admin/my_account/my_account.html'), | |
|
120 | 120 | defaults=errors.value, |
|
121 | 121 | errors=errors.error_dict or {}, |
|
122 | 122 | prefix_error=False, |
@@ -129,7 +129,7 b' class MyAccountController(BaseController' | |||
|
129 | 129 | if update: |
|
130 | 130 | raise HTTPFound(location='my_account') |
|
131 | 131 | return htmlfill.render( |
|
132 | render('admin/my_account/my_account.html'), | |
|
132 | base.render('admin/my_account/my_account.html'), | |
|
133 | 133 | defaults=defaults, |
|
134 | 134 | encoding="UTF-8", |
|
135 | 135 | force_defaults=False) |
@@ -150,7 +150,7 b' class MyAccountController(BaseController' | |||
|
150 | 150 | webutils.flash(_("Successfully updated password"), category='success') |
|
151 | 151 | except formencode.Invalid as errors: |
|
152 | 152 | return htmlfill.render( |
|
153 | render('admin/my_account/my_account.html'), | |
|
153 | base.render('admin/my_account/my_account.html'), | |
|
154 | 154 | defaults=errors.value, |
|
155 | 155 | errors=errors.error_dict or {}, |
|
156 | 156 | prefix_error=False, |
@@ -160,7 +160,7 b' class MyAccountController(BaseController' | |||
|
160 | 160 | log.error(traceback.format_exc()) |
|
161 | 161 | webutils.flash(_('Error occurred during update of user password'), |
|
162 | 162 | category='error') |
|
163 | return render('admin/my_account/my_account.html') | |
|
163 | return base.render('admin/my_account/my_account.html') | |
|
164 | 164 | |
|
165 | 165 | def my_account_repos(self): |
|
166 | 166 | c.active = 'repos' |
@@ -168,7 +168,7 b' class MyAccountController(BaseController' | |||
|
168 | 168 | |
|
169 | 169 | # data used to render the grid |
|
170 | 170 | c.data = self._load_my_repos_data() |
|
171 | return render('admin/my_account/my_account.html') | |
|
171 | return base.render('admin/my_account/my_account.html') | |
|
172 | 172 | |
|
173 | 173 | def my_account_watched(self): |
|
174 | 174 | c.active = 'watched' |
@@ -176,14 +176,14 b' class MyAccountController(BaseController' | |||
|
176 | 176 | |
|
177 | 177 | # data used to render the grid |
|
178 | 178 | c.data = self._load_my_repos_data(watched=True) |
|
179 | return render('admin/my_account/my_account.html') | |
|
179 | return base.render('admin/my_account/my_account.html') | |
|
180 | 180 | |
|
181 | 181 | def my_account_perms(self): |
|
182 | 182 | c.active = 'perms' |
|
183 | 183 | self.__load_data() |
|
184 | 184 | c.perm_user = AuthUser(user_id=request.authuser.user_id) |
|
185 | 185 | |
|
186 | return render('admin/my_account/my_account.html') | |
|
186 | return base.render('admin/my_account/my_account.html') | |
|
187 | 187 | |
|
188 | 188 | def my_account_emails(self): |
|
189 | 189 | c.active = 'emails' |
@@ -191,7 +191,7 b' class MyAccountController(BaseController' | |||
|
191 | 191 | |
|
192 | 192 | c.user_email_map = db.UserEmailMap.query() \ |
|
193 | 193 | .filter(db.UserEmailMap.user == c.user).all() |
|
194 | return render('admin/my_account/my_account.html') | |
|
194 | return base.render('admin/my_account/my_account.html') | |
|
195 | 195 | |
|
196 | 196 | def my_account_emails_add(self): |
|
197 | 197 | email = request.POST.get('new_email') |
@@ -231,7 +231,7 b' class MyAccountController(BaseController' | |||
|
231 | 231 | c.lifetime_options = [(c.lifetime_values, _("Lifetime"))] |
|
232 | 232 | c.user_api_keys = ApiKeyModel().get_api_keys(request.authuser.user_id, |
|
233 | 233 | show_expired=show_expired) |
|
234 | return render('admin/my_account/my_account.html') | |
|
234 | return base.render('admin/my_account/my_account.html') | |
|
235 | 235 | |
|
236 | 236 | def my_account_api_keys_add(self): |
|
237 | 237 | lifetime = safe_int(request.POST.get('lifetime'), -1) |
@@ -255,14 +255,14 b' class MyAccountController(BaseController' | |||
|
255 | 255 | |
|
256 | 256 | raise HTTPFound(location=url('my_account_api_keys')) |
|
257 | 257 | |
|
258 | @IfSshEnabled | |
|
258 | @base.IfSshEnabled | |
|
259 | 259 | def my_account_ssh_keys(self): |
|
260 | 260 | c.active = 'ssh_keys' |
|
261 | 261 | self.__load_data() |
|
262 | 262 | c.user_ssh_keys = SshKeyModel().get_ssh_keys(request.authuser.user_id) |
|
263 | return render('admin/my_account/my_account.html') | |
|
263 | return base.render('admin/my_account/my_account.html') | |
|
264 | 264 | |
|
265 | @IfSshEnabled | |
|
265 | @base.IfSshEnabled | |
|
266 | 266 | def my_account_ssh_keys_add(self): |
|
267 | 267 | description = request.POST.get('description') |
|
268 | 268 | public_key = request.POST.get('public_key') |
@@ -276,7 +276,7 b' class MyAccountController(BaseController' | |||
|
276 | 276 | webutils.flash(e.args[0], category='error') |
|
277 | 277 | raise HTTPFound(location=url('my_account_ssh_keys')) |
|
278 | 278 | |
|
279 | @IfSshEnabled | |
|
279 | @base.IfSshEnabled | |
|
280 | 280 | def my_account_ssh_keys_delete(self): |
|
281 | 281 | fingerprint = request.POST.get('del_public_key_fingerprint') |
|
282 | 282 | try: |
@@ -36,9 +36,9 b' from tg import tmpl_context as c' | |||
|
36 | 36 | from tg.i18n import ugettext as _ |
|
37 | 37 | from webob.exc import HTTPFound |
|
38 | 38 | |
|
39 | from kallithea.controllers import base | |
|
39 | 40 | from kallithea.lib import webutils |
|
40 | 41 | from kallithea.lib.auth import AuthUser, HasPermissionAnyDecorator, LoginRequired |
|
41 | from kallithea.lib.base import BaseController, render | |
|
42 | 42 | from kallithea.lib.webutils import url |
|
43 | 43 | from kallithea.model import db, meta |
|
44 | 44 | from kallithea.model.forms import DefaultPermissionsForm |
@@ -48,7 +48,7 b' from kallithea.model.permission import P' | |||
|
48 | 48 | log = logging.getLogger(__name__) |
|
49 | 49 | |
|
50 | 50 | |
|
51 | class PermissionsController(BaseController): | |
|
51 | class PermissionsController(base.BaseController): | |
|
52 | 52 | |
|
53 | 53 | @LoginRequired() |
|
54 | 54 | @HasPermissionAnyDecorator('hg.admin') |
@@ -120,7 +120,7 b' class PermissionsController(BaseControll' | |||
|
120 | 120 | defaults = errors.value |
|
121 | 121 | |
|
122 | 122 | return htmlfill.render( |
|
123 | render('admin/permissions/permissions.html'), | |
|
123 | base.render('admin/permissions/permissions.html'), | |
|
124 | 124 | defaults=defaults, |
|
125 | 125 | errors=errors.error_dict or {}, |
|
126 | 126 | prefix_error=False, |
@@ -162,7 +162,7 b' class PermissionsController(BaseControll' | |||
|
162 | 162 | defaults['default_fork'] = p.permission.permission_name |
|
163 | 163 | |
|
164 | 164 | return htmlfill.render( |
|
165 | render('admin/permissions/permissions.html'), | |
|
165 | base.render('admin/permissions/permissions.html'), | |
|
166 | 166 | defaults=defaults, |
|
167 | 167 | encoding="UTF-8", |
|
168 | 168 | force_defaults=False) |
@@ -173,10 +173,10 b' class PermissionsController(BaseControll' | |||
|
173 | 173 | c.user_ip_map = db.UserIpMap.query() \ |
|
174 | 174 | .filter(db.UserIpMap.user == c.user).all() |
|
175 | 175 | |
|
176 | return render('admin/permissions/permissions.html') | |
|
176 | return base.render('admin/permissions/permissions.html') | |
|
177 | 177 | |
|
178 | 178 | def permission_perms(self): |
|
179 | 179 | c.active = 'perms' |
|
180 | 180 | c.user = db.User.get_default_user() |
|
181 | 181 | c.perm_user = AuthUser(dbuser=c.user) |
|
182 | return render('admin/permissions/permissions.html') | |
|
182 | return base.render('admin/permissions/permissions.html') |
@@ -37,9 +37,9 b' from tg.i18n import ungettext' | |||
|
37 | 37 | from webob.exc import HTTPForbidden, HTTPFound, HTTPInternalServerError, HTTPNotFound |
|
38 | 38 | |
|
39 | 39 | import kallithea.lib.helpers as h |
|
40 | from kallithea.controllers import base | |
|
40 | 41 | from kallithea.lib import webutils |
|
41 | 42 | from kallithea.lib.auth import HasPermissionAny, HasRepoGroupPermissionLevel, HasRepoGroupPermissionLevelDecorator, LoginRequired |
|
42 | from kallithea.lib.base import BaseController, render | |
|
43 | 43 | from kallithea.lib.utils2 import safe_int |
|
44 | 44 | from kallithea.lib.webutils import url |
|
45 | 45 | from kallithea.model import db, meta |
@@ -52,7 +52,7 b' from kallithea.model.scm import Availabl' | |||
|
52 | 52 | log = logging.getLogger(__name__) |
|
53 | 53 | |
|
54 | 54 | |
|
55 | class RepoGroupsController(BaseController): | |
|
55 | class RepoGroupsController(base.BaseController): | |
|
56 | 56 | |
|
57 | 57 | @LoginRequired(allow_default_user=True) |
|
58 | 58 | def _before(self, *args, **kwargs): |
@@ -132,7 +132,7 b' class RepoGroupsController(BaseControlle' | |||
|
132 | 132 | "records": repo_groups_data |
|
133 | 133 | } |
|
134 | 134 | |
|
135 | return render('admin/repo_groups/repo_groups.html') | |
|
135 | return base.render('admin/repo_groups/repo_groups.html') | |
|
136 | 136 | |
|
137 | 137 | def create(self): |
|
138 | 138 | self.__load_defaults() |
@@ -154,7 +154,7 b' class RepoGroupsController(BaseControlle' | |||
|
154 | 154 | # TODO: in future action_logger(, '', '', '') |
|
155 | 155 | except formencode.Invalid as errors: |
|
156 | 156 | return htmlfill.render( |
|
157 | render('admin/repo_groups/repo_group_add.html'), | |
|
157 | base.render('admin/repo_groups/repo_group_add.html'), | |
|
158 | 158 | defaults=errors.value, |
|
159 | 159 | errors=errors.error_dict or {}, |
|
160 | 160 | prefix_error=False, |
@@ -190,7 +190,7 b' class RepoGroupsController(BaseControlle' | |||
|
190 | 190 | |
|
191 | 191 | self.__load_defaults() |
|
192 | 192 | return htmlfill.render( |
|
193 | render('admin/repo_groups/repo_group_add.html'), | |
|
193 | base.render('admin/repo_groups/repo_group_add.html'), | |
|
194 | 194 | defaults={'parent_group_id': parent_group_id}, |
|
195 | 195 | errors={}, |
|
196 | 196 | prefix_error=False, |
@@ -230,7 +230,7 b' class RepoGroupsController(BaseControlle' | |||
|
230 | 230 | except formencode.Invalid as errors: |
|
231 | 231 | c.active = 'settings' |
|
232 | 232 | return htmlfill.render( |
|
233 | render('admin/repo_groups/repo_group_edit.html'), | |
|
233 | base.render('admin/repo_groups/repo_group_edit.html'), | |
|
234 | 234 | defaults=errors.value, |
|
235 | 235 | errors=errors.error_dict or {}, |
|
236 | 236 | prefix_error=False, |
@@ -298,7 +298,7 b' class RepoGroupsController(BaseControlle' | |||
|
298 | 298 | repo_groups_list=repo_groups_list, |
|
299 | 299 | short_name=True) |
|
300 | 300 | |
|
301 | return render('admin/repo_groups/repo_group_show.html') | |
|
301 | return base.render('admin/repo_groups/repo_group_show.html') | |
|
302 | 302 | |
|
303 | 303 | @HasRepoGroupPermissionLevelDecorator('admin') |
|
304 | 304 | def edit(self, group_name): |
@@ -310,7 +310,7 b' class RepoGroupsController(BaseControlle' | |||
|
310 | 310 | defaults = self.__load_data(c.repo_group.group_id) |
|
311 | 311 | |
|
312 | 312 | return htmlfill.render( |
|
313 | render('admin/repo_groups/repo_group_edit.html'), | |
|
313 | base.render('admin/repo_groups/repo_group_edit.html'), | |
|
314 | 314 | defaults=defaults, |
|
315 | 315 | encoding="UTF-8", |
|
316 | 316 | force_defaults=False |
@@ -321,7 +321,7 b' class RepoGroupsController(BaseControlle' | |||
|
321 | 321 | c.active = 'advanced' |
|
322 | 322 | c.repo_group = db.RepoGroup.guess_instance(group_name) |
|
323 | 323 | |
|
324 | return render('admin/repo_groups/repo_group_edit.html') | |
|
324 | return base.render('admin/repo_groups/repo_group_edit.html') | |
|
325 | 325 | |
|
326 | 326 | @HasRepoGroupPermissionLevelDecorator('admin') |
|
327 | 327 | def edit_repo_group_perms(self, group_name): |
@@ -331,7 +331,7 b' class RepoGroupsController(BaseControlle' | |||
|
331 | 331 | defaults = self.__load_data(c.repo_group.group_id) |
|
332 | 332 | |
|
333 | 333 | return htmlfill.render( |
|
334 | render('admin/repo_groups/repo_group_edit.html'), | |
|
334 | base.render('admin/repo_groups/repo_group_edit.html'), | |
|
335 | 335 | defaults=defaults, |
|
336 | 336 | encoding="UTF-8", |
|
337 | 337 | force_defaults=False |
@@ -36,9 +36,9 b' from tg.i18n import ugettext as _' | |||
|
36 | 36 | from webob.exc import HTTPForbidden, HTTPFound, HTTPInternalServerError, HTTPNotFound |
|
37 | 37 | |
|
38 | 38 | import kallithea |
|
39 | from kallithea.controllers import base | |
|
39 | 40 | from kallithea.lib import webutils |
|
40 | 41 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired, NotAnonymous |
|
41 | from kallithea.lib.base import BaseRepoController, jsonify, render | |
|
42 | 42 | from kallithea.lib.exceptions import AttachedForksError |
|
43 | 43 | from kallithea.lib.utils2 import safe_int |
|
44 | 44 | from kallithea.lib.vcs import RepositoryError |
@@ -52,7 +52,7 b' from kallithea.model.scm import Availabl' | |||
|
52 | 52 | log = logging.getLogger(__name__) |
|
53 | 53 | |
|
54 | 54 | |
|
55 | class ReposController(BaseRepoController): | |
|
55 | class ReposController(base.BaseRepoController): | |
|
56 | 56 | |
|
57 | 57 | @LoginRequired(allow_default_user=True) |
|
58 | 58 | def _before(self, *args, **kwargs): |
@@ -93,7 +93,7 b' class ReposController(BaseRepoController' | |||
|
93 | 93 | # data used to render the grid |
|
94 | 94 | c.data = repos_data |
|
95 | 95 | |
|
96 | return render('admin/repos/repos.html') | |
|
96 | return base.render('admin/repos/repos.html') | |
|
97 | 97 | |
|
98 | 98 | @NotAnonymous() |
|
99 | 99 | def create(self): |
@@ -106,7 +106,7 b' class ReposController(BaseRepoController' | |||
|
106 | 106 | except formencode.Invalid as errors: |
|
107 | 107 | log.info(errors) |
|
108 | 108 | return htmlfill.render( |
|
109 | render('admin/repos/repo_add.html'), | |
|
109 | base.render('admin/repos/repo_add.html'), | |
|
110 | 110 | defaults=errors.value, |
|
111 | 111 | errors=errors.error_dict or {}, |
|
112 | 112 | prefix_error=False, |
@@ -148,7 +148,7 b' class ReposController(BaseRepoController' | |||
|
148 | 148 | defaults.update({'repo_group': parent_group}) |
|
149 | 149 | |
|
150 | 150 | return htmlfill.render( |
|
151 | render('admin/repos/repo_add.html'), | |
|
151 | base.render('admin/repos/repo_add.html'), | |
|
152 | 152 | defaults=defaults, |
|
153 | 153 | errors={}, |
|
154 | 154 | prefix_error=False, |
@@ -161,10 +161,10 b' class ReposController(BaseRepoController' | |||
|
161 | 161 | c.task_id = request.GET.get('task_id') |
|
162 | 162 | if not c.repo: |
|
163 | 163 | raise HTTPNotFound() |
|
164 | return render('admin/repos/repo_creating.html') | |
|
164 | return base.render('admin/repos/repo_creating.html') | |
|
165 | 165 | |
|
166 | 166 | @LoginRequired() |
|
167 | @jsonify | |
|
167 | @base.jsonify | |
|
168 | 168 | def repo_check(self, repo_name): |
|
169 | 169 | c.repo = repo_name |
|
170 | 170 | task_id = request.GET.get('task_id') |
@@ -230,7 +230,7 b' class ReposController(BaseRepoController' | |||
|
230 | 230 | defaults = self.__load_data() |
|
231 | 231 | defaults.update(errors.value) |
|
232 | 232 | return htmlfill.render( |
|
233 | render('admin/repos/repo_edit.html'), | |
|
233 | base.render('admin/repos/repo_edit.html'), | |
|
234 | 234 | defaults=defaults, |
|
235 | 235 | errors=errors.error_dict or {}, |
|
236 | 236 | prefix_error=False, |
@@ -286,7 +286,7 b' class ReposController(BaseRepoController' | |||
|
286 | 286 | .filter(db.RepositoryField.repository == c.repo_info).all() |
|
287 | 287 | c.active = 'settings' |
|
288 | 288 | return htmlfill.render( |
|
289 | render('admin/repos/repo_edit.html'), | |
|
289 | base.render('admin/repos/repo_edit.html'), | |
|
290 | 290 | defaults=defaults, |
|
291 | 291 | encoding="UTF-8", |
|
292 | 292 | force_defaults=False) |
@@ -298,7 +298,7 b' class ReposController(BaseRepoController' | |||
|
298 | 298 | defaults = RepoModel()._get_defaults(repo_name) |
|
299 | 299 | |
|
300 | 300 | return htmlfill.render( |
|
301 | render('admin/repos/repo_edit.html'), | |
|
301 | base.render('admin/repos/repo_edit.html'), | |
|
302 | 302 | defaults=defaults, |
|
303 | 303 | encoding="UTF-8", |
|
304 | 304 | force_defaults=False) |
@@ -355,7 +355,7 b' class ReposController(BaseRepoController' | |||
|
355 | 355 | if request.POST: |
|
356 | 356 | |
|
357 | 357 | raise HTTPFound(location=url('repo_edit_fields')) |
|
358 | return render('admin/repos/repo_edit.html') | |
|
358 | return base.render('admin/repos/repo_edit.html') | |
|
359 | 359 | |
|
360 | 360 | @HasRepoPermissionLevelDecorator('admin') |
|
361 | 361 | def create_repo_field(self, repo_name): |
@@ -413,7 +413,7 b' class ReposController(BaseRepoController' | |||
|
413 | 413 | if request.POST: |
|
414 | 414 | raise HTTPFound(location=url('repo_edit_advanced')) |
|
415 | 415 | return htmlfill.render( |
|
416 | render('admin/repos/repo_edit.html'), | |
|
416 | base.render('admin/repos/repo_edit.html'), | |
|
417 | 417 | defaults=defaults, |
|
418 | 418 | encoding="UTF-8", |
|
419 | 419 | force_defaults=False) |
@@ -478,7 +478,7 b' class ReposController(BaseRepoController' | |||
|
478 | 478 | webutils.flash(_('An error occurred during pull from remote location'), |
|
479 | 479 | category='error') |
|
480 | 480 | raise HTTPFound(location=url('edit_repo_remote', repo_name=c.repo_name)) |
|
481 | return render('admin/repos/repo_edit.html') | |
|
481 | return base.render('admin/repos/repo_edit.html') | |
|
482 | 482 | |
|
483 | 483 | @HasRepoPermissionLevelDecorator('admin') |
|
484 | 484 | def edit_statistics(self, repo_name): |
@@ -510,4 +510,4 b' class ReposController(BaseRepoController' | |||
|
510 | 510 | category='error') |
|
511 | 511 | raise HTTPFound(location=url('edit_repo_statistics', repo_name=c.repo_name)) |
|
512 | 512 | |
|
513 | return render('admin/repos/repo_edit.html') | |
|
513 | return base.render('admin/repos/repo_edit.html') |
@@ -36,9 +36,9 b' from tg.i18n import ugettext as _' | |||
|
36 | 36 | from webob.exc import HTTPFound |
|
37 | 37 | |
|
38 | 38 | import kallithea |
|
39 | from kallithea.controllers import base | |
|
39 | 40 | from kallithea.lib import webutils |
|
40 | 41 | from kallithea.lib.auth import HasPermissionAnyDecorator, LoginRequired |
|
41 | from kallithea.lib.base import BaseController, render | |
|
42 | 42 | from kallithea.lib.utils import repo2db_mapper, set_app_settings |
|
43 | 43 | from kallithea.lib.utils2 import safe_str |
|
44 | 44 | from kallithea.lib.vcs import VCSError |
@@ -52,7 +52,7 b' from kallithea.model.scm import ScmModel' | |||
|
52 | 52 | log = logging.getLogger(__name__) |
|
53 | 53 | |
|
54 | 54 | |
|
55 | class SettingsController(BaseController): | |
|
55 | class SettingsController(base.BaseController): | |
|
56 | 56 | |
|
57 | 57 | @LoginRequired(allow_default_user=True) |
|
58 | 58 | def _before(self, *args, **kwargs): |
@@ -85,7 +85,7 b' class SettingsController(BaseController)' | |||
|
85 | 85 | form_result = application_form.to_python(dict(request.POST)) |
|
86 | 86 | except formencode.Invalid as errors: |
|
87 | 87 | return htmlfill.render( |
|
88 | render('admin/settings/settings.html'), | |
|
88 | base.render('admin/settings/settings.html'), | |
|
89 | 89 | defaults=errors.value, |
|
90 | 90 | errors=errors.error_dict or {}, |
|
91 | 91 | prefix_error=False, |
@@ -124,7 +124,7 b' class SettingsController(BaseController)' | |||
|
124 | 124 | defaults.update(self._get_hg_ui_settings()) |
|
125 | 125 | |
|
126 | 126 | return htmlfill.render( |
|
127 | render('admin/settings/settings.html'), | |
|
127 | base.render('admin/settings/settings.html'), | |
|
128 | 128 | defaults=defaults, |
|
129 | 129 | encoding="UTF-8", |
|
130 | 130 | force_defaults=False) |
@@ -172,7 +172,7 b' class SettingsController(BaseController)' | |||
|
172 | 172 | defaults.update(self._get_hg_ui_settings()) |
|
173 | 173 | |
|
174 | 174 | return htmlfill.render( |
|
175 | render('admin/settings/settings.html'), | |
|
175 | base.render('admin/settings/settings.html'), | |
|
176 | 176 | defaults=defaults, |
|
177 | 177 | encoding="UTF-8", |
|
178 | 178 | force_defaults=False) |
@@ -186,7 +186,7 b' class SettingsController(BaseController)' | |||
|
186 | 186 | form_result = application_form.to_python(dict(request.POST)) |
|
187 | 187 | except formencode.Invalid as errors: |
|
188 | 188 | return htmlfill.render( |
|
189 | render('admin/settings/settings.html'), | |
|
189 | base.render('admin/settings/settings.html'), | |
|
190 | 190 | defaults=errors.value, |
|
191 | 191 | errors=errors.error_dict or {}, |
|
192 | 192 | prefix_error=False, |
@@ -219,7 +219,7 b' class SettingsController(BaseController)' | |||
|
219 | 219 | defaults.update(self._get_hg_ui_settings()) |
|
220 | 220 | |
|
221 | 221 | return htmlfill.render( |
|
222 | render('admin/settings/settings.html'), | |
|
222 | base.render('admin/settings/settings.html'), | |
|
223 | 223 | defaults=defaults, |
|
224 | 224 | encoding="UTF-8", |
|
225 | 225 | force_defaults=False) |
@@ -233,7 +233,7 b' class SettingsController(BaseController)' | |||
|
233 | 233 | form_result = application_form.to_python(dict(request.POST)) |
|
234 | 234 | except formencode.Invalid as errors: |
|
235 | 235 | return htmlfill.render( |
|
236 | render('admin/settings/settings.html'), | |
|
236 | base.render('admin/settings/settings.html'), | |
|
237 | 237 | defaults=errors.value, |
|
238 | 238 | errors=errors.error_dict or {}, |
|
239 | 239 | prefix_error=False, |
@@ -274,7 +274,7 b' class SettingsController(BaseController)' | |||
|
274 | 274 | defaults.update(self._get_hg_ui_settings()) |
|
275 | 275 | |
|
276 | 276 | return htmlfill.render( |
|
277 | render('admin/settings/settings.html'), | |
|
277 | base.render('admin/settings/settings.html'), | |
|
278 | 278 | defaults=defaults, |
|
279 | 279 | encoding="UTF-8", |
|
280 | 280 | force_defaults=False) |
@@ -312,7 +312,7 b' class SettingsController(BaseController)' | |||
|
312 | 312 | c.ini = kallithea.CONFIG |
|
313 | 313 | |
|
314 | 314 | return htmlfill.render( |
|
315 | render('admin/settings/settings.html'), | |
|
315 | base.render('admin/settings/settings.html'), | |
|
316 | 316 | defaults=defaults, |
|
317 | 317 | encoding="UTF-8", |
|
318 | 318 | force_defaults=False) |
@@ -367,7 +367,7 b' class SettingsController(BaseController)' | |||
|
367 | 367 | c.custom_hooks = db.Ui.get_custom_hooks() |
|
368 | 368 | |
|
369 | 369 | return htmlfill.render( |
|
370 | render('admin/settings/settings.html'), | |
|
370 | base.render('admin/settings/settings.html'), | |
|
371 | 371 | defaults=defaults, |
|
372 | 372 | encoding="UTF-8", |
|
373 | 373 | force_defaults=False) |
@@ -386,7 +386,7 b' class SettingsController(BaseController)' | |||
|
386 | 386 | defaults.update(self._get_hg_ui_settings()) |
|
387 | 387 | |
|
388 | 388 | return htmlfill.render( |
|
389 | render('admin/settings/settings.html'), | |
|
389 | base.render('admin/settings/settings.html'), | |
|
390 | 390 | defaults=defaults, |
|
391 | 391 | encoding="UTF-8", |
|
392 | 392 | force_defaults=False) |
@@ -404,7 +404,7 b' class SettingsController(BaseController)' | |||
|
404 | 404 | setattr(c, key, val) |
|
405 | 405 | |
|
406 | 406 | return htmlfill.render( |
|
407 | render('admin/settings/settings.html'), | |
|
407 | base.render('admin/settings/settings.html'), | |
|
408 | 408 | defaults=defaults, |
|
409 | 409 | encoding="UTF-8", |
|
410 | 410 | force_defaults=False) |
@@ -38,9 +38,9 b' from tg.i18n import ugettext as _' | |||
|
38 | 38 | from webob.exc import HTTPFound, HTTPInternalServerError |
|
39 | 39 | |
|
40 | 40 | import kallithea.lib.helpers as h |
|
41 | from kallithea.controllers import base | |
|
41 | 42 | from kallithea.lib import webutils |
|
42 | 43 | from kallithea.lib.auth import HasPermissionAnyDecorator, HasUserGroupPermissionLevelDecorator, LoginRequired |
|
43 | from kallithea.lib.base import BaseController, render | |
|
44 | 44 | from kallithea.lib.exceptions import RepoGroupAssignmentError, UserGroupsAssignedException |
|
45 | 45 | from kallithea.lib.utils2 import safe_int, safe_str |
|
46 | 46 | from kallithea.lib.webutils import url |
@@ -53,7 +53,7 b' from kallithea.model.user_group import U' | |||
|
53 | 53 | log = logging.getLogger(__name__) |
|
54 | 54 | |
|
55 | 55 | |
|
56 | class UserGroupsController(BaseController): | |
|
56 | class UserGroupsController(base.BaseController): | |
|
57 | 57 | |
|
58 | 58 | @LoginRequired(allow_default_user=True) |
|
59 | 59 | def _before(self, *args, **kwargs): |
@@ -113,7 +113,7 b' class UserGroupsController(BaseControlle' | |||
|
113 | 113 | "records": user_groups_data |
|
114 | 114 | } |
|
115 | 115 | |
|
116 | return render('admin/user_groups/user_groups.html') | |
|
116 | return base.render('admin/user_groups/user_groups.html') | |
|
117 | 117 | |
|
118 | 118 | @HasPermissionAnyDecorator('hg.admin', 'hg.usergroup.create.true') |
|
119 | 119 | def create(self): |
@@ -134,7 +134,7 b' class UserGroupsController(BaseControlle' | |||
|
134 | 134 | meta.Session().commit() |
|
135 | 135 | except formencode.Invalid as errors: |
|
136 | 136 | return htmlfill.render( |
|
137 | render('admin/user_groups/user_group_add.html'), | |
|
137 | base.render('admin/user_groups/user_group_add.html'), | |
|
138 | 138 | defaults=errors.value, |
|
139 | 139 | errors=errors.error_dict or {}, |
|
140 | 140 | prefix_error=False, |
@@ -149,7 +149,7 b' class UserGroupsController(BaseControlle' | |||
|
149 | 149 | |
|
150 | 150 | @HasPermissionAnyDecorator('hg.admin', 'hg.usergroup.create.true') |
|
151 | 151 | def new(self, format='html'): |
|
152 | return render('admin/user_groups/user_group_add.html') | |
|
152 | return base.render('admin/user_groups/user_group_add.html') | |
|
153 | 153 | |
|
154 | 154 | @HasUserGroupPermissionLevelDecorator('admin') |
|
155 | 155 | def update(self, id): |
@@ -184,7 +184,7 b' class UserGroupsController(BaseControlle' | |||
|
184 | 184 | }) |
|
185 | 185 | |
|
186 | 186 | return htmlfill.render( |
|
187 | render('admin/user_groups/user_group_edit.html'), | |
|
187 | base.render('admin/user_groups/user_group_edit.html'), | |
|
188 | 188 | defaults=defaults, |
|
189 | 189 | errors=e, |
|
190 | 190 | prefix_error=False, |
@@ -221,7 +221,7 b' class UserGroupsController(BaseControlle' | |||
|
221 | 221 | defaults = self.__load_defaults(id) |
|
222 | 222 | |
|
223 | 223 | return htmlfill.render( |
|
224 | render('admin/user_groups/user_group_edit.html'), | |
|
224 | base.render('admin/user_groups/user_group_edit.html'), | |
|
225 | 225 | defaults=defaults, |
|
226 | 226 | encoding="UTF-8", |
|
227 | 227 | force_defaults=False |
@@ -243,7 +243,7 b' class UserGroupsController(BaseControlle' | |||
|
243 | 243 | p.permission.permission_name}) |
|
244 | 244 | |
|
245 | 245 | return htmlfill.render( |
|
246 | render('admin/user_groups/user_group_edit.html'), | |
|
246 | base.render('admin/user_groups/user_group_edit.html'), | |
|
247 | 247 | defaults=defaults, |
|
248 | 248 | encoding="UTF-8", |
|
249 | 249 | force_defaults=False |
@@ -344,7 +344,7 b' class UserGroupsController(BaseControlle' | |||
|
344 | 344 | }) |
|
345 | 345 | |
|
346 | 346 | return htmlfill.render( |
|
347 | render('admin/user_groups/user_group_edit.html'), | |
|
347 | base.render('admin/user_groups/user_group_edit.html'), | |
|
348 | 348 | defaults=defaults, |
|
349 | 349 | encoding="UTF-8", |
|
350 | 350 | force_defaults=False |
@@ -394,7 +394,7 b' class UserGroupsController(BaseControlle' | |||
|
394 | 394 | c.active = 'advanced' |
|
395 | 395 | c.group_members_obj = sorted((x.user for x in c.user_group.members), |
|
396 | 396 | key=lambda u: u.username.lower()) |
|
397 | return render('admin/user_groups/user_group_edit.html') | |
|
397 | return base.render('admin/user_groups/user_group_edit.html') | |
|
398 | 398 | |
|
399 | 399 | @HasUserGroupPermissionLevelDecorator('admin') |
|
400 | 400 | def edit_members(self, id): |
@@ -404,4 +404,4 b' class UserGroupsController(BaseControlle' | |||
|
404 | 404 | key=lambda u: u.username.lower()) |
|
405 | 405 | |
|
406 | 406 | c.group_members = [(x.user_id, x.username) for x in c.group_members_obj] |
|
407 | return render('admin/user_groups/user_group_edit.html') | |
|
407 | return base.render('admin/user_groups/user_group_edit.html') |
@@ -38,9 +38,9 b' from webob.exc import HTTPFound, HTTPNot' | |||
|
38 | 38 | |
|
39 | 39 | import kallithea |
|
40 | 40 | import kallithea.lib.helpers as h |
|
41 | from kallithea.controllers import base | |
|
41 | 42 | from kallithea.lib import auth_modules, webutils |
|
42 | 43 | from kallithea.lib.auth import AuthUser, HasPermissionAnyDecorator, LoginRequired |
|
43 | from kallithea.lib.base import BaseController, IfSshEnabled, render | |
|
44 | 44 | from kallithea.lib.exceptions import DefaultUserException, UserCreationError, UserOwnsReposException |
|
45 | 45 | from kallithea.lib.utils2 import datetime_to_time, fmt_date, generate_api_key, safe_int |
|
46 | 46 | from kallithea.lib.webutils import url |
@@ -54,7 +54,7 b' from kallithea.model.user import UserMod' | |||
|
54 | 54 | log = logging.getLogger(__name__) |
|
55 | 55 | |
|
56 | 56 | |
|
57 | class UsersController(BaseController): | |
|
57 | class UsersController(base.BaseController): | |
|
58 | 58 | |
|
59 | 59 | @LoginRequired() |
|
60 | 60 | @HasPermissionAnyDecorator('hg.admin') |
@@ -103,7 +103,7 b' class UsersController(BaseController):' | |||
|
103 | 103 | "records": users_data |
|
104 | 104 | } |
|
105 | 105 | |
|
106 | return render('admin/users/users.html') | |
|
106 | return base.render('admin/users/users.html') | |
|
107 | 107 | |
|
108 | 108 | def create(self): |
|
109 | 109 | c.default_extern_type = db.User.DEFAULT_AUTH_TYPE |
@@ -120,7 +120,7 b' class UsersController(BaseController):' | |||
|
120 | 120 | meta.Session().commit() |
|
121 | 121 | except formencode.Invalid as errors: |
|
122 | 122 | return htmlfill.render( |
|
123 | render('admin/users/user_add.html'), | |
|
123 | base.render('admin/users/user_add.html'), | |
|
124 | 124 | defaults=errors.value, |
|
125 | 125 | errors=errors.error_dict or {}, |
|
126 | 126 | prefix_error=False, |
@@ -137,7 +137,7 b' class UsersController(BaseController):' | |||
|
137 | 137 | def new(self, format='html'): |
|
138 | 138 | c.default_extern_type = db.User.DEFAULT_AUTH_TYPE |
|
139 | 139 | c.default_extern_name = '' |
|
140 | return render('admin/users/user_add.html') | |
|
140 | return base.render('admin/users/user_add.html') | |
|
141 | 141 | |
|
142 | 142 | def update(self, id): |
|
143 | 143 | user_model = UserModel() |
@@ -208,7 +208,7 b' class UsersController(BaseController):' | |||
|
208 | 208 | c.perm_user = AuthUser(dbuser=user) |
|
209 | 209 | managed_fields = auth_modules.get_managed_fields(user) |
|
210 | 210 | c.readonly = lambda n: 'readonly' if n in managed_fields else None |
|
211 | return render('admin/users/user_edit.html') | |
|
211 | return base.render('admin/users/user_edit.html') | |
|
212 | 212 | |
|
213 | 213 | def edit(self, id, format='html'): |
|
214 | 214 | user = self._get_user_or_raise_if_default(id) |
@@ -234,7 +234,7 b' class UsersController(BaseController):' | |||
|
234 | 234 | 'fork_repo_perm': umodel.has_perm(c.user, 'hg.fork.repository'), |
|
235 | 235 | }) |
|
236 | 236 | return htmlfill.render( |
|
237 | render('admin/users/user_edit.html'), | |
|
237 | base.render('admin/users/user_edit.html'), | |
|
238 | 238 | defaults=defaults, |
|
239 | 239 | encoding="UTF-8", |
|
240 | 240 | force_defaults=False) |
@@ -255,7 +255,7 b' class UsersController(BaseController):' | |||
|
255 | 255 | show_expired=show_expired) |
|
256 | 256 | defaults = c.user.get_dict() |
|
257 | 257 | return htmlfill.render( |
|
258 | render('admin/users/user_edit.html'), | |
|
258 | base.render('admin/users/user_edit.html'), | |
|
259 | 259 | defaults=defaults, |
|
260 | 260 | encoding="UTF-8", |
|
261 | 261 | force_defaults=False) |
@@ -302,7 +302,7 b' class UsersController(BaseController):' | |||
|
302 | 302 | 'fork_repo_perm': umodel.has_perm(c.user, 'hg.fork.repository'), |
|
303 | 303 | }) |
|
304 | 304 | return htmlfill.render( |
|
305 | render('admin/users/user_edit.html'), | |
|
305 | base.render('admin/users/user_edit.html'), | |
|
306 | 306 | defaults=defaults, |
|
307 | 307 | encoding="UTF-8", |
|
308 | 308 | force_defaults=False) |
@@ -350,7 +350,7 b' class UsersController(BaseController):' | |||
|
350 | 350 | |
|
351 | 351 | defaults = c.user.get_dict() |
|
352 | 352 | return htmlfill.render( |
|
353 | render('admin/users/user_edit.html'), | |
|
353 | base.render('admin/users/user_edit.html'), | |
|
354 | 354 | defaults=defaults, |
|
355 | 355 | encoding="UTF-8", |
|
356 | 356 | force_defaults=False) |
@@ -393,7 +393,7 b' class UsersController(BaseController):' | |||
|
393 | 393 | |
|
394 | 394 | defaults = c.user.get_dict() |
|
395 | 395 | return htmlfill.render( |
|
396 | render('admin/users/user_edit.html'), | |
|
396 | base.render('admin/users/user_edit.html'), | |
|
397 | 397 | defaults=defaults, |
|
398 | 398 | encoding="UTF-8", |
|
399 | 399 | force_defaults=False) |
@@ -429,19 +429,19 b' class UsersController(BaseController):' | |||
|
429 | 429 | raise HTTPFound(location=url('admin_permissions_ips')) |
|
430 | 430 | raise HTTPFound(location=url('edit_user_ips', id=id)) |
|
431 | 431 | |
|
432 | @IfSshEnabled | |
|
432 | @base.IfSshEnabled | |
|
433 | 433 | def edit_ssh_keys(self, id): |
|
434 | 434 | c.user = self._get_user_or_raise_if_default(id) |
|
435 | 435 | c.active = 'ssh_keys' |
|
436 | 436 | c.user_ssh_keys = SshKeyModel().get_ssh_keys(c.user.user_id) |
|
437 | 437 | defaults = c.user.get_dict() |
|
438 | 438 | return htmlfill.render( |
|
439 | render('admin/users/user_edit.html'), | |
|
439 | base.render('admin/users/user_edit.html'), | |
|
440 | 440 | defaults=defaults, |
|
441 | 441 | encoding="UTF-8", |
|
442 | 442 | force_defaults=False) |
|
443 | 443 | |
|
444 | @IfSshEnabled | |
|
444 | @base.IfSshEnabled | |
|
445 | 445 | def ssh_keys_add(self, id): |
|
446 | 446 | c.user = self._get_user_or_raise_if_default(id) |
|
447 | 447 | |
@@ -457,7 +457,7 b' class UsersController(BaseController):' | |||
|
457 | 457 | webutils.flash(e.args[0], category='error') |
|
458 | 458 | raise HTTPFound(location=url('edit_user_ssh_keys', id=c.user.user_id)) |
|
459 | 459 | |
|
460 | @IfSshEnabled | |
|
460 | @base.IfSshEnabled | |
|
461 | 461 | def ssh_keys_delete(self, id): |
|
462 | 462 | c.user = self._get_user_or_raise_if_default(id) |
|
463 | 463 |
@@ -35,9 +35,9 b' import types' | |||
|
35 | 35 | from tg import Response, TGController, request, response |
|
36 | 36 | from webob.exc import HTTPError, HTTPException |
|
37 | 37 | |
|
38 | from kallithea.controllers import base | |
|
38 | 39 | from kallithea.lib import ext_json |
|
39 | 40 | from kallithea.lib.auth import AuthUser |
|
40 | from kallithea.lib.base import get_ip_addr, get_path_info | |
|
41 | 41 | from kallithea.lib.utils2 import ascii_bytes |
|
42 | 42 | from kallithea.model import db |
|
43 | 43 | |
@@ -99,7 +99,7 b' class JSONRPCController(TGController):' | |||
|
99 | 99 | |
|
100 | 100 | environ = state.request.environ |
|
101 | 101 | start = time.time() |
|
102 | ip_addr = get_ip_addr(environ) | |
|
102 | ip_addr = base.get_ip_addr(environ) | |
|
103 | 103 | self._req_id = None |
|
104 | 104 | if 'CONTENT_LENGTH' not in environ: |
|
105 | 105 | log.debug("No Content-Length") |
@@ -204,8 +204,8 b' class JSONRPCController(TGController):' | |||
|
204 | 204 | self._rpc_args['environ'] = environ |
|
205 | 205 | |
|
206 | 206 | log.info('IP: %s Request to %s time: %.3fs' % ( |
|
207 | get_ip_addr(environ), | |
|
208 | get_path_info(environ), time.time() - start) | |
|
207 | base.get_ip_addr(environ), | |
|
208 | base.get_path_info(environ), time.time() - start) | |
|
209 | 209 | ) |
|
210 | 210 | |
|
211 | 211 | state.set_action(self._rpc_call, []) |
@@ -13,8 +13,8 b'' | |||
|
13 | 13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
14 | 14 | |
|
15 | 15 | """ |
|
16 |
kallithea. |
|
|
17 | ~~~~~~~~~~~~~~~~~~ | |
|
16 | kallithea.controllers.base | |
|
17 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
|
18 | 18 | |
|
19 | 19 | The base Controller API |
|
20 | 20 | Provides the BaseController class for subclassing. And usage in different |
@@ -33,9 +33,9 b' from tg import tmpl_context as c' | |||
|
33 | 33 | from tg.i18n import ugettext as _ |
|
34 | 34 | from webob.exc import HTTPBadRequest, HTTPFound, HTTPNotFound |
|
35 | 35 | |
|
36 | from kallithea.controllers import base | |
|
36 | 37 | from kallithea.lib import webutils |
|
37 | 38 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired |
|
38 | from kallithea.lib.base import BaseRepoController, render | |
|
39 | 39 | from kallithea.lib.graphmod import graph_data |
|
40 | 40 | from kallithea.lib.page import Page |
|
41 | 41 | from kallithea.lib.utils2 import safe_int |
@@ -46,7 +46,7 b' from kallithea.lib.webutils import url' | |||
|
46 | 46 | log = logging.getLogger(__name__) |
|
47 | 47 | |
|
48 | 48 | |
|
49 | class ChangelogController(BaseRepoController): | |
|
49 | class ChangelogController(base.BaseRepoController): | |
|
50 | 50 | |
|
51 | 51 | def _before(self, *args, **kwargs): |
|
52 | 52 | super(ChangelogController, self)._before(*args, **kwargs) |
@@ -146,12 +146,12 b' class ChangelogController(BaseRepoContro' | |||
|
146 | 146 | |
|
147 | 147 | c.revision = revision # requested revision ref |
|
148 | 148 | c.first_revision = c.cs_pagination[0] # pagination is never empty here! |
|
149 | return render('changelog/changelog.html') | |
|
149 | return base.render('changelog/changelog.html') | |
|
150 | 150 | |
|
151 | 151 | @LoginRequired(allow_default_user=True) |
|
152 | 152 | @HasRepoPermissionLevelDecorator('read') |
|
153 | 153 | def changelog_details(self, cs): |
|
154 | 154 | if request.environ.get('HTTP_X_PARTIAL_XHR'): |
|
155 | 155 | c.cs = c.db_repo_scm_instance.get_changeset(cs) |
|
156 | return render('changelog/changelog_details.html') | |
|
156 | return base.render('changelog/changelog_details.html') | |
|
157 | 157 | raise HTTPNotFound() |
@@ -36,9 +36,9 b' from tg.i18n import ugettext as _' | |||
|
36 | 36 | from webob.exc import HTTPBadRequest, HTTPForbidden, HTTPNotFound |
|
37 | 37 | |
|
38 | 38 | import kallithea.lib.helpers as h |
|
39 | from kallithea.controllers import base | |
|
39 | 40 | from kallithea.lib import auth, diffs, webutils |
|
40 | 41 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired |
|
41 | from kallithea.lib.base import BaseRepoController, jsonify, render | |
|
42 | 42 | from kallithea.lib.graphmod import graph_data |
|
43 | 43 | from kallithea.lib.utils2 import ascii_str, safe_str |
|
44 | 44 | from kallithea.lib.vcs.backends.base import EmptyChangeset |
@@ -148,7 +148,7 b' def create_cs_pr_comment(repo_name, revi' | |||
|
148 | 148 | c.comment = comment |
|
149 | 149 | data.update(comment.get_dict()) |
|
150 | 150 | data.update({'rendered_text': |
|
151 | render('changeset/changeset_comment_block.html')}) | |
|
151 | base.render('changeset/changeset_comment_block.html')}) | |
|
152 | 152 | |
|
153 | 153 | return data |
|
154 | 154 | |
@@ -170,7 +170,7 b' def delete_cs_pr_comment(repo_name, comm' | |||
|
170 | 170 | else: |
|
171 | 171 | raise HTTPForbidden() |
|
172 | 172 | |
|
173 | class ChangesetController(BaseRepoController): | |
|
173 | class ChangesetController(base.BaseRepoController): | |
|
174 | 174 | |
|
175 | 175 | def _before(self, *args, **kwargs): |
|
176 | 176 | super(ChangesetController, self)._before(*args, **kwargs) |
@@ -285,19 +285,19 b' class ChangesetController(BaseRepoContro' | |||
|
285 | 285 | elif method == 'patch': |
|
286 | 286 | response.content_type = 'text/plain' |
|
287 | 287 | c.diff = safe_str(raw_diff) |
|
288 | return render('changeset/patch_changeset.html') | |
|
288 | return base.render('changeset/patch_changeset.html') | |
|
289 | 289 | elif method == 'raw': |
|
290 | 290 | response.content_type = 'text/plain' |
|
291 | 291 | return raw_diff |
|
292 | 292 | elif method == 'show': |
|
293 | 293 | if len(c.cs_ranges) == 1: |
|
294 | return render('changeset/changeset.html') | |
|
294 | return base.render('changeset/changeset.html') | |
|
295 | 295 | else: |
|
296 | 296 | c.cs_ranges_org = None |
|
297 | 297 | c.cs_comments = {} |
|
298 | 298 | revs = [ctx.revision for ctx in reversed(c.cs_ranges)] |
|
299 | 299 | c.jsdata = graph_data(c.db_repo_scm_instance, revs) |
|
300 | return render('changeset/changeset_range.html') | |
|
300 | return base.render('changeset/changeset_range.html') | |
|
301 | 301 | |
|
302 | 302 | @LoginRequired(allow_default_user=True) |
|
303 | 303 | @HasRepoPermissionLevelDecorator('read') |
@@ -321,19 +321,19 b' class ChangesetController(BaseRepoContro' | |||
|
321 | 321 | |
|
322 | 322 | @LoginRequired() |
|
323 | 323 | @HasRepoPermissionLevelDecorator('read') |
|
324 | @jsonify | |
|
324 | @base.jsonify | |
|
325 | 325 | def comment(self, repo_name, revision): |
|
326 | 326 | return create_cs_pr_comment(repo_name, revision=revision) |
|
327 | 327 | |
|
328 | 328 | @LoginRequired() |
|
329 | 329 | @HasRepoPermissionLevelDecorator('read') |
|
330 | @jsonify | |
|
330 | @base.jsonify | |
|
331 | 331 | def delete_comment(self, repo_name, comment_id): |
|
332 | 332 | return delete_cs_pr_comment(repo_name, comment_id) |
|
333 | 333 | |
|
334 | 334 | @LoginRequired(allow_default_user=True) |
|
335 | 335 | @HasRepoPermissionLevelDecorator('read') |
|
336 | @jsonify | |
|
336 | @base.jsonify | |
|
337 | 337 | def changeset_info(self, repo_name, revision): |
|
338 | 338 | if request.is_xhr: |
|
339 | 339 | try: |
@@ -345,7 +345,7 b' class ChangesetController(BaseRepoContro' | |||
|
345 | 345 | |
|
346 | 346 | @LoginRequired(allow_default_user=True) |
|
347 | 347 | @HasRepoPermissionLevelDecorator('read') |
|
348 | @jsonify | |
|
348 | @base.jsonify | |
|
349 | 349 | def changeset_children(self, repo_name, revision): |
|
350 | 350 | if request.is_xhr: |
|
351 | 351 | changeset = c.db_repo_scm_instance.get_changeset(revision) |
@@ -358,7 +358,7 b' class ChangesetController(BaseRepoContro' | |||
|
358 | 358 | |
|
359 | 359 | @LoginRequired(allow_default_user=True) |
|
360 | 360 | @HasRepoPermissionLevelDecorator('read') |
|
361 | @jsonify | |
|
361 | @base.jsonify | |
|
362 | 362 | def changeset_parents(self, repo_name, revision): |
|
363 | 363 | if request.is_xhr: |
|
364 | 364 | changeset = c.db_repo_scm_instance.get_changeset(revision) |
@@ -35,9 +35,9 b' from tg.i18n import ugettext as _' | |||
|
35 | 35 | from webob.exc import HTTPBadRequest, HTTPFound, HTTPNotFound |
|
36 | 36 | |
|
37 | 37 | import kallithea.lib.helpers as h |
|
38 | from kallithea.controllers import base | |
|
38 | 39 | from kallithea.lib import diffs, webutils |
|
39 | 40 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired |
|
40 | from kallithea.lib.base import BaseRepoController, render | |
|
41 | 41 | from kallithea.lib.graphmod import graph_data |
|
42 | 42 | from kallithea.lib.webutils import url |
|
43 | 43 | from kallithea.model import db |
@@ -46,7 +46,7 b' from kallithea.model import db' | |||
|
46 | 46 | log = logging.getLogger(__name__) |
|
47 | 47 | |
|
48 | 48 | |
|
49 | class CompareController(BaseRepoController): | |
|
49 | class CompareController(base.BaseRepoController): | |
|
50 | 50 | |
|
51 | 51 | def _before(self, *args, **kwargs): |
|
52 | 52 | super(CompareController, self)._before(*args, **kwargs) |
@@ -76,7 +76,7 b' class CompareController(BaseRepoControll' | |||
|
76 | 76 | def index(self, repo_name): |
|
77 | 77 | c.compare_home = True |
|
78 | 78 | c.a_ref_name = c.cs_ref_name = None |
|
79 | return render('compare/compare_diff.html') | |
|
79 | return base.render('compare/compare_diff.html') | |
|
80 | 80 | |
|
81 | 81 | @LoginRequired(allow_default_user=True) |
|
82 | 82 | @HasRepoPermissionLevelDecorator('read') |
@@ -129,7 +129,7 b' class CompareController(BaseRepoControll' | |||
|
129 | 129 | c.jsdata = graph_data(c.cs_repo.scm_instance, revs) |
|
130 | 130 | |
|
131 | 131 | if partial: |
|
132 | return render('compare/compare_cs.html') | |
|
132 | return base.render('compare/compare_cs.html') | |
|
133 | 133 | |
|
134 | 134 | org_repo = c.a_repo |
|
135 | 135 | other_repo = c.cs_repo |
@@ -185,4 +185,4 b' class CompareController(BaseRepoControll' | |||
|
185 | 185 | html_diff = diffs.as_html(parsed_lines=[f]) |
|
186 | 186 | c.file_diff_data.append((fid, None, f['operation'], f['old_filename'], filename, html_diff, st)) |
|
187 | 187 | |
|
188 | return render('compare/compare_diff.html') | |
|
188 | return base.render('compare/compare_diff.html') |
@@ -32,13 +32,13 b' from tg import config, expose, request' | |||
|
32 | 32 | from tg import tmpl_context as c |
|
33 | 33 | from tg.i18n import ugettext as _ |
|
34 | 34 | |
|
35 | from kallithea.lib.base import BaseController | |
|
35 | from kallithea.controllers import base | |
|
36 | 36 | |
|
37 | 37 | |
|
38 | 38 | log = logging.getLogger(__name__) |
|
39 | 39 | |
|
40 | 40 | |
|
41 | class ErrorController(BaseController): | |
|
41 | class ErrorController(base.BaseController): | |
|
42 | 42 | """Generates error documents as and when they are required. |
|
43 | 43 | |
|
44 | 44 | The errorpage middleware renders /error/document when error |
@@ -35,9 +35,9 b' from tg.i18n import ugettext as _' | |||
|
35 | 35 | |
|
36 | 36 | import kallithea |
|
37 | 37 | import kallithea.lib.helpers as h |
|
38 | from kallithea.controllers import base | |
|
38 | 39 | from kallithea.lib import feeds, webutils |
|
39 | 40 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired |
|
40 | from kallithea.lib.base import BaseRepoController | |
|
41 | 41 | from kallithea.lib.diffs import DiffProcessor |
|
42 | 42 | from kallithea.lib.utils2 import asbool, fmt_date, safe_int, safe_str, shorter |
|
43 | 43 | |
@@ -45,7 +45,7 b' from kallithea.lib.utils2 import asbool,' | |||
|
45 | 45 | log = logging.getLogger(__name__) |
|
46 | 46 | |
|
47 | 47 | |
|
48 | class FeedController(BaseRepoController): | |
|
48 | class FeedController(base.BaseRepoController): | |
|
49 | 49 | |
|
50 | 50 | @LoginRequired(allow_default_user=True) |
|
51 | 51 | @HasRepoPermissionLevelDecorator('read') |
@@ -40,9 +40,9 b' from webob.exc import HTTPFound, HTTPNot' | |||
|
40 | 40 | |
|
41 | 41 | import kallithea |
|
42 | 42 | import kallithea.lib.helpers as h |
|
43 | from kallithea.controllers import base | |
|
43 | 44 | from kallithea.lib import diffs, webutils |
|
44 | 45 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired |
|
45 | from kallithea.lib.base import BaseRepoController, jsonify, render | |
|
46 | 46 | from kallithea.lib.exceptions import NonRelativePathError |
|
47 | 47 | from kallithea.lib.utils2 import asbool, convert_line_endings, detect_mode, safe_str |
|
48 | 48 | from kallithea.lib.vcs.backends.base import EmptyChangeset |
@@ -60,7 +60,7 b' from kallithea.model.scm import ScmModel' | |||
|
60 | 60 | log = logging.getLogger(__name__) |
|
61 | 61 | |
|
62 | 62 | |
|
63 | class FilesController(BaseRepoController): | |
|
63 | class FilesController(base.BaseRepoController): | |
|
64 | 64 | |
|
65 | 65 | def _before(self, *args, **kwargs): |
|
66 | 66 | super(FilesController, self)._before(*args, **kwargs) |
@@ -179,7 +179,7 b' class FilesController(BaseRepoController' | |||
|
179 | 179 | raise HTTPNotFound() |
|
180 | 180 | |
|
181 | 181 | if request.environ.get('HTTP_X_PARTIAL_XHR'): |
|
182 | return render('files/files_ypjax.html') | |
|
182 | return base.render('files/files_ypjax.html') | |
|
183 | 183 | |
|
184 | 184 | # TODO: tags and bookmarks? |
|
185 | 185 | c.revision_options = [(c.changeset.raw_id, |
@@ -190,11 +190,11 b' class FilesController(BaseRepoController' | |||
|
190 | 190 | c.revision_options += [('-', '-')] + \ |
|
191 | 191 | [(n, prefix + b) for b, n in c.db_repo_scm_instance.closed_branches.items()] |
|
192 | 192 | |
|
193 | return render('files/files.html') | |
|
193 | return base.render('files/files.html') | |
|
194 | 194 | |
|
195 | 195 | @LoginRequired(allow_default_user=True) |
|
196 | 196 | @HasRepoPermissionLevelDecorator('read') |
|
197 | @jsonify | |
|
197 | @base.jsonify | |
|
198 | 198 | def history(self, repo_name, revision, f_path): |
|
199 | 199 | changeset = self.__get_cs(revision) |
|
200 | 200 | _file = changeset.get_node(f_path) |
@@ -224,7 +224,7 b' class FilesController(BaseRepoController' | |||
|
224 | 224 | c.authors = [] |
|
225 | 225 | for a in set([x.author for x in _hist]): |
|
226 | 226 | c.authors.append((author_email(a), h.person(a))) |
|
227 | return render('files/files_history_box.html') | |
|
227 | return base.render('files/files_history_box.html') | |
|
228 | 228 | |
|
229 | 229 | @LoginRequired(allow_default_user=True) |
|
230 | 230 | @HasRepoPermissionLevelDecorator('read') |
@@ -335,7 +335,7 b' class FilesController(BaseRepoController' | |||
|
335 | 335 | raise HTTPFound(location=url('changeset_home', |
|
336 | 336 | repo_name=c.repo_name, revision='tip')) |
|
337 | 337 | |
|
338 | return render('files/files_delete.html') | |
|
338 | return base.render('files/files_delete.html') | |
|
339 | 339 | |
|
340 | 340 | @LoginRequired() |
|
341 | 341 | @HasRepoPermissionLevelDecorator('write') |
@@ -393,7 +393,7 b' class FilesController(BaseRepoController' | |||
|
393 | 393 | raise HTTPFound(location=url('changeset_home', |
|
394 | 394 | repo_name=c.repo_name, revision='tip')) |
|
395 | 395 | |
|
396 | return render('files/files_edit.html') | |
|
396 | return base.render('files/files_edit.html') | |
|
397 | 397 | |
|
398 | 398 | @LoginRequired() |
|
399 | 399 | @HasRepoPermissionLevelDecorator('write') |
@@ -468,7 +468,7 b' class FilesController(BaseRepoController' | |||
|
468 | 468 | raise HTTPFound(location=url('changeset_home', |
|
469 | 469 | repo_name=c.repo_name, revision='tip')) |
|
470 | 470 | |
|
471 | return render('files/files_add.html') | |
|
471 | return base.render('files/files_add.html') | |
|
472 | 472 | |
|
473 | 473 | @LoginRequired(allow_default_user=True) |
|
474 | 474 | @HasRepoPermissionLevelDecorator('read') |
@@ -645,7 +645,7 b' class FilesController(BaseRepoController' | |||
|
645 | 645 | ignore_whitespace=ignore_whitespace_diff, |
|
646 | 646 | line_context=diff_context_size) |
|
647 | 647 | c.file_diff_data = [(fid, fid, op, a_path, node2.path, diff, st)] |
|
648 | return render('files/file_diff.html') | |
|
648 | return base.render('files/file_diff.html') | |
|
649 | 649 | |
|
650 | 650 | @LoginRequired(allow_default_user=True) |
|
651 | 651 | @HasRepoPermissionLevelDecorator('read') |
@@ -693,7 +693,7 b' class FilesController(BaseRepoController' | |||
|
693 | 693 | c.cs1 = c.changeset_1 |
|
694 | 694 | c.cs2 = c.changeset_2 |
|
695 | 695 | |
|
696 | return render('files/diff_2way.html') | |
|
696 | return base.render('files/diff_2way.html') | |
|
697 | 697 | |
|
698 | 698 | def _get_node_history(self, cs, f_path, changesets=None): |
|
699 | 699 | """ |
@@ -736,7 +736,7 b' class FilesController(BaseRepoController' | |||
|
736 | 736 | |
|
737 | 737 | @LoginRequired(allow_default_user=True) |
|
738 | 738 | @HasRepoPermissionLevelDecorator('read') |
|
739 | @jsonify | |
|
739 | @base.jsonify | |
|
740 | 740 | def nodelist(self, repo_name, revision, f_path): |
|
741 | 741 | if request.environ.get('HTTP_X_PARTIAL_XHR'): |
|
742 | 742 | cs = self.__get_cs(revision) |
@@ -30,8 +30,8 b' import logging' | |||
|
30 | 30 | from tg import request |
|
31 | 31 | from tg import tmpl_context as c |
|
32 | 32 | |
|
33 | from kallithea.controllers import base | |
|
33 | 34 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired |
|
34 | from kallithea.lib.base import BaseRepoController, render | |
|
35 | 35 | from kallithea.lib.page import Page |
|
36 | 36 | from kallithea.lib.utils2 import safe_int |
|
37 | 37 | from kallithea.model import db |
@@ -40,7 +40,7 b' from kallithea.model import db' | |||
|
40 | 40 | log = logging.getLogger(__name__) |
|
41 | 41 | |
|
42 | 42 | |
|
43 | class FollowersController(BaseRepoController): | |
|
43 | class FollowersController(base.BaseRepoController): | |
|
44 | 44 | |
|
45 | 45 | @LoginRequired(allow_default_user=True) |
|
46 | 46 | @HasRepoPermissionLevelDecorator('read') |
@@ -52,6 +52,6 b' class FollowersController(BaseRepoContro' | |||
|
52 | 52 | c.followers_pager = Page(d, page=p, items_per_page=20) |
|
53 | 53 | |
|
54 | 54 | if request.environ.get('HTTP_X_PARTIAL_XHR'): |
|
55 | return render('/followers/followers_data.html') | |
|
55 | return base.render('/followers/followers_data.html') | |
|
56 | 56 | |
|
57 | return render('/followers/followers.html') | |
|
57 | return base.render('/followers/followers.html') |
@@ -36,9 +36,9 b' from tg.i18n import ugettext as _' | |||
|
36 | 36 | from webob.exc import HTTPFound, HTTPNotFound |
|
37 | 37 | |
|
38 | 38 | import kallithea |
|
39 | from kallithea.controllers import base | |
|
39 | 40 | from kallithea.lib import webutils |
|
40 | 41 | from kallithea.lib.auth import HasPermissionAnyDecorator, HasRepoPermissionLevel, HasRepoPermissionLevelDecorator, LoginRequired |
|
41 | from kallithea.lib.base import BaseRepoController, render | |
|
42 | 42 | from kallithea.lib.page import Page |
|
43 | 43 | from kallithea.lib.utils2 import safe_int |
|
44 | 44 | from kallithea.model import db |
@@ -50,7 +50,7 b' from kallithea.model.scm import Availabl' | |||
|
50 | 50 | log = logging.getLogger(__name__) |
|
51 | 51 | |
|
52 | 52 | |
|
53 | class ForksController(BaseRepoController): | |
|
53 | class ForksController(base.BaseRepoController): | |
|
54 | 54 | |
|
55 | 55 | def __load_defaults(self): |
|
56 | 56 | c.repo_groups = AvailableRepoGroupChoices('write') |
@@ -113,9 +113,9 b' class ForksController(BaseRepoController' | |||
|
113 | 113 | c.forks_pager = Page(d, page=p, items_per_page=20) |
|
114 | 114 | |
|
115 | 115 | if request.environ.get('HTTP_X_PARTIAL_XHR'): |
|
116 | return render('/forks/forks_data.html') | |
|
116 | return base.render('/forks/forks_data.html') | |
|
117 | 117 | |
|
118 | return render('/forks/forks.html') | |
|
118 | return base.render('/forks/forks.html') | |
|
119 | 119 | |
|
120 | 120 | @LoginRequired() |
|
121 | 121 | @HasPermissionAnyDecorator('hg.admin', 'hg.fork.repository') |
@@ -128,7 +128,7 b' class ForksController(BaseRepoController' | |||
|
128 | 128 | defaults = self.__load_data() |
|
129 | 129 | |
|
130 | 130 | return htmlfill.render( |
|
131 | render('forks/fork.html'), | |
|
131 | base.render('forks/fork.html'), | |
|
132 | 132 | defaults=defaults, |
|
133 | 133 | encoding="UTF-8", |
|
134 | 134 | force_defaults=False) |
@@ -157,7 +157,7 b' class ForksController(BaseRepoController' | |||
|
157 | 157 | task_id = task.task_id |
|
158 | 158 | except formencode.Invalid as errors: |
|
159 | 159 | return htmlfill.render( |
|
160 | render('forks/fork.html'), | |
|
160 | base.render('forks/fork.html'), | |
|
161 | 161 | defaults=errors.value, |
|
162 | 162 | errors=errors.error_dict or {}, |
|
163 | 163 | prefix_error=False, |
@@ -35,8 +35,8 b' from tg.i18n import ugettext as _' | |||
|
35 | 35 | from webob.exc import HTTPBadRequest |
|
36 | 36 | |
|
37 | 37 | import kallithea.lib.helpers as h |
|
38 | from kallithea.controllers import base | |
|
38 | 39 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired |
|
39 | from kallithea.lib.base import BaseController, jsonify, render | |
|
40 | 40 | from kallithea.lib.utils2 import safe_str |
|
41 | 41 | from kallithea.model import db |
|
42 | 42 | from kallithea.model.repo import RepoModel |
@@ -46,10 +46,10 b' from kallithea.model.scm import UserGrou' | |||
|
46 | 46 | log = logging.getLogger(__name__) |
|
47 | 47 | |
|
48 | 48 | |
|
49 | class HomeController(BaseController): | |
|
49 | class HomeController(base.BaseController): | |
|
50 | 50 | |
|
51 | 51 | def about(self): |
|
52 | return render('/about.html') | |
|
52 | return base.render('/about.html') | |
|
53 | 53 | |
|
54 | 54 | @LoginRequired(allow_default_user=True) |
|
55 | 55 | def index(self): |
@@ -62,10 +62,10 b' class HomeController(BaseController):' | |||
|
62 | 62 | repo_groups_list=repo_groups_list, |
|
63 | 63 | short_name=True) |
|
64 | 64 | |
|
65 | return render('/index.html') | |
|
65 | return base.render('/index.html') | |
|
66 | 66 | |
|
67 | 67 | @LoginRequired(allow_default_user=True) |
|
68 | @jsonify | |
|
68 | @base.jsonify | |
|
69 | 69 | def repo_switcher_data(self): |
|
70 | 70 | if request.is_xhr: |
|
71 | 71 | all_repos = db.Repository.query(sorted=True).all() |
@@ -109,7 +109,7 b' class HomeController(BaseController):' | |||
|
109 | 109 | |
|
110 | 110 | @LoginRequired(allow_default_user=True) |
|
111 | 111 | @HasRepoPermissionLevelDecorator('read') |
|
112 | @jsonify | |
|
112 | @base.jsonify | |
|
113 | 113 | def repo_refs_data(self, repo_name): |
|
114 | 114 | repo = db.Repository.get_by_repo_name(repo_name).scm_instance |
|
115 | 115 | res = [] |
@@ -144,7 +144,7 b' class HomeController(BaseController):' | |||
|
144 | 144 | return data |
|
145 | 145 | |
|
146 | 146 | @LoginRequired() |
|
147 | @jsonify | |
|
147 | @base.jsonify | |
|
148 | 148 | def users_and_groups_data(self): |
|
149 | 149 | """ |
|
150 | 150 | Returns 'results' with a list of users and user groups. |
@@ -37,10 +37,10 b' from tg.i18n import ugettext as _' | |||
|
37 | 37 | from webob.exc import HTTPBadRequest |
|
38 | 38 | |
|
39 | 39 | import kallithea.lib.helpers as h |
|
40 | from kallithea.controllers import base | |
|
40 | 41 | from kallithea.controllers.admin.admin import _journal_filter |
|
41 | 42 | from kallithea.lib import feeds, webutils |
|
42 | 43 | from kallithea.lib.auth import LoginRequired |
|
43 | from kallithea.lib.base import BaseController, render | |
|
44 | 44 | from kallithea.lib.page import Page |
|
45 | 45 | from kallithea.lib.utils2 import AttributeDict, safe_int |
|
46 | 46 | from kallithea.model import db, meta |
@@ -55,7 +55,7 b' ttl = "5"' | |||
|
55 | 55 | feed_nr = 20 |
|
56 | 56 | |
|
57 | 57 | |
|
58 | class JournalController(BaseController): | |
|
58 | class JournalController(base.BaseController): | |
|
59 | 59 | |
|
60 | 60 | def _before(self, *args, **kwargs): |
|
61 | 61 | super(JournalController, self)._before(*args, **kwargs) |
@@ -178,7 +178,7 b' class JournalController(BaseController):' | |||
|
178 | 178 | c.journal_day_aggregate = self._get_daily_aggregate(c.journal_pager) |
|
179 | 179 | |
|
180 | 180 | if request.environ.get('HTTP_X_PARTIAL_XHR'): |
|
181 | return render('journal/journal_data.html') | |
|
181 | return base.render('journal/journal_data.html') | |
|
182 | 182 | |
|
183 | 183 | repos_list = db.Repository.query(sorted=True) \ |
|
184 | 184 | .filter_by(owner_id=request.authuser.user_id).all() |
@@ -187,7 +187,7 b' class JournalController(BaseController):' | |||
|
187 | 187 | # data used to render the grid |
|
188 | 188 | c.data = repos_data |
|
189 | 189 | |
|
190 | return render('journal/journal.html') | |
|
190 | return base.render('journal/journal.html') | |
|
191 | 191 | |
|
192 | 192 | @LoginRequired() |
|
193 | 193 | def journal_atom(self): |
@@ -250,9 +250,9 b' class JournalController(BaseController):' | |||
|
250 | 250 | c.journal_day_aggregate = self._get_daily_aggregate(c.journal_pager) |
|
251 | 251 | |
|
252 | 252 | if request.environ.get('HTTP_X_PARTIAL_XHR'): |
|
253 | return render('journal/journal_data.html') | |
|
253 | return base.render('journal/journal_data.html') | |
|
254 | 254 | |
|
255 | return render('journal/public_journal.html') | |
|
255 | return base.render('journal/public_journal.html') | |
|
256 | 256 | |
|
257 | 257 | @LoginRequired(allow_default_user=True) |
|
258 | 258 | def public_journal_atom(self): |
@@ -36,9 +36,9 b' from tg import tmpl_context as c' | |||
|
36 | 36 | from tg.i18n import ugettext as _ |
|
37 | 37 | from webob.exc import HTTPBadRequest, HTTPFound |
|
38 | 38 | |
|
39 | from kallithea.controllers import base | |
|
39 | 40 | from kallithea.lib import webutils |
|
40 | 41 | from kallithea.lib.auth import AuthUser, HasPermissionAnyDecorator |
|
41 | from kallithea.lib.base import BaseController, log_in_user, render | |
|
42 | 42 | from kallithea.lib.exceptions import UserCreationError |
|
43 | 43 | from kallithea.lib.recaptcha import submit |
|
44 | 44 | from kallithea.lib.webutils import url |
@@ -50,7 +50,7 b' from kallithea.model.user import UserMod' | |||
|
50 | 50 | log = logging.getLogger(__name__) |
|
51 | 51 | |
|
52 | 52 | |
|
53 | class LoginController(BaseController): | |
|
53 | class LoginController(base.BaseController): | |
|
54 | 54 | |
|
55 | 55 | def _validate_came_from(self, came_from, |
|
56 | 56 | _re=re.compile(r"/(?!/)[-!#$%&'()*+,./:;=?@_~0-9A-Za-z]*$")): |
@@ -89,7 +89,7 b' class LoginController(BaseController):' | |||
|
89 | 89 | # remove password from filling in form again |
|
90 | 90 | defaults.pop('password', None) |
|
91 | 91 | return htmlfill.render( |
|
92 | render('/login.html'), | |
|
92 | base.render('/login.html'), | |
|
93 | 93 | defaults=errors.value, |
|
94 | 94 | errors=errors.error_dict or {}, |
|
95 | 95 | prefix_error=False, |
@@ -103,7 +103,7 b' class LoginController(BaseController):' | |||
|
103 | 103 | webutils.flash(e, 'error') |
|
104 | 104 | else: |
|
105 | 105 | # login_form already validated the password - now set the session cookie accordingly |
|
106 | auth_user = log_in_user(user, c.form_result['remember'], is_external_auth=False, ip_addr=request.ip_addr) | |
|
106 | auth_user = base.log_in_user(user, c.form_result['remember'], is_external_auth=False, ip_addr=request.ip_addr) | |
|
107 | 107 | if auth_user: |
|
108 | 108 | raise HTTPFound(location=c.came_from) |
|
109 | 109 | webutils.flash(_('Authentication failed.'), 'error') |
@@ -113,7 +113,7 b' class LoginController(BaseController):' | |||
|
113 | 113 | raise HTTPFound(location=c.came_from) |
|
114 | 114 | # continue to show login to default user |
|
115 | 115 | |
|
116 | return render('/login.html') | |
|
116 | return base.render('/login.html') | |
|
117 | 117 | |
|
118 | 118 | @HasPermissionAnyDecorator('hg.admin', 'hg.register.auto_activate', |
|
119 | 119 | 'hg.register.manual_activate') |
@@ -151,7 +151,7 b' class LoginController(BaseController):' | |||
|
151 | 151 | |
|
152 | 152 | except formencode.Invalid as errors: |
|
153 | 153 | return htmlfill.render( |
|
154 | render('/register.html'), | |
|
154 | base.render('/register.html'), | |
|
155 | 155 | defaults=errors.value, |
|
156 | 156 | errors=errors.error_dict or {}, |
|
157 | 157 | prefix_error=False, |
@@ -164,7 +164,7 b' class LoginController(BaseController):' | |||
|
164 | 164 | # Exception itself |
|
165 | 165 | webutils.flash(e, 'error') |
|
166 | 166 | |
|
167 | return render('/register.html') | |
|
167 | return base.render('/register.html') | |
|
168 | 168 | |
|
169 | 169 | def password_reset(self): |
|
170 | 170 | settings = db.Setting.get_app_settings() |
@@ -193,14 +193,14 b' class LoginController(BaseController):' | |||
|
193 | 193 | |
|
194 | 194 | except formencode.Invalid as errors: |
|
195 | 195 | return htmlfill.render( |
|
196 | render('/password_reset.html'), | |
|
196 | base.render('/password_reset.html'), | |
|
197 | 197 | defaults=errors.value, |
|
198 | 198 | errors=errors.error_dict or {}, |
|
199 | 199 | prefix_error=False, |
|
200 | 200 | encoding="UTF-8", |
|
201 | 201 | force_defaults=False) |
|
202 | 202 | |
|
203 | return render('/password_reset.html') | |
|
203 | return base.render('/password_reset.html') | |
|
204 | 204 | |
|
205 | 205 | def password_reset_confirmation(self): |
|
206 | 206 | # This controller handles both GET and POST requests, though we |
@@ -213,14 +213,14 b' class LoginController(BaseController):' | |||
|
213 | 213 | c.timestamp = request.params.get('timestamp') or '' |
|
214 | 214 | c.token = request.params.get('token') or '' |
|
215 | 215 | if not request.POST: |
|
216 | return render('/password_reset_confirmation.html') | |
|
216 | return base.render('/password_reset_confirmation.html') | |
|
217 | 217 | |
|
218 | 218 | form = PasswordResetConfirmationForm()() |
|
219 | 219 | try: |
|
220 | 220 | form_result = form.to_python(dict(request.POST)) |
|
221 | 221 | except formencode.Invalid as errors: |
|
222 | 222 | return htmlfill.render( |
|
223 | render('/password_reset_confirmation.html'), | |
|
223 | base.render('/password_reset_confirmation.html'), | |
|
224 | 224 | defaults=errors.value, |
|
225 | 225 | errors=errors.error_dict or {}, |
|
226 | 226 | prefix_error=False, |
@@ -232,7 +232,7 b' class LoginController(BaseController):' | |||
|
232 | 232 | form_result['token'], |
|
233 | 233 | ): |
|
234 | 234 | return htmlfill.render( |
|
235 | render('/password_reset_confirmation.html'), | |
|
235 | base.render('/password_reset_confirmation.html'), | |
|
236 | 236 | defaults=form_result, |
|
237 | 237 | errors={'token': _('Invalid password reset token')}, |
|
238 | 238 | prefix_error=False, |
@@ -36,10 +36,10 b' from tg.i18n import ugettext as _' | |||
|
36 | 36 | from webob.exc import HTTPBadRequest, HTTPForbidden, HTTPFound, HTTPNotFound |
|
37 | 37 | |
|
38 | 38 | import kallithea.lib.helpers as h |
|
39 | from kallithea.controllers import base | |
|
39 | 40 | from kallithea.controllers.changeset import create_cs_pr_comment, delete_cs_pr_comment |
|
40 | 41 | from kallithea.lib import auth, diffs, webutils |
|
41 | 42 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired |
|
42 | from kallithea.lib.base import BaseRepoController, jsonify, render | |
|
43 | 43 | from kallithea.lib.graphmod import graph_data |
|
44 | 44 | from kallithea.lib.page import Page |
|
45 | 45 | from kallithea.lib.utils2 import ascii_bytes, safe_bytes, safe_int |
@@ -69,7 +69,7 b' def _get_reviewer(user_id):' | |||
|
69 | 69 | return user |
|
70 | 70 | |
|
71 | 71 | |
|
72 | class PullrequestsController(BaseRepoController): | |
|
72 | class PullrequestsController(base.BaseRepoController): | |
|
73 | 73 | |
|
74 | 74 | def _get_repo_refs(self, repo, rev=None, branch=None, branch_rev=None): |
|
75 | 75 | """return a structure with scm repo's interesting changesets, suitable for |
@@ -211,7 +211,7 b' class PullrequestsController(BaseRepoCon' | |||
|
211 | 211 | |
|
212 | 212 | c.pullrequests_pager = Page(c.pull_requests, page=p, items_per_page=100, **url_params) |
|
213 | 213 | |
|
214 | return render('/pullrequests/pullrequest_show_all.html') | |
|
214 | return base.render('/pullrequests/pullrequest_show_all.html') | |
|
215 | 215 | |
|
216 | 216 | @LoginRequired() |
|
217 | 217 | def show_my(self): |
@@ -236,7 +236,7 b' class PullrequestsController(BaseRepoCon' | |||
|
236 | 236 | else: |
|
237 | 237 | c.participate_in_pull_requests_todo.append(pr) |
|
238 | 238 | |
|
239 | return render('/pullrequests/pullrequest_show_my.html') | |
|
239 | return base.render('/pullrequests/pullrequest_show_my.html') | |
|
240 | 240 | |
|
241 | 241 | @LoginRequired() |
|
242 | 242 | @HasRepoPermissionLevelDecorator('read') |
@@ -291,11 +291,11 b' class PullrequestsController(BaseRepoCon' | |||
|
291 | 291 | for fork in org_repo.forks: |
|
292 | 292 | c.a_repos.append((fork.repo_name, fork.repo_name)) |
|
293 | 293 | |
|
294 | return render('/pullrequests/pullrequest.html') | |
|
294 | return base.render('/pullrequests/pullrequest.html') | |
|
295 | 295 | |
|
296 | 296 | @LoginRequired() |
|
297 | 297 | @HasRepoPermissionLevelDecorator('read') |
|
298 | @jsonify | |
|
298 | @base.jsonify | |
|
299 | 299 | def repo_info(self, repo_name): |
|
300 | 300 | repo = c.db_repo |
|
301 | 301 | refs, selected_ref = self._get_repo_refs(repo.scm_instance) |
@@ -432,7 +432,7 b' class PullrequestsController(BaseRepoCon' | |||
|
432 | 432 | |
|
433 | 433 | @LoginRequired() |
|
434 | 434 | @HasRepoPermissionLevelDecorator('read') |
|
435 | @jsonify | |
|
435 | @base.jsonify | |
|
436 | 436 | def delete(self, repo_name, pull_request_id): |
|
437 | 437 | pull_request = db.PullRequest.get_or_404(pull_request_id) |
|
438 | 438 | # only owner can delete it ! |
@@ -620,11 +620,11 b' class PullrequestsController(BaseRepoCon' | |||
|
620 | 620 | |
|
621 | 621 | c.is_ajax_preview = False |
|
622 | 622 | c.ancestors = None # [c.a_rev] ... but that is shown in an other way |
|
623 | return render('/pullrequests/pullrequest_show.html') | |
|
623 | return base.render('/pullrequests/pullrequest_show.html') | |
|
624 | 624 | |
|
625 | 625 | @LoginRequired() |
|
626 | 626 | @HasRepoPermissionLevelDecorator('read') |
|
627 | @jsonify | |
|
627 | @base.jsonify | |
|
628 | 628 | def comment(self, repo_name, pull_request_id): |
|
629 | 629 | pull_request = db.PullRequest.get_or_404(pull_request_id) |
|
630 | 630 | allowed_to_change_status = self._is_allowed_to_change_status(pull_request) |
@@ -633,6 +633,6 b' class PullrequestsController(BaseRepoCon' | |||
|
633 | 633 | |
|
634 | 634 | @LoginRequired() |
|
635 | 635 | @HasRepoPermissionLevelDecorator('read') |
|
636 | @jsonify | |
|
636 | @base.jsonify | |
|
637 | 637 | def delete_comment(self, repo_name, comment_id): |
|
638 | 638 | return delete_cs_pr_comment(repo_name, comment_id) |
@@ -14,9 +14,9 b'' | |||
|
14 | 14 | from tg import config |
|
15 | 15 | from tgext.routes import RoutedController |
|
16 | 16 | |
|
17 | from kallithea.controllers import base | |
|
17 | 18 | from kallithea.controllers.error import ErrorController |
|
18 | 19 | from kallithea.controllers.routing import make_map |
|
19 | from kallithea.lib.base import BaseController | |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | # This is the main Kallithea entry point; TurboGears will forward all requests |
@@ -26,7 +26,7 b' from kallithea.lib.base import BaseContr' | |||
|
26 | 26 | # The mapper is configured using routes defined in routing.py. This use of the |
|
27 | 27 | # 'mapper' attribute is a feature of tgext.routes, which is activated by |
|
28 | 28 | # inheriting from its RoutedController class. |
|
29 | class RootController(RoutedController, BaseController): | |
|
29 | class RootController(RoutedController, base.BaseController): | |
|
30 | 30 | |
|
31 | 31 | def __init__(self): |
|
32 | 32 | self.mapper = make_map(config) |
@@ -35,8 +35,8 b' from whoosh.index import EmptyIndexError' | |||
|
35 | 35 | from whoosh.qparser import QueryParser, QueryParserError |
|
36 | 36 | from whoosh.query import Phrase, Prefix |
|
37 | 37 | |
|
38 | from kallithea.controllers import base | |
|
38 | 39 | from kallithea.lib.auth import LoginRequired |
|
39 | from kallithea.lib.base import BaseRepoController, render | |
|
40 | 40 | from kallithea.lib.indexers import CHGSET_IDX_NAME, CHGSETS_SCHEMA, IDX_NAME, SCHEMA, WhooshResultWrapper |
|
41 | 41 | from kallithea.lib.page import Page |
|
42 | 42 | from kallithea.lib.utils2 import safe_int |
@@ -46,7 +46,7 b' from kallithea.model.repo import RepoMod' | |||
|
46 | 46 | log = logging.getLogger(__name__) |
|
47 | 47 | |
|
48 | 48 | |
|
49 | class SearchController(BaseRepoController): | |
|
49 | class SearchController(base.BaseRepoController): | |
|
50 | 50 | |
|
51 | 51 | @LoginRequired(allow_default_user=True) |
|
52 | 52 | def index(self, repo_name=None): |
@@ -139,4 +139,4 b' class SearchController(BaseRepoControlle' | |||
|
139 | 139 | c.runtime = _('An error occurred during search operation.') |
|
140 | 140 | |
|
141 | 141 | # Return a rendered template |
|
142 | return render('/search/search.html') | |
|
142 | return base.render('/search/search.html') |
@@ -38,9 +38,9 b' from tg import tmpl_context as c' | |||
|
38 | 38 | from tg.i18n import ugettext as _ |
|
39 | 39 | from webob.exc import HTTPBadRequest |
|
40 | 40 | |
|
41 | from kallithea.controllers import base | |
|
41 | 42 | from kallithea.lib import ext_json, webutils |
|
42 | 43 | from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired |
|
43 | from kallithea.lib.base import BaseRepoController, jsonify, render | |
|
44 | 44 | from kallithea.lib.conf import ALL_EXTS, ALL_READMES, LANGUAGES_EXTENSIONS_MAP |
|
45 | 45 | from kallithea.lib.markup_renderer import MarkupRenderer |
|
46 | 46 | from kallithea.lib.page import Page |
@@ -58,7 +58,7 b" README_FILES = [''.join([x[0][0], x[1][0" | |||
|
58 | 58 | key=lambda y:y[0][1] + y[1][1])] |
|
59 | 59 | |
|
60 | 60 | |
|
61 | class SummaryController(BaseRepoController): | |
|
61 | class SummaryController(base.BaseRepoController): | |
|
62 | 62 | |
|
63 | 63 | def __get_readme_data(self, db_repo): |
|
64 | 64 | repo_name = db_repo.repo_name |
@@ -148,11 +148,11 b' class SummaryController(BaseRepoControll' | |||
|
148 | 148 | c.enable_downloads = c.db_repo.enable_downloads |
|
149 | 149 | c.readme_data, c.readme_file = \ |
|
150 | 150 | self.__get_readme_data(c.db_repo) |
|
151 | return render('summary/summary.html') | |
|
151 | return base.render('summary/summary.html') | |
|
152 | 152 | |
|
153 | 153 | @LoginRequired() |
|
154 | 154 | @HasRepoPermissionLevelDecorator('read') |
|
155 | @jsonify | |
|
155 | @base.jsonify | |
|
156 | 156 | def repo_size(self, repo_name): |
|
157 | 157 | if request.is_xhr: |
|
158 | 158 | return c.db_repo._repo_size() |
@@ -209,4 +209,4 b' class SummaryController(BaseRepoControll' | |||
|
209 | 209 | |
|
210 | 210 | recurse_limit = 500 # don't recurse more than 500 times when parsing |
|
211 | 211 | async_tasks.get_commits_stats(c.db_repo.repo_name, ts_min_y, ts_max_y, recurse_limit) |
|
212 | return render('summary/statistics.html') | |
|
212 | return base.render('summary/statistics.html') |
@@ -131,10 +131,10 b' conftest' | |||
|
131 | 131 | |
|
132 | 132 | normal_modules = set(''' |
|
133 | 133 | kallithea |
|
134 | kallithea.controllers.base | |
|
134 | 135 | kallithea.lib |
|
135 | 136 | kallithea.lib.auth |
|
136 | 137 | kallithea.lib.auth_modules |
|
137 | kallithea.lib.base | |
|
138 | 138 | kallithea.lib.celerylib |
|
139 | 139 | kallithea.lib.db_manage |
|
140 | 140 | kallithea.lib.helpers |
General Comments 0
You need to be logged in to leave comments.
Login now