def set_price_filter(request, category_slug):
    """Saves the given price filter to session. Redirects to the category with
    given slug.
    """
    req = request.POST if request.method == 'POST' else request.GET
    try:
        min_val = lfs.core.utils.atof(req.get("min", "0"))
    except (ValueError):
        min_val = 0

    try:
        max_val = lfs.core.utils.atof(req.get("max", "99999"))
    except:
        max_val = 0

    try:
        float(min_val)
    except (TypeError, __HOLE__):
        min_val = "0"

    try:
        float(max_val)
    except (TypeError, ValueError):
        max_val = "0"

    request.session["price-filter"] = {"min": min_val, "max": max_val}

    url = reverse("lfs_category", kwargs={"slug": category_slug})
    return HttpResponseRedirect(url)
dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/views.py/set_price_filter