'Build context to render the `web_form.html` template'

def get_context(self, context):

    self.set_web_form_module()
    context._login_required = False
    if (self.login_required and (frappe.session.user == u'Guest')):
        context._login_required = True
    (doc, delimeter) = make_route_string(frappe.form_dict)
    context.doc = doc
    context.delimeter = delimeter
    if ((frappe.session.user == u'Guest') and frappe.form_dict.name):
        frappe.throw(_(u'You    need    to    be    logged    in    to    access    this    {0}.').format(self.doc_type), frappe.PermissionError)
    if (frappe.form_dict.name and (not has_web_form_permission(self.doc_type, frappe.form_dict.name))):
        frappe.throw(_(u"You    don't    have    the    permissions    to    access    this    document"), frappe.PermissionError)
    self.reset_field_parent()
    if self.is_standard:
        self.use_meta_fields()
    if (not context._login_required):
        if self.allow_edit:
            if self.allow_multiple:
                if ((not frappe.form_dict.name) and (not frappe.form_dict.new)):
                    self.build_as_list(context)
            else:
                if ((frappe.session.user != u'Guest') and (not frappe.form_dict.name)):
                    frappe.form_dict.name = frappe.db.get_value(self.doc_type, {u'owner': frappe.session.user}, u'name')
                if (not frappe.form_dict.name):
                    frappe.form_dict.new = 1
    if ((not self.login_required) or (not self.allow_edit)):
        frappe.form_dict.new = 1
    self.load_document(context)
    context.parents = self.get_parents(context)
    if self.breadcrumbs:
        context.parents = frappe.safe_eval(self.breadcrumbs, {u'_': _})
    context.has_header = ((frappe.form_dict.name or frappe.form_dict.new) and ((frappe.session.user != u'Guest') or (not self.login_required)))
    if context.success_message:
        context.success_message = frappe.db.escape(context.success_message.replace(u'\n', u'<br>'))
    self.add_custom_context_and_script(context)
    if (not context.max_attachment_size):
        context.max_attachment_size = ((get_max_file_size() / 1024) / 1024)
