# HG changeset patch # User Todd Larsen # Date 1227345764 0 # Node ID 2ceb3b14349c2aed5dcca46b2fd0557c447cb093 # Parent be0de865ffc95dac2c3dfb579a4f82eda97ada35 Fix for 404 occuring when signing out during the creation of, for example, a new Document. This patch makes sure that the request.path is not altered when requesting the create page (alteration of which caused the 404). This also results in the seeds now being remembered when being forced to log in. The editPost method now correctly switches to the edit path after a successful edit. Patch by: Lennard de Rijk diff -r be0de865ffc9 -r 2ceb3b14349c app/soc/views/models/base.py --- a/app/soc/views/models/base.py Sat Nov 22 09:08:29 2008 +0000 +++ b/app/soc/views/models/base.py Sat Nov 22 09:22:44 2008 +0000 @@ -197,11 +197,6 @@ for field in fields: empty_kwargs[field] = None - request.path = params['create_redirect'] - request.path = helper.requests.replaceSuffix(request.path, - old_suffix='edit', - new_suffix='edit') - if not kwargs: return self.edit(request, page_name=page_name, params=params, **empty_kwargs) @@ -266,7 +261,16 @@ key_name, fields = self.collectCleanedFields(form) # get the old_suffix before editing - old_suffix = self._logic.getKeySuffix(entity) + if entity: + old_suffix = '%s%s' %('edit/', self._logic.getKeySuffix(entity)) + else: + # retrieve the suffix appened to the create path + splitted_path = request.path.split('/create/',1) + if len(splitted_path) == 2 : + old_suffix = '%s%s' %('create/', splitted_path[1]) + else: + # no suffix after the create in the request path + old_suffix = 'create' self._editPost(request, entity, fields) @@ -280,12 +284,12 @@ return http.HttpResponseRedirect('/') page_params = params['edit_params'] - suffix = self._logic.getKeySuffix(entity) + new_suffix = '%s%s' %('edit/', self._logic.getKeySuffix(entity)) # redirect to (possibly new) location of the entity # (causes 'Profile saved' message to be displayed) return helper.responses.redirectToChangedSuffix( - request, old_suffix, suffix, + request, old_suffix, new_suffix, params=page_params) def editGet(self, request, entity, context, seed, params):