##// END OF EJS Templates
controllers: simplify request.GET.get for safe_int...
Mads Kiilerich -
r5992:fb64046d default
parent child Browse files
Show More
@@ -135,7 +135,7 b' class AdminController(BaseController):'
135 135
136 136 users_log = users_log.order_by(UserLog.action_date.desc())
137 137
138 p = safe_int(request.GET.get('page', 1), 1)
138 p = safe_int(request.GET.get('page'), 1)
139 139
140 140 def url_generator(**kw):
141 141 return url.current(filter=c.search_term, **kw)
@@ -97,7 +97,7 b' class GistsController(BaseController):'
97 97 gists = gists.filter(Gist.gist_type == Gist.GIST_PUBLIC)
98 98
99 99 c.gists = gists
100 p = safe_int(request.GET.get('page', 1), 1)
100 p = safe_int(request.GET.get('page'), 1)
101 101 c.gists_pager = Page(c.gists, page=p, items_per_page=10)
102 102 return render('admin/gists/index.html')
103 103
@@ -64,7 +64,7 b' class NotificationsController(BaseContro'
64 64 notif = NotificationModel().query_for_user(self.authuser.user_id,
65 65 filter_=request.GET.getall('type'))
66 66
67 p = safe_int(request.GET.get('page', 1), 1)
67 p = safe_int(request.GET.get('page'), 1)
68 68 c.notifications = Page(notif, page=p, items_per_page=10)
69 69 c.pull_request_type = Notification.TYPE_PULL_REQUEST
70 70 c.comment_type = [Notification.TYPE_CHANGESET_COMMENT,
@@ -111,7 +111,7 b' class ChangelogController(BaseRepoContro'
111 111 c.size = int(session.get('changelog_size', default))
112 112 # min size must be 1
113 113 c.size = max(c.size, 1)
114 p = safe_int(request.GET.get('page', 1), 1)
114 p = safe_int(request.GET.get('page'), 1)
115 115 branch_name = request.GET.get('branch', None)
116 116 if (branch_name and
117 117 branch_name not in c.db_repo_scm_instance.branches and
@@ -47,7 +47,7 b' class FollowersController(BaseRepoContro'
47 47 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
48 48 'repository.admin')
49 49 def followers(self, repo_name):
50 p = safe_int(request.GET.get('page', 1), 1)
50 p = safe_int(request.GET.get('page'), 1)
51 51 repo_id = c.db_repo.repo_id
52 52 d = UserFollowing.get_repo_followers(repo_id) \
53 53 .order_by(UserFollowing.follows_from)
@@ -112,7 +112,7 b' class ForksController(BaseRepoController'
112 112 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
113 113 'repository.admin')
114 114 def forks(self, repo_name):
115 p = safe_int(request.GET.get('page', 1), 1)
115 p = safe_int(request.GET.get('page'), 1)
116 116 repo_id = c.db_repo.repo_id
117 117 d = []
118 118 for r in Repository.get_repo_forks(repo_id):
@@ -192,7 +192,7 b' class JournalController(BaseController):'
192 192 @NotAnonymous()
193 193 def index(self):
194 194 # Return a rendered template
195 p = safe_int(request.GET.get('page', 1), 1)
195 p = safe_int(request.GET.get('page'), 1)
196 196 c.user = User.get(self.authuser.user_id)
197 197 c.following = self.sa.query(UserFollowing) \
198 198 .filter(UserFollowing.user_id == self.authuser.user_id) \
@@ -328,7 +328,7 b' class JournalController(BaseController):'
328 328 @LoginRequired()
329 329 def public_journal(self):
330 330 # Return a rendered template
331 p = safe_int(request.GET.get('page', 1), 1)
331 p = safe_int(request.GET.get('page'), 1)
332 332
333 333 c.following = self.sa.query(UserFollowing) \
334 334 .filter(UserFollowing.user_id == self.authuser.user_id) \
@@ -197,7 +197,7 b' class PullrequestsController(BaseRepoCon'
197 197 c.closed = request.GET.get('closed') or ''
198 198 c.pull_requests = PullRequestModel().get_all(repo_name, from_=c.from_, closed=c.closed)
199 199 c.repo_name = repo_name
200 p = safe_int(request.GET.get('page', 1), 1)
200 p = safe_int(request.GET.get('page'), 1)
201 201
202 202 c.pullrequests_pager = Page(c.pull_requests, page=p, items_per_page=100)
203 203
@@ -85,7 +85,7 b' class SearchController(BaseRepoControlle'
85 85 log.debug(cur_query)
86 86
87 87 if c.cur_query:
88 p = safe_int(request.GET.get('page', 1), 1)
88 p = safe_int(request.GET.get('page'), 1)
89 89 highlight_items = set()
90 90 try:
91 91 idx = open_dir(config['app_conf']['index_dir'],
General Comments 0
You need to be logged in to leave comments. Login now