Patch de Products.CMFDefault.formlib.form._EditFormMixin._setRedirect Plinn implement...
[Plinn.git] / skins / photo_theme / homepage_dispatcher.py
1 ##parameters=
2 from Products.CMFCore.utils import getToolByName
3 from ZTUtils import make_query as mq
4 from Products.CMFDefault.utils import Message as _
5
6 utool = getToolByName(context, 'portal_url')
7 req = context.REQUEST
8 resp = req.RESPONSE
9 came_from = req.form.get('came_from')
10
11 if came_from :
12 urlQs = came_from.split('?', 1)
13 if len(urlQs) == 1 :
14 came_from = '%s?%s' % (urlQs[0], mq(portal_status_message=_('Login success')))
15 else :
16 url, qs= urlQs
17 came_from = '%s?%s&%s' % (url, qs, mq(portal_status_message=_('Login success')))
18 return resp.redirect(came_from)
19
20 # else :
21 # from Products.realis.utils import searchContentsWithLocalRolesForAuthenticatedUser as search
22 # results = search(context, portal_type='Portfolio')
23 # if results :
24 # atool = getToolByName(context, 'portal_actions')
25 # return context.setRedirect(atool, 'user/my_albums', portal_status_message=_('Login success'))
26 # else :
27 # utool = getToolByName(context, 'portal_url')
28 # return resp.redirect('%s?%s' % (utool(), mq(portal_status_message=_('Login success'))))
29
30 return resp.redirect('%s?%s' % (utool(), mq(portal_status_message=_('Login success'))))