Make it possible to redirect anywhere after editPost
This makes it possible to not include the suffix in the redirect by
making it a named parameter.
Patch by: Sverre Rabbelier
--- a/app/soc/views/helper/params.py Sat Dec 13 13:09:06 2008 +0000
+++ b/app/soc/views/helper/params.py Sat Dec 13 13:27:40 2008 +0000
@@ -84,9 +84,8 @@
new_params['rights'] = rights
new_params['scope_logic'] = params['logic'].getScopeLogic()
-
- new_params['create_redirect'] = '/%(url_name)s' % params
- new_params['edit_redirect'] = '/%(url_name)s/edit' % params
+ # Do not expand edit_redirect to allow it to be overriden without suffix
+ new_params['edit_redirect'] = '/%(url_name)s/edit/%(suffix)s'
new_params['missing_redirect'] = '/%(url_name)s/create' % params
new_params['delete_redirect'] = '/%(url_name)s/list' % params
new_params['invite_redirect'] = '/request/list'
--- a/app/soc/views/models/base.py Sat Dec 13 13:09:06 2008 +0000
+++ b/app/soc/views/models/base.py Sat Dec 13 13:27:40 2008 +0000
@@ -261,7 +261,6 @@
key_name, fields = forms.collectCleanedFields(form)
- request.path = params['edit_redirect']
self._editPost(request, entity, fields)
if not key_name:
@@ -274,13 +273,14 @@
return http.HttpResponseRedirect('/')
page_params = params['edit_params']
- new_suffix = self._logic.getKeySuffix(entity)
+ params['suffix'] = self._logic.getKeySuffix(entity)
+
+ request.path = params['edit_redirect'] % params
# redirect to (possibly new) location of the entity
# (causes 'Profile saved' message to be displayed)
return helper.responses.redirectToChangedSuffix(
- request, None, new_suffix,
- params=page_params)
+ request, None, params=page_params)
def editGet(self, request, entity, context, seed, params):
"""Processes GET requests for the specified entity.