Removed the strip_form() utility to strip_post() in the Mia core application.
This commit is contained in:
parent
375f0db9e0
commit
7c218cbc76
@ -40,7 +40,7 @@ from mia_core import stored_post
|
||||
from mia_core.digest_auth import login_required
|
||||
from mia_core.period import Period
|
||||
from mia_core.utils import Pagination, get_multi_lingual_search, UrlBuilder, \
|
||||
strip_form, new_pk, PaginationException
|
||||
strip_post, new_pk, PaginationException
|
||||
from mia_core.views import DeleteView
|
||||
from .forms import AccountForm
|
||||
from .models import Record, Transaction, Account
|
||||
@ -873,7 +873,7 @@ def txn_store(request, txn_type, txn=None):
|
||||
HttpResponse: The response.
|
||||
"""
|
||||
post = request.POST.dict()
|
||||
strip_form(post)
|
||||
strip_post(post)
|
||||
sort_post_txn_records(post)
|
||||
form = make_txn_form_from_post(post, txn_type, txn)
|
||||
if not form.is_valid():
|
||||
|
@ -43,16 +43,16 @@ def new_pk(cls):
|
||||
return pk
|
||||
|
||||
|
||||
def strip_form(form):
|
||||
"""Strips the values of a form. Empty strings are converted to None.
|
||||
def strip_post(post):
|
||||
"""Strips the values of the POSTed data. Empty strings are removed.
|
||||
|
||||
Args:
|
||||
form (dict[str]): The form.
|
||||
post (dict[str]): The POSTed data.
|
||||
"""
|
||||
for key in list(form.keys()):
|
||||
form[key] = form[key].strip()
|
||||
if form[key] == "":
|
||||
del form[key]
|
||||
for key in list(post.keys()):
|
||||
post[key] = post[key].strip()
|
||||
if post[key] == "":
|
||||
del post[key]
|
||||
|
||||
|
||||
class Language:
|
||||
|
Loading…
Reference in New Issue
Block a user