Indexation de la position par utilisation d'un adaptateur, plutôt que d'utiliser...
[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 req = context.REQUEST
7 resp = req.RESPONSE
8 came_from = req.form.get('came_from')
9
10 if came_from :
11 urlQs = came_from.split('?', 1)
12 if len(urlQs) == 1 :
13 came_from = '%s?%s' % (urlQs[0], mq(portal_status_message=_('Login success')))
14 else :
15 url, qs= urlQs
16 came_from = '%s?%s&%s' % (url, qs, mq(portal_status_message=_('Login success')))
17 return resp.redirect(came_from)
18
19 else :
20 from Products.realis.utils import searchContentsWithLocalRolesForAuthenticatedUser as search
21 results = search(context, portal_type='Portfolio')
22 if results :
23 atool = getToolByName(context, 'portal_actions')
24 return context.setRedirect(atool, 'user/my_albums', portal_status_message=_('Login success'))
25 else :
26 utool = getToolByName(context, 'portal_url')
27 return resp.redirect('%s?%s' % (utool(), mq(portal_status_message=_('Login success'))))
28