Fixed bug (for python only)
This commit is contained in:
parent
4a53773756
commit
8414d479ad
@ -29,7 +29,8 @@ function generatePythonTriggerCode($functionName, $pyCode, $row) {
|
||||
$imports = "import json\n" . getPythonImports();
|
||||
|
||||
// Prepare row data for Python
|
||||
$rowJson = str_replace("'", "\\'", json_encode($row));
|
||||
$rowJson = json_encode($row, JSON_UNESCAPED_UNICODE);
|
||||
$rowJsonPyLiteral = json_encode($rowJson);
|
||||
|
||||
// Indent user-provided Python code
|
||||
$indentedCode = implode("\n", array_map(fn($line) => ' ' . $line, explode("\n", $pyCode)));
|
||||
@ -41,7 +42,7 @@ $constants
|
||||
def $functionName(data, error):
|
||||
$indentedCode
|
||||
|
||||
data = json.loads('$rowJson')
|
||||
data = json.loads($rowJsonPyLiteral)
|
||||
error = None
|
||||
$functionName(data, error)
|
||||
print(json.dumps(data))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user