소스 검색

Merge pull request #4645 from netchampfaris/handle-json-request

Handle content_type application/json in request
version-14
Prateeksha Singh 7 년 전
committed by GitHub
부모
커밋
a3669c86a5
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. +8
    -1
      frappe/app.py

+ 8
- 1
frappe/app.py 파일 보기

@@ -121,8 +121,15 @@ def init_request(request):
frappe.local.http_request = frappe.auth.HTTPRequest()

def make_form_dict(request):
import json

if request.content_type == 'application/json':
args = json.loads(request.data)
else:
args = request.form or request.args

frappe.local.form_dict = frappe._dict({ k:v[0] if isinstance(v, (list, tuple)) else v \
for k, v in iteritems(request.form or request.args) })
for k, v in iteritems(args) })

if "_" in frappe.local.form_dict:
# _ is passed by $.ajax so that the request is not cached by the browser. So, remove _ from form_dict


불러오는 중...
취소
저장