From: <plo...@us...> - 2002-07-30 00:48:31
|
Update of /cvsroot/plone/CMFPlone In directory usw-pr-cvs1:/tmp/cvs-serv24663 Modified Files: PloneTool.py Log Message: Fixed the way the navigation dispatcher handles query strings in navigationProperties Index: PloneTool.py =================================================================== RCS file: /cvsroot/plone/CMFPlone/PloneTool.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PloneTool.py 29 Jul 2002 23:48:29 -0000 1.17 --- PloneTool.py 30 Jul 2002 00:48:27 -0000 1.18 *************** *** 9,12 **** --- 9,13 ---- from types import TupleType from urllib import urlencode + from cgi import parse_qs import re *************** *** 197,200 **** --- 198,213 ---- """ action_id=self.getNavigationTransistion(context,action,status) + # If any query parameters have been specified in the transition, + # stick them into the request before calling getActionById() + queryIndex = action_id.find('?') + if queryIndex: + query = parse_qs(action_id[queryIndex+1:]) + for key in query.keys(): + if len(query[key]) == 1: + self.REQUEST[key] = query[key][0] + else: + self.REQUEST[key] = query[key] + action_id = action_id[0:queryIndex] + log('action='+action_id+', query='+str(query)) next_action=context.getTypeInfo().getActionById(action_id) if next_action is not None: *************** *** 205,210 **** def getNextRequestFor(self, context, action, status, **kwargs): """ takes object, action, and status and returns a RESPONSE redirect """ - url_params=urlencode(kwargs) action_id=self.getNavigationTransistion(context,action,status) ### redirect=None try: --- 218,228 ---- def getNextRequestFor(self, context, action, status, **kwargs): """ takes object, action, and status and returns a RESPONSE redirect """ action_id=self.getNavigationTransistion(context,action,status) ### + if action_id.find('?') >= 0: + separator = '&' + else: + separator = '?' + + url_params=urlencode(kwargs) redirect=None try: *************** *** 212,217 **** except: # XXX because ActionTool doesnt throw ActionNotFound exception ;( pass ! return self.REQUEST.RESPONSE.redirect( '%s/%s?%s' % ( context.absolute_url() , action_id , url_params) ) InitializeClass(PloneTool) --- 230,236 ---- except: # XXX because ActionTool doesnt throw ActionNotFound exception ;( pass ! return self.REQUEST.RESPONSE.redirect( '%s/%s%s%s' % ( context.absolute_url() , action_id + , separator , url_params) ) InitializeClass(PloneTool) |