Remove the logic parameter from getListContent
Now that params always has a 'logic' attribute, we can use that
instead of requiring that it is passed as argument.
Patch by: Sverre Rabbelier
--- a/app/soc/views/helper/lists.py Tue Dec 02 20:14:14 2008 +0000
+++ b/app/soc/views/helper/lists.py Tue Dec 02 22:03:46 2008 +0000
@@ -88,13 +88,12 @@
return limit, offset
-def getListContent(request, params, logic, filter=None, idx=0):
+def getListContent(request, params, filter=None, idx=0):
"""Returns a dict with fields used for rendering lists.
Args:
request: the Django HTTP request object
params: a dict with params for the View this list belongs to
- logic: the logic object for the View this list belongs to
filter: a filter for this list
idx: the index of this list
@@ -116,6 +115,8 @@
}
"""
+ logic = params['logic']
+
limit, offset = getLimitAndOffset(request, idx)
arg_name = 'limit_%d' % idx
pagination_form = makePaginationForm(request, limit, arg_name)
--- a/app/soc/views/models/base.py Tue Dec 02 20:14:14 2008 +0000
+++ b/app/soc/views/models/base.py Tue Dec 02 22:03:46 2008 +0000
@@ -363,7 +363,7 @@
except out_of_band.Error, error:
return helper.responses.errorResponse(error, request)
- content = helper.lists.getListContent(request, params, self._logic, filter)
+ content = helper.lists.getListContent(request, params, filter)
contents = [content]
return self._list(request, params, contents, page_name)
--- a/app/soc/views/models/program.py Tue Dec 02 20:14:14 2008 +0000
+++ b/app/soc/views/models/program.py Tue Dec 02 22:03:46 2008 +0000
@@ -123,7 +123,7 @@
new_params = dicts.merge(new_params, sponsor_view.view._params)
params = dicts.merge(new_params, params)
- content = helper.lists.getListContent(request, params, sponsor_logic.logic)
+ content = helper.lists.getListContent(request, params)
contents = [content]
return self._list(request, params, contents, page_name)
--- a/app/soc/views/models/request.py Tue Dec 02 20:14:14 2008 +0000
+++ b/app/soc/views/models/request.py Tue Dec 02 22:03:46 2008 +0000
@@ -140,6 +140,7 @@
"""
params = dicts.merge(params, self._params)
+ params['logic'] = self._logic
try:
access.checkAccess('listSelf', request, params['rights'])
@@ -162,7 +163,7 @@
"An overview of your unhandled requests.")
uh_list = helper.lists.getListContent(
- request, uh_params, self._logic, filter, 0)
+ request, uh_params, filter, 0)
# construct the Open Requests list
@@ -176,7 +177,7 @@
"List of your pending requests.")
ar_list = helper.lists.getListContent(
- request, ar_params, self._logic, filter, 1)
+ request, ar_params, filter, 1)
# fill contents with all the needed lists
contents = [uh_list, ar_list]
--- a/app/soc/views/models/role.py Tue Dec 02 20:14:14 2008 +0000
+++ b/app/soc/views/models/role.py Tue Dec 02 22:03:46 2008 +0000
@@ -98,13 +98,14 @@
new_params = dicts.merge(new_params, params)
params = dicts.merge(new_params, user_view.view._params)
+ params['logic'] = user_logic.logic
try:
access.checkAccess('invite', request, rights=params['rights'])
except out_of_band.Error, error:
return helper.responses.errorResponse(error, request)
- content = helper.lists.getListContent(request, params, user_logic.logic)
+ content = helper.lists.getListContent(request, params)
contents = [content]
return self._list(request, params, contents, page_name)