def replace_post_data_parameters(request, replacements):
    replacements = dict(replacements)
    if request.method == 'POST' and not isinstance(request.body, BytesIO):
        if request.headers.get('Content-Type') == 'application/json':
            json_data = json.loads(request.body.decode('utf-8'))
            for k, rv in replacements.items():
                if k in json_data:
                    ov = json_data.pop(k)
                    if callable(rv):
                        rv = rv(key=k, value=ov, request=request)
                    if rv is not None:
                        json_data[k] = rv
            request.body = json.dumps(json_data).encode('utf-8')
        else:
            if isinstance(request.body, text_type):
                request.body = request.body.encode('utf-8')
            splits = [p.partition(b'=') for p in request.body.split(b'&')]
            new_splits = []
            for k, sep, ov in splits:
                if sep is None:
                    new_splits.append((k, sep, ov))
                else:
                    rk = k.decode('utf-8')
                    if rk not in replacements:
                        new_splits.append((k, sep, ov))
                    else:
                        rv = replacements[rk]
                        if callable(rv):
                            rv = rv(key=rk, value=ov.decode('utf-8'),
                                    request=request)
                        if rv is not None:
                            new_splits.append((k, sep, rv.encode('utf-8')))
            request.body = b'&'.join(k if sep is None else b''.join([k, sep, v])
                                     for k, sep, v in new_splits)
    return request
Set a value in the cache if the key does not already exist. If
dataset/ETHPy150Open kevin1024/vcrpy/vcr/filters.py/replace_post_data_parameters--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/core/cache/backends/base.py/BaseCache.add