<commit_before>"""Reusable views for eCommerce app."""

from django.conf import settings
from django.contrib.humanize.templatetags.humanize import intcomma
from django.core.urlresolvers import reverse_lazy
from django.http import JsonResponse
from django.shortcuts import render, redirect, get_object_or_404, Http404
from django.template.defaultfilters import floatformat
from django.template.loader import render_to_string
from django.views.generic import View

from ecommerce import mailer
from ecommerce.cart import Cart
from ecommerce.forms import OrderForm
from ecommerce.models import Order
from pages.models import CustomPage
from pages.views import CustomPageView


def save_order_to_session(session, order: Order):
    """Save order's id to user's session and mark session as modified."""
    session['order_id'] = order.id
    session.modified = True


# TODO - rm it
def get_keys_from_post(request, *args):
    """Get a tuple of given keys from request.POST object."""
    return tuple(request.POST[arg] for arg in args)
<commit_msg>#279 Remove wrong todo task (#280)<commit_after>"""Reusable views for eCommerce app."""

from django.conf import settings
from django.contrib.humanize.templatetags.humanize import intcomma
from django.core.urlresolvers import reverse_lazy
from django.http import JsonResponse
from django.shortcuts import render, redirect, get_object_or_404, Http404
from django.template.defaultfilters import floatformat
from django.template.loader import render_to_string
from django.views.generic import View

from ecommerce import mailer
from ecommerce.cart import Cart
from ecommerce.forms import OrderForm
from ecommerce.models import Order
from pages.models import CustomPage
from pages.views import CustomPageView


def save_order_to_session(session, order: Order):
    """Save order's id to user's session and mark session as modified."""
    session['order_id'] = order.id
    session.modified = True


# @todo #279:30m Fix PDD linter from CI pipeline.
#  It missed the wrong formatted task. See the parent task for details.
def get_keys_from_post(request, *args):
    """Get a tuple of given keys from request.POST object."""
    return tuple(request.POST[arg] for arg in args)

{'fraction_non_alphanumeric': 0.07220216606498195, 'fraction_numerical': 0.010379061371841155, 'mean_word_length': 5.3342857142857145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '187424', 'n_tokens_mistral': 633, 'n_tokens_neox': 601, 'n_words': 230}