Merge branch 'develop' into socket_io-refactor
This commit is contained in:
commit
e32f0cd0f8
4 changed files with 34 additions and 4 deletions
|
|
@ -54,8 +54,8 @@ repos:
|
|||
hooks:
|
||||
- id: isort
|
||||
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.9.2
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 5.0.4
|
||||
hooks:
|
||||
- id: flake8
|
||||
additional_dependencies: ['flake8-bugbear',]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,12 @@
|
|||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
from contextlib import suppress
|
||||
from shutil import which
|
||||
|
||||
import click
|
||||
|
||||
|
|
@ -653,10 +657,22 @@ def convert_archive_content(sql_file_path):
|
|||
if frappe.conf.db_type == "mariadb":
|
||||
# ever since mariaDB 10.6, row_format COMPRESSED has been deprecated and removed
|
||||
# this step is added to ease restoring sites depending on older mariaDB servers
|
||||
# This change was reverted by mariadb in 10.6.6
|
||||
# Ref: https://mariadb.com/kb/en/innodb-compressed-row-format/#read-only
|
||||
from pathlib import Path
|
||||
|
||||
from frappe.utils import random_string
|
||||
|
||||
version = _guess_mariadb_version()
|
||||
if not version or (version <= (10, 6, 0) or version >= (10, 6, 6)):
|
||||
return
|
||||
|
||||
click.secho(
|
||||
"MariaDB version being used does not support ROW_FORMAT=COMPRESSED, "
|
||||
"converting into DYNAMIC format.",
|
||||
fg="yellow",
|
||||
)
|
||||
|
||||
old_sql_file_path = Path(f"{sql_file_path}_{random_string(10)}")
|
||||
sql_file_path = Path(sql_file_path)
|
||||
|
||||
|
|
@ -684,6 +700,20 @@ def extract_sql_gzip(sql_gz_path):
|
|||
return decompressed_file
|
||||
|
||||
|
||||
def _guess_mariadb_version() -> tuple[int] | None:
|
||||
# Using command-line because we *might* not have a connection yet and this command is required
|
||||
# in non-interactive mode.
|
||||
# Use db.sql("select version()") instead if connection is available.
|
||||
with suppress(Exception):
|
||||
mysql = which("mysql")
|
||||
version_output = subprocess.getoutput(f"{mysql} --version")
|
||||
version_regex = r"(?P<version>\d+\.\d+\.\d+)-MariaDB"
|
||||
|
||||
version = re.search(version_regex, version_output).group("version")
|
||||
|
||||
return tuple(int(v) for v in version.split("."))
|
||||
|
||||
|
||||
def extract_files(site_name, file_path):
|
||||
import shutil
|
||||
import subprocess
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ frappe.ui.form.ControlInput = class ControlInput extends frappe.ui.form.Control
|
|||
if (me.frm) {
|
||||
me.value = frappe.model.get_value(me.doctype, me.docname, me.df.fieldname);
|
||||
} else if (me.doc) {
|
||||
me.value = me.doc[me.df.fieldname];
|
||||
me.value = me.doc[me.df.fieldname] || "";
|
||||
}
|
||||
|
||||
if (me.can_write()) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ frappe.ready(function () {
|
|||
function setup_fields(web_form_doc, doc_data) {
|
||||
web_form_doc.web_form_fields.forEach((df) => {
|
||||
df.is_web_form = true;
|
||||
df.read_only = !web_form_doc.is_new && !web_form_doc.in_edit_mode;
|
||||
df.read_only = df.read_only || (!web_form_doc.is_new && !web_form_doc.in_edit_mode);
|
||||
if (df.fieldtype === "Table") {
|
||||
df.get_data = () => {
|
||||
let data = [];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue