Implemented the 2nd part of bulk acceptance.
The context of the _list call can now be set by using the kwarg context. This will be merged with the universalcontext.
Added a TODO to create the organziation accepted email template.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- a/app/soc/views/models/base.py Fri Feb 13 13:35:31 2009 +0000
+++ b/app/soc/views/models/base.py Fri Feb 13 16:40:02 2009 +0000
@@ -425,7 +425,7 @@
return self._list(request, params, contents, page_name)
- def _list(self, request, params, contents, page_name):
+ def _list(self, request, params, contents, page_name, context={}):
"""Returns the list page for the specified contents.
Args:
@@ -433,6 +433,7 @@
params: a dict with params for this View
contents: a list of content dicts
page_name: the page name displayed in templates as page and header title
+ context: the context for this page
Params usage:
name: The name value is used to set the entity_type in the
@@ -444,7 +445,8 @@
to display the list of all entities for this View.
"""
- context = helper.responses.getUniversalContext(request)
+ context = dicts.merge(context,
+ helper.responses.getUniversalContext(request))
context['page_name'] = page_name
context['list'] = soc.logic.lists.Lists(contents)
--- a/app/soc/views/models/group_app.py Fri Feb 13 13:35:31 2009 +0000
+++ b/app/soc/views/models/group_app.py Fri Feb 13 16:40:02 2009 +0000
@@ -195,7 +195,12 @@
index += 1
# call the _list method from base to display the list
- return self._list(request, params, contents, page_name)
+ if kwargs['context']:
+ context = kwargs['context']
+ else:
+ context = {}
+
+ return self._list(request, params, contents, page_name, context=context)
@decorators.merge_params
@@ -260,6 +265,7 @@
fields = {'status' : status_value}
self._logic.updateEntityProperties(entity, fields)
+ self._review(request, params, entity, status_value, **kwargs)
if status_value == 'accepted':
# the application has been accepted send out a notification
@@ -287,6 +293,19 @@
page_name=page_name, params=params, **kwargs)
+ def _review(self, request, params, app_entity, status, **kwargs):
+ """Does any required post review processing.
+
+ Args:
+ request: the standard Django HTTP request object
+ params: a dict with params for this View
+ app_entity: The update application entity
+ status: The status that was given to the reviewed app_entity
+
+ """
+ pass
+
+
@decorators.merge_params
@decorators.check_access
def reviewOverview(self, request, access_type,
--- a/app/soc/views/models/org_app.py Fri Feb 13 13:35:31 2009 +0000
+++ b/app/soc/views/models/org_app.py Fri Feb 13 16:40:02 2009 +0000
@@ -129,9 +129,11 @@
page_name=None, params=None, **kwargs):
params['list_template'] = 'soc/org_app/review_overview.html'
+ context = {'bulk_accept_link': '/org_app/bulk_accept/%(scope_path)s' %(
+ kwargs)}
return super(View, self).reviewOverview(request, access_type,
- page_name=page_name, params=params, **kwargs)
+ page_name=page_name, params=params, context=context, **kwargs)
def _editContext(self, request, context):
"""See base.View._editContext.
@@ -160,6 +162,17 @@
form.fields['admin_agreement'].widget.text = content
+ def _review(self, request, params, app_entity, status, **kwargs):
+ """Sends out an email if an org_app has been reviewed and accepted.
+
+ For params see group_app.View._review().
+ """
+
+ if status == 'accepted':
+ #TODO(ljvderijk) create the email template
+ pass
+
+
@decorators.merge_params
@decorators.check_access
def bulkAccept(self, request, access_type,
@@ -183,6 +196,8 @@
to_json = {
'program' : program_entity.name,
'applications': org_apps,
+ 'link' : '/org_app/review/%s/(link_id)?status=accepted' %(
+ program_entity.key().name()),
}
json = simplejson.dumps(to_json)