From 4a54e649c7697e64fbf163f26678d4beda295ec1 Mon Sep 17 00:00:00 2001 From: Grzegorz Orczykowski Date: Fri, 22 Sep 2023 02:06:08 +0200 Subject: [PATCH] Ignore adding package name to draw/signature/selfie image questions --- pyxform/xls2json.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pyxform/xls2json.py b/pyxform/xls2json.py index 1ae15bb1..2d864fed 100644 --- a/pyxform/xls2json.py +++ b/pyxform/xls2json.py @@ -1332,15 +1332,21 @@ def workbook_to_json( ) if "app" in parameters.keys(): - android_package_regex_pattern = ( - "^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$" - ) - app_package_name = str(parameters["app"]) - if re.fullmatch(android_package_regex_pattern, app_package_name): - new_dict["control"] = new_dict.get("control", {}) - new_dict["control"].update({"intent": app_package_name}) - else: - raise PyXFormError("Invalid Android package name format") + appearance = row.get("control", {}).get("appearance") + if ( + appearance != "signature" + and appearance != "draw" + and appearance != "new-front" + ): + android_package_regex_pattern = ( + "^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$" + ) + app_package_name = str(parameters["app"]) + if re.fullmatch(android_package_regex_pattern, app_package_name): + new_dict["control"] = new_dict.get("control", {}) + new_dict["control"].update({"intent": app_package_name}) + else: + raise PyXFormError("Invalid Android package name format.") parent_children_array.append(new_dict) continue