2 class RequestUtils(object):
\r
6 def set_sort_method(self, sort):
\r
7 self.request.session['questions_sort_method'] = sort
\r
9 def sort_method(self, default):
\r
10 sort = self.request.REQUEST.get('sort', None)
\r
12 return self.request.session.get('questions_sort_method', default)
\r
14 self.set_sort_method(sort)
\r
17 def page_size(self, default):
\r
18 pagesize = self.request.REQUEST.get('pagesize', None)
\r
19 if pagesize is None:
\r
20 return int(self.request.session.get('questions_pagesize', default))
\r
22 self.request.session['questions_pagesize'] = pagesize
\r
23 return int(pagesize)
\r
25 def process_request(self, request):
\r
26 self.request = request
\r
27 request.utils = self
\r