summaryrefslogtreecommitdiffstats
path: root/rp_meyzieu/filters/portail_famille_ecitiz.py
blob: c414e2f1d1b9b58ffd2f0b6de812524e33fbd79a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

import re

from mandaye.log import logger

def associate(env, values, request, response):
    if response.msg and "<form" in response.msg:
        sub = re.subn(r'<form action="/ffaxsslMeyzieu/workflow_url".*?>', '<form action="/ffaxsslMeyzieu/mandaye_associate" method="post" accept-charset="UTF-8">',
                response.msg)
        response.msg = sub[0]
        if sub[1] != 1:
            logger.warning('Filter portail_famille_ecitiz.associate: change form action failed !')
        response.msg = response.msg.replace('<a name="egoSubmitMeConnecter_action133_6T9N"></a>', '')
        response.msg = response.msg.replace('Connexion', 'Association')
        sub = re.subn(r'<input type="submit" name="egoSubmitMeConnecter_action133_6T9N".*?>', '<input type="submit"  title="" class="teamnetButtonValid teamnetButtonValidLeftToRight" value="Associer" />',
                response.msg)
        response.msg = sub[0]
        if sub[1] != 1:
            logger.warning('Filter portail_famille_ecitiz.associate: submit replacement failed !')

    return response