瀏覽代碼

fix: Replace render() with get_response

version-14
Suraj Shetty 4 年之前
父節點
當前提交
e18a43e11d
共有 2 個檔案被更改,包括 5 行新增5 行删除
  1. +3
    -3
      frappe/app.py
  2. +2
    -2
      frappe/utils/response.py

+ 3
- 3
frappe/app.py 查看文件

@@ -20,6 +20,7 @@ import frappe.api
import frappe.utils.response import frappe.utils.response
from frappe.utils import get_site_name, sanitize_html from frappe.utils import get_site_name, sanitize_html
from frappe.middlewares import StaticDataMiddleware from frappe.middlewares import StaticDataMiddleware
from frappe.website.serve import get_response
from frappe.utils.error import make_error_snapshot from frappe.utils.error import make_error_snapshot
from frappe.core.doctype.comment.comment import update_comments_in_parent_after_request from frappe.core.doctype.comment.comment import update_comments_in_parent_after_request
from frappe import _ from frappe import _
@@ -73,7 +74,7 @@ def application(request):
response = frappe.utils.response.download_private_file(request.path) response = frappe.utils.response.download_private_file(request.path)


elif request.method in ('GET', 'HEAD', 'POST'): elif request.method in ('GET', 'HEAD', 'POST'):
response = frappe.website.render.render()
response = get_response()


else: else:
raise NotFound raise NotFound
@@ -255,8 +256,7 @@ def handle_exception(e):
make_error_snapshot(e) make_error_snapshot(e)


if return_as_message: if return_as_message:
response = frappe.website.render.render("message",
http_status_code=http_status_code)
response = get_response("message", http_status_code=http_status_code)


return response return response




+ 2
- 2
frappe/utils/response.py 查看文件

@@ -149,8 +149,8 @@ def json_handler(obj):


def as_page(): def as_page():
"""print web page""" """print web page"""
from frappe.website.render import render
return render(frappe.response['route'], http_status_code=frappe.response.get("http_status_code"))
from frappe.website.serve import get_response
return get_response(frappe.response['route'], http_status_code=frappe.response.get("http_status_code"))


def redirect(): def redirect():
return werkzeug.utils.redirect(frappe.response.location) return werkzeug.utils.redirect(frappe.response.location)


Loading…
取消
儲存