Make _constructResponsoe take an optional template
authorSverre Rabbelier <srabbelier@gmail.com>
Sun, 15 Feb 2009 14:55:29 +0000
changeset 1339 c007dc7d00ca
parent 1338 4b8546a3b20c
child 1340 06ffdc68ab1b
Make _constructResponsoe take an optional template Patch by: Sverre Rabbelier
app/soc/views/models/base.py
--- a/app/soc/views/models/base.py	Sun Feb 15 14:55:05 2009 +0000
+++ b/app/soc/views/models/base.py	Sun Feb 15 14:55:29 2009 +0000
@@ -697,7 +697,8 @@
 
     pass
 
-  def _constructResponse(self, request, entity, context, form, params):
+  def _constructResponse(self, request, entity, context,
+                         form, params, template=None):
     """Updates the context and returns a response for the specified arguments.
 
     Args:
@@ -706,6 +707,7 @@
       context: the context to be used
       form: the form that will be used and set in the context
       params: a dict with params for this View
+      template: if specified, this template is
 
     Params usage:
       name: The name_plural value is used to set the entity_type
@@ -735,10 +737,11 @@
     if params.get('export_content_type') and entity:
       context['export_link'] = redirects.getExportRedirect(entity, params)
 
-    if entity:
-      template = params['edit_template']
-    else:
-      template = params['create_template']
+    if not template:
+      if entity:
+        template = params['edit_template']
+      else:
+        template = params['create_template']
 
     self._editContext(request, context)
     return helper.responses.respond(request, template, context)