Exemplo n.º 1
0
def init_request(request):
    frappe.local.request = request
    frappe.local.is_ajax = frappe.get_request_header(
        "X-Requested-With") == "XMLHttpRequest"

    site = _site or request.headers.get('X-Frappe-Site-Name') or get_site_name(
        request.host)
    frappe.init(site=site, sites_path=_sites_path)

    request_id = frappe.get_request_header('X-Request-Id')
    if not request_id:
        request_id = str(uuid4())
    frappe.flags.task_id = frappe.flags.request_id = request_id
    frappe.flags.runner_type = 'web'

    if not (frappe.local.conf and frappe.local.conf.db_name):
        # site does not exist
        raise NotFound

    if frappe.local.conf.get('maintenance_mode'):
        raise frappe.SessionStopped

    make_form_dict(request)

    frappe.local.http_request = frappe.auth.HTTPRequest()
Exemplo n.º 2
0
def init_request(request):
    frappe.local.request = request
    frappe.local.is_ajax = frappe.get_request_header(
        "X-Requested-With") == "XMLHttpRequest"

    site = _site or request.headers.get('X-Frappe-Site-Name') or get_site_name(
        request.host)
    frappe.init(site=site, sites_path=_sites_path)

    if not (frappe.local.conf and frappe.local.conf.db_name):
        # site does not exist
        raise NotFound

    if frappe.local.conf.get('maintenance_mode'):
        raise frappe.SessionStopped

    make_form_dict(request)

    frappe.local.http_request = AnvilHTTPRequest()