Fixed access check and seed for Task Suggest page.
Fixes Issue 694.
Reviewed by: Lennard de Rijk
--- a/app/settings.py Thu Oct 22 09:50:10 2009 +0200
+++ b/app/settings.py Thu Oct 22 09:54:01 2009 +0200
@@ -127,5 +127,5 @@
MODULE_FMT = 'soc.modules.%s.callback'
# TODO: to enable GHOP change the MODULES line have the following entries:
-#MODULES = ['ghop']
-MODULES = []
+MODULES = ['ghop']
+#MODULES = []
--- a/app/soc/modules/ghop/views/models/task.py Thu Oct 22 09:50:10 2009 +0200
+++ b/app/soc/modules/ghop/views/models/task.py Thu Oct 22 09:54:01 2009 +0200
@@ -165,7 +165,7 @@
('checkCanOrgAdminOrMentorEdit', ['scope_path', True]),
('checkRoleAndStatusForTask',
[['ghop/org_admin', 'ghop/mentor'], ['active'],
- []])]
+ ['Unapproved']])]
rights['search'] = ['allow']
new_params = {}
@@ -608,7 +608,7 @@
params, entity)
else:
return self.suggestTaskGet(request, context,
- params, entity, **kwargs)
+ params, entity, kwargs)
def suggestTaskPost(self, request, context, params, entity):
"""Handles the POST request for the suggest task view.
@@ -631,14 +631,12 @@
# hide certain fields.
entity = logic.updateOrCreateFromFields(fields)
- page_params = params['edit_params']
-
redirect = ghop_redirects.getSuggestTaskRedirect(
entity, params)
return http.HttpResponseRedirect(redirect)
- def suggestTaskGet(self, request, context, params, entity, **kwargs):
+ def suggestTaskGet(self, request, context, params, entity, seed):
"""Handles the GET request for the suggest task view.
"""
@@ -647,6 +645,8 @@
form = params['mentor_form'](instance=entity)
self._editGet(request, entity, form)
+ elif seed:
+ form = params['mentor_form'](initial=seed)
else:
form = params['mentor_form']()