##// END OF EJS Templates
core: use new style pyramid partial renderer where possible.
marcink -
r1897:01df07bd default
parent child Browse files
Show More
@@ -24,7 +24,6 b' import logging'
24 from pyramid.httpexceptions import HTTPFound
24 from pyramid.httpexceptions import HTTPFound
25
25
26 from rhodecode.lib import helpers as h
26 from rhodecode.lib import helpers as h
27 from rhodecode.lib.utils import PartialRenderer
28 from rhodecode.lib.utils2 import StrictAttributeDict, safe_int, datetime_to_time
27 from rhodecode.lib.utils2 import StrictAttributeDict, safe_int, datetime_to_time
29 from rhodecode.lib.vcs.exceptions import RepositoryRequirementError
28 from rhodecode.lib.vcs.exceptions import RepositoryRequirementError
30 from rhodecode.lib.ext_json import json
29 from rhodecode.lib.ext_json import json
@@ -219,8 +218,8 b' class BaseReferencesView(RepoAppView):'
219 return c
218 return c
220
219
221 def load_refs_context(self, ref_items, partials_template):
220 def load_refs_context(self, ref_items, partials_template):
222 _render = PartialRenderer(partials_template)
223 _data = []
221 _data = []
222 _render = self.request.get_partial_renderer(partials_template)
224 pre_load = ["author", "date", "message"]
223 pre_load = ["author", "date", "message"]
225
224
226 is_svn = h.is_svn(self.rhodecode_vcs_repo)
225 is_svn = h.is_svn(self.rhodecode_vcs_repo)
@@ -33,7 +33,6 b' from rhodecode.lib.ext_json import json'
33 from rhodecode.lib.auth import (
33 from rhodecode.lib.auth import (
34 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
34 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
35 from rhodecode.lib import helpers as h
35 from rhodecode.lib import helpers as h
36 from rhodecode.lib.utils import PartialRenderer
37 from rhodecode.lib.utils2 import safe_int, safe_unicode
36 from rhodecode.lib.utils2 import safe_int, safe_unicode
38 from rhodecode.model.auth_token import AuthTokenModel
37 from rhodecode.model.auth_token import AuthTokenModel
39 from rhodecode.model.user import UserModel
38 from rhodecode.model.user import UserModel
@@ -82,7 +81,8 b' class AdminUsersView(BaseAppView, DataGr'
82 draw, start, limit = self._extract_chunk(self.request)
81 draw, start, limit = self._extract_chunk(self.request)
83 search_q, order_by, order_dir = self._extract_ordering(self.request)
82 search_q, order_by, order_dir = self._extract_ordering(self.request)
84
83
85 _render = PartialRenderer('data_table/_dt_elements.mako')
84 _render = self.request.get_partial_renderer(
85 'data_table/_dt_elements.mako')
86
86
87 def user_actions(user_id, username):
87 def user_actions(user_id, username):
88 return _render("user_actions", user_id, username)
88 return _render("user_actions", user_id, username)
@@ -112,8 +112,8 b' class GistView(BaseAppView):'
112 gists = _gists.filter(Gist.gist_type == Gist.GIST_PUBLIC)
112 gists = _gists.filter(Gist.gist_type == Gist.GIST_PUBLIC)
113 c.active = 'public'
113 c.active = 'public'
114
114
115 from rhodecode.lib.utils import PartialRenderer
115 _render = self.request.get_partial_renderer(
116 _render = PartialRenderer('data_table/_dt_elements.mako')
116 'data_table/_dt_elements.mako')
117
117
118 data = []
118 data = []
119
119
@@ -35,7 +35,6 b' from rhodecode.lib.ext_json import json'
35 from rhodecode.lib.auth import LoginRequired, NotAnonymous, CSRFRequired
35 from rhodecode.lib.auth import LoginRequired, NotAnonymous, CSRFRequired
36 from rhodecode.lib.channelstream import channelstream_request, \
36 from rhodecode.lib.channelstream import channelstream_request, \
37 ChannelstreamException
37 ChannelstreamException
38 from rhodecode.lib.utils import PartialRenderer
39 from rhodecode.lib.utils2 import safe_int, md5, str2bool
38 from rhodecode.lib.utils2 import safe_int, md5, str2bool
40 from rhodecode.model.auth_token import AuthTokenModel
39 from rhodecode.model.auth_token import AuthTokenModel
41 from rhodecode.model.comment import CommentsModel
40 from rhodecode.model.comment import CommentsModel
@@ -496,7 +495,8 b' class MyAccountView(BaseAppView, DataGri'
496 def _get_pull_requests_list(self, statuses):
495 def _get_pull_requests_list(self, statuses):
497 draw, start, limit = self._extract_chunk(self.request)
496 draw, start, limit = self._extract_chunk(self.request)
498 search_q, order_by, order_dir = self._extract_ordering(self.request)
497 search_q, order_by, order_dir = self._extract_ordering(self.request)
499 _render = PartialRenderer('data_table/_dt_elements.mako')
498 _render = self.request.get_partial_renderer(
499 'data_table/_dt_elements.mako')
500
500
501 pull_requests = PullRequestModel().get_im_participating_in(
501 pull_requests = PullRequestModel().get_im_participating_in(
502 user_id=self._rhodecode_user.user_id,
502 user_id=self._rhodecode_user.user_id,
@@ -28,7 +28,6 b' from rhodecode.apps._base import RepoApp'
28 from rhodecode.lib import helpers as h, diffs, codeblocks
28 from rhodecode.lib import helpers as h, diffs, codeblocks
29 from rhodecode.lib.auth import (
29 from rhodecode.lib.auth import (
30 LoginRequired, HasRepoPermissionAnyDecorator)
30 LoginRequired, HasRepoPermissionAnyDecorator)
31 from rhodecode.lib.utils import PartialRenderer
32 from rhodecode.lib.utils2 import str2bool, safe_int, safe_str
31 from rhodecode.lib.utils2 import str2bool, safe_int, safe_str
33 from rhodecode.lib.vcs.backends.base import EmptyCommit
32 from rhodecode.lib.vcs.backends.base import EmptyCommit
34 from rhodecode.lib.vcs.exceptions import CommitDoesNotExistError, \
33 from rhodecode.lib.vcs.exceptions import CommitDoesNotExistError, \
@@ -57,7 +56,8 b' class RepoPullRequestsView(RepoAppView, '
57
56
58 draw, start, limit = self._extract_chunk(self.request)
57 draw, start, limit = self._extract_chunk(self.request)
59 search_q, order_by, order_dir = self._extract_ordering(self.request)
58 search_q, order_by, order_dir = self._extract_ordering(self.request)
60 _render = PartialRenderer('data_table/_dt_elements.mako')
59 _render = self.request.get_partial_renderer(
60 'data_table/_dt_elements.mako')
61
61
62 # pagination
62 # pagination
63
63
@@ -106,9 +106,10 b' class UserGroupsController(BaseControlle'
106 # permission check inside
106 # permission check inside
107 @NotAnonymous()
107 @NotAnonymous()
108 def index(self):
108 def index(self):
109
109 # TODO(marcink): remove bind to self.request after pyramid migration
110 from rhodecode.lib.utils import PartialRenderer
110 self.request = c.pyramid_request
111 _render = PartialRenderer('data_table/_dt_elements.mako')
111 _render = self.request.get_partial_renderer(
112 'data_table/_dt_elements.mako')
112
113
113 def user_group_name(user_group_id, user_group_name):
114 def user_group_name(user_group_id, user_group_name):
114 return _render("user_group_name", user_group_id, user_group_name)
115 return _render("user_group_name", user_group_id, user_group_name)
@@ -195,10 +195,9 b' class RepoModel(BaseModel):'
195
195
196 def get_repos_as_dict(self, repo_list=None, admin=False,
196 def get_repos_as_dict(self, repo_list=None, admin=False,
197 super_user_actions=False):
197 super_user_actions=False):
198
198 _render = get_current_request().get_partial_renderer(
199 from rhodecode.lib.utils import PartialRenderer
199 'data_table/_dt_elements.mako')
200 _render = PartialRenderer('data_table/_dt_elements.mako')
200 c = _render.get_call_context()
201 c = _render.c
202
201
203 def quick_menu(repo_name):
202 def quick_menu(repo_name):
204 return _render('quick_menu', repo_name)
203 return _render('quick_menu', repo_name)
@@ -673,10 +673,11 b' class RepoGroupModel(BaseModel):'
673 def get_repo_groups_as_dict(self, repo_group_list=None, admin=False,
673 def get_repo_groups_as_dict(self, repo_group_list=None, admin=False,
674 super_user_actions=False):
674 super_user_actions=False):
675
675
676 from rhodecode.lib.utils import PartialRenderer
676 from pyramid.threadlocal import get_current_request
677 _render = PartialRenderer('data_table/_dt_elements.mako')
677 _render = get_current_request().get_partial_renderer(
678 c = _render.c
678 'data_table/_dt_elements.mako')
679 h = _render.h
679 c = _render.get_call_context()
680 h = _render.get_helpers()
680
681
681 def quick_menu(repo_group_name):
682 def quick_menu(repo_group_name):
682 return _render('quick_repo_group_menu', repo_group_name)
683 return _render('quick_repo_group_menu', repo_group_name)
General Comments 0
You need to be logged in to leave comments. Login now