Skip to content

modules/db/create_string.py

Overview

This file contains 4 documented elements.

Functions

convert_cell_schema(s, c)

Iterates over a cell schema provided as a list of lists (s) and, for each value in every row, builds a field-value dictionary using create_dict_field_value and replaces slash-prefixed field placeholders with their corresponding values via dynamic_replace. The transformed rows are collected into a new list of lists, which is returned as cell_schema_res. The function accepts the cell schema (s) and a list of slash-prefixed field names (c) as its two parameters.

Parameters: - s - c

dynamic_replace(s, d)

No description available. Performs sequential placeholder substitution on a string s using key-value pairs from dictionary d. For each key found in s, it replaces the key with the corresponding value by converting matched keys to %s format specifiers and applying Python string formatting. Any exceptions raised during the substitution process are silently suppressed, and the function returns the resulting string after all replacements have been attempted.

Parameters: - s - d

create_dict_field_value(f)

No description available. Accepts a list of field names (f) and iterates over each field, stripping the first character from each field name to derive a lookup key (field_copy). For each field, it retrieves a corresponding value (intended to be fetched from a database based on table name, record ID, and field name) and maps the original field name to that value in a dictionary. Returns the resulting dictionary (diz_field_value) of field-name-to-value pairs.

Note: The actual database query logic is not implemented in the visible source; the value assignment is currently a placeholder string ("qui il valore").

Parameters: - f