1 from ZTUtils
import make_query
2 from Products
.CMFCore
.utils
import getToolByName
3 from Products
.CMFDefault
.exceptions
import zExceptions_Unauthorized
4 from Products
.CMFDefault
.utils
import translate
6 def _setRedirect(self
, provider_id
, action_path
, keys
=''):
7 # Products.CMFDefault.formlib.form._EditFormMixin._setRedirect Plinn implementation
8 provider
= getToolByName(self
.context
, provider_id
)
10 target
= provider
.getActionInfo(action_path
, self
.context
,
11 check_condition
=1)['url']
12 except (ValueError, zExceptions_Unauthorized
):
13 target
= self
._getPortalURL
()
17 message
= translate(self
.status
, self
.context
)
18 if isinstance(message
, unicode):
19 message
= message
.encode(self
._getBrowserCharset
())
20 kw
['portal_status_message'] = message
21 for k
in keys
.split(','):
23 v
= self
.request
.form
.get(k
, None)
27 if self
.request
.form
.has_key('ajax') :
28 kw
['ajax'] = self
.request
.form
['ajax']
29 query
= kw
and ('?%s' % make_query(kw
)) or ''
30 self
.request
.RESPONSE
.redirect('%s%s' % (target
, query
))